@RequireLogin()
def put(request, username):
    # Users can only update their own account, unless admin
    if (request.user['username'] != username) and (auth.is_admin(request.user) is False):
        return HttpResponseForbidden()

    try:
        in_json = json.loads(request.body)
    except ValueError:
        return HttpResponseBadRequest("invalid JSON")

    from api.models import db_model
    dbc = db_model.connect()
    user = dbc.hbuser.find_one({"username": username})
    if user is None:
        return HttpResponseNotFound()
    else:
        if "password" in in_json:
            m = hashlib.sha512()
            m.update(in_json['password'])
            user['password'] = m.hexdigest()
        if "email" in in_json:
            user['email'] = in_json['email']
        if "roles" in in_json:
            user['roles'] = in_json['roles']
        user['updatedAt'] = datetime.isoformat(datetime.now())
        dbc.hbuser.save(user)
        logger.info("user '%s' updated by '%s'" % (username, request.user['username']))
        return HttpResponse()
Computes transformed polygon shapes from a shape
dataset/ETHPy150Open emccode/heliosburn/heliosburn/django/hbproject/api/views/user.py/put--crossover with--dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/site-packages/turtle.py/RawTurtle._polytrafo