Exemple #1
0
def attachment_delete(oauth_request, storage, feature_id, attachment_storage, attachment_id, extension):

    Feature_ = Feature()
    Feature_.current_user = oauth_request.user
    Feature_.attachment_delete(storage, feature_id, "attachment_" + attachment_storage, attachment_id)

    try:
        return status_.status_204(), 204
    except Exception as e:
        return status_.status_500(e), 500
Exemple #2
0
def feature_delete(oauth_request, storage, feature_id, extension):

    Feature_ = Feature()
    Feature_.current_user = oauth_request.user
    deleted_feature = Feature_.feature_delete(storage, feature_id)

    if type(deleted_feature) is tuple:
        return deleted_feature

    try:
        return status_.status_204(), 204
    except Exception as e:
        return status_.status_500(e), 500
Exemple #3
0
def feature_create(oauth_request, storage, extension, is_crowdsourced):

    Feature_ = Feature()
    Feature_.current_user = oauth_request.user
    new_feature = Feature_.feature_create(request, storage)

    if type(new_feature) is tuple:
        return new_feature

    try:
        return status_.status_201(new_feature.id), 201
    except Exception as e:
        return status_.status_500(e), 500
Exemple #4
0
def feature_update(oauth_request, storage, feature_id, extension):

    Feature_ = Feature()
    Feature_.current_user = oauth_request.user
    updated_feature = Feature_.feature_update(request, storage, feature_id)

    if type(updated_feature) is tuple:
        return updated_feature

    arguments = {"the_content": updated_feature, "extension": extension}

    try:
        return Feature_.endpoint_response(**arguments)
    except Exception as e:
        return status_.status_500(e), 500
Exemple #5
0
 def internal_error(error):
   logger.error('Error 500, %s', error)
   logger.exception(error)
   return status_.status_500(error), 500
Exemple #6
0
 def internal_error(error):
   logger.error('InvalidScopeError, %s', error)
   logger.exception(error)
   return status_.status_500('Your OAuth Scopes don\'t match the ones specified for your application'), 500