# Path: core/config.py

# 
# Path: core/validation/jsonschemafix.py



import cgi, yaml, random, string, hashlib, types, jsonschema
from core.config import schema, core_folder, requests_schema
from core.validation.jsonschemafix import validator
from bson.objectid import ObjectId
        
        t = container.__class__
        return t((x,recursive_replace(container[x], _replace_function_stringify_objectid_json)) for x in container)
    elif isinstance(container, basestring):
        return container

def stringify_objectid_cursor(cursor_in):
    """Convert ObjectId to string in JSON"""
    
    stringified = []
    for json_in in cursor_in:
        stringified.append(recursive_replace(json_in, _replace_function_stringify_objectid_json))
    return stringified

def _replace_function_stringify_objectid_list(container):
    """Callback for stringify_objectid_list"""
    if isinstance(container, ObjectId):
        return str(container)

def stringify_objectid_list(list_in):
    """Convert an ObjectId list to string list"""
    return recursive_replace(list_in, _replace_function_stringify_objectid_list)

def validate_json_list(collection, list_in):
    
    for json_in in list_in:    
        # Validate json schema
        validator(schema[collection], format_checker=jsonschema.FormatChecker()).validate(json_in)
   
def validate_request(collection, json_in):

# Path: core/config.py

# 
# Path: core/validation/jsonschemafix.py



# Path: core/validation/validation.py
import cgi, yaml, random, string, hashlib, types, jsonschema
from core.config import schema, core_folder, requests_schema
from core.validation.jsonschemafix import validator
from bson.objectid import ObjectId

        
        t = container.__class__
        return t((x,recursive_replace(container[x], _replace_function_stringify_objectid_json)) for x in container)
    elif isinstance(container, basestring):
        return container

def stringify_objectid_cursor(cursor_in):
    """Convert ObjectId to string in JSON"""
    
    stringified = []
    for json_in in cursor_in:
        stringified.append(recursive_replace(json_in, _replace_function_stringify_objectid_json))
    return stringified

def _replace_function_stringify_objectid_list(container):
    """Callback for stringify_objectid_list"""
    if isinstance(container, ObjectId):
        return str(container)

def stringify_objectid_list(list_in):
    """Convert an ObjectId list to string list"""
    return recursive_replace(list_in, _replace_function_stringify_objectid_list)

def validate_json_list(collection, list_in):
    
    for json_in in list_in:    
        # Validate json schema
        validator(schema[collection], format_checker=jsonschema.FormatChecker()).validate(json_in)
   
def validate_request(collection, json_in):

    validator(requests_schema[collection], format_checker=jsonschema.FormatChecker()).validate(json_in)