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

All Samples(18)  |  Call(12)  |  Derive(0)  |  Import(6)

src/m/a/max-3.6/max/rest/conversations.py   max(Download)
from pymongo import ASCENDING
 
from max.exceptions import ValidationError, Unauthorized, Forbidden, ObjectNotFound
from max.MADMax import MADMaxDB, MADMaxCollection
from max.models import Message, Conversation, Activity
    ctxts = data.get('contexts', [])
    if len(ctxts) == 0:
        raise ValidationError('Empty contexts parameter')
 
    request_participants = ctxts[0].get('participants', [])
    if len(request_participants) == 0:
        raise ValidationError('Empty participants parameter')
    if len(request_participants) != len(list(set(request_participants))):
        raise ValidationError('One or more users duplicated in participants list')
        raise ValidationError('One or more users duplicated in participants list')
    if not request.actor.username in request_participants:
        raise ValidationError('Actor must be part of the participants list.')
 
    # Loop trough all participants, if there's one that doesn't exists, an exception will raise

src/m/a/max-3.6/max/rest/people.py   max(Download)
 
from max.exceptions import Unauthorized
from max.exceptions import ValidationError
from max.exceptions import ObjectNotFound
from max.oauth2 import oauth2
    if request.content_type != 'multipart/form-data' and \
       len(request.POST.keys()) != 1:
        raise ValidationError('Not supported upload method.')
 
    file_key = request.POST.keys()[0]
    supported_platforms = ['ios', 'android']
    if platform not in supported_platforms:
        raise ValidationError('Not supported platform.')
 
    if len(token) < 10:
        raise ValidationError('No valid device token.')
    supported_platforms = ['ios', 'android']
    if platform not in supported_platforms:
        raise ValidationError('Not supported platform.')
 
    actor = request.actor

src/m/a/max-3.6/max/MADObjects.py   max(Download)
# -*- coding: utf-8 -*-
from max.rest.utils import extractPostData, flatten, RUDict
from max.exceptions import MissingField, ObjectNotSupported, DuplicatedItemError, ValidationError
from bson import ObjectId
import datetime
                            success, message = validator(field_value)
                            if not success:
                                raise ValidationError('Validation error on field "%s": %s' % (fieldname, message))
 
                    # Apply formatters to validated fields

src/m/a/max-3.6/max/decorators.py   max(Download)
# -*- coding: utf-8 -*-
from max.exceptions import MissingField, ObjectNotSupported, ObjectNotFound, DuplicatedItemError, UnknownUserError, Unauthorized, InvalidSearchParams, InvalidPermission, ValidationError, Forbidden
from max.exceptions import JSONHTTPUnauthorized, JSONHTTPBadRequest, JSONHTTPNotFound, JSONHTTPForbidden, JSONHTTPInternalServerError
from bson.errors import InvalidId
from max.MADMax import MADMaxDB

src/m/a/max-3.6/max/rest/admin/security.py   max(Download)
# -*- coding: utf-8 -*-
from pyramid.view import view_config
 
from max import ALLOWED_ROLES
from max.exceptions import ObjectNotFound, ValidationError
 
    if role not in ALLOWED_ROLES:
        raise ValidationError('Role "{}" is not a valid role'.format(role))
 
    mmdb = MADMaxDB(context.db)
 
    if role not in ALLOWED_ROLES:
        raise ValidationError('Role "{}" is not a valid role'.format(role))
 
    mmdb = MADMaxDB(context.db)

src/m/a/max-3.6/max/rest/admin/contexts.py   max(Download)
from max.models import Context
from max.rest.utils import searchParams, extractPostData
from max.exceptions import InvalidPermission, Unauthorized, ObjectNotFound, ValidationError
from max.rest.ResourceHandlers import JSONResourceEntity, JSONResourceRoot
 
        valid_tags = False not in [isinstance(tag, (str, unicode)) for tag in tags]
    if not valid_tags:
        raise ValidationError("Sorry, We're expecting a list of strings...")
 
    contexts = MADMaxCollection(context.db.contexts, query_key='hash')