def dashboard_edit(user): value = request.form.get('value') id = request.form.get('id') if not id: return value split_id = id.split(':') entity_type = split_id[0] if entity_type == 'profile': profile_name = split_id[1] option = split_id[2] profile = storage.read_profile(profile_name) if option in profile: validator = PROFILE_OPTION_VALIDATORS.get(option) if validator: try: validator(value) except Exception: logging.exception('invalid value %s for `%s` profile option' % (value, option)) return split_id[3] profile[option] = value storage.write_profile(profile_name, profile) else: return split_id[3] return value
def create_profile(name, user=None): body = request.json print body if body: storage.write_profile(name, body) return 'ok'