Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(15)  |  Call(11)  |  Derive(0)  |  Import(4)

src/f/l/flask-mongorest-HEAD/flask_mongorest/resources.py   flask-mongorest(Download)
 
from cleancat import ValidationError as SchemaValidationError
from flask.ext.mongorest.exceptions import ValidationError, UnknownFieldError
from flask.ext.mongorest.utils import cmp_fields, isbound, isint
from flask.ext.mongorest.utils import MongoEncoder
    def raw_data(self):
        if not hasattr(self, '_raw_data'):
            if request.method in ('PUT', 'POST'):
                if request.mimetype and 'json' not in request.mimetype:
                    raise ValidationError({'error': "Please send valid JSON with a 'Content-Type: application/json' header."})
 
                try:
                    self._raw_data = json.loads(request.data)
                except ValueError:
                    raise ValidationError({'error': 'The request contains invalid JSON.'})
                    raise ValidationError({'error': 'The request contains invalid JSON.'})
                if not isinstance(self._raw_data, dict):
                    raise ValidationError({'error': 'JSON data must be a dict.'})
            else:
                self._raw_data = {}
                self.data = schema.full_clean()
            except SchemaValidationError:
                raise ValidationError({'field-errors': schema.field_errors, 'errors': schema.errors })
 
        elif self.form:

src/f/l/Flask-MongoRest-0.1.1/flask_mongorest/resources.py   Flask-MongoRest(Download)
from bson.dbref import DBRef
from mongoengine.fields import EmbeddedDocumentField, ListField, ReferenceField, DateTimeField
from flask.ext.mongorest.exceptions import ValidationError
import dateutil.parser
 
 
            if not form.validate():
                raise ValidationError({'field-errors': form.errors})
 
            self.data = form.data
                else:
                    return str(errors)
            raise ValidationError({'field-errors': serialize_errors(e.errors)})
 
    def create_object(self, data=None, save=True, parent_resources=None):

src/f/l/flask-mongorest-HEAD/flask_mongorest/views.py   flask-mongorest(Download)
from werkzeug.exceptions import NotFound, Unauthorized
 
from flask.ext.mongorest.exceptions import ValidationError
from flask.ext.mongorest.utils import MongoEncoder
from flask.ext.mongorest import methods

src/f/l/Flask-MongoRest-0.1.1/flask_mongorest/views.py   Flask-MongoRest(Download)
from flask.ext.mongorest.resources import Resource
from flask.ext.mongorest.utils import MongoEncoder
from flask.ext.mongorest.exceptions import ValidationError