def resource_create_object(request, resource_cls, uri):
 (resource_name, matchdict) = view_lookup(request, uri)
 fakerequest = build_request(request, {'method': 'PUT', 'path': uri})
 fakerequest.matchdict = matchdict
 fakerequest.bound_data = request.bound_data
 fakerequest.authn_type = request.authn_type
 fakerequest.selected_userid = request.selected_userid
 fakerequest.errors = request.errors
 fakerequest.current_resource_name = resource_name
 obj_id = matchdict['id']
 context = RouteFactory(fakerequest)
 context.resource_name = resource_name
 resource = resource_cls(fakerequest, context)
 if (not resource.model.id_generator.match(obj_id)):
  error_details = {'location': 'path', 'description': ('Invalid %s id' % resource_name)}
  raise_invalid(resource.request, **error_details)
 data = {'id': obj_id}
 try:
  obj = resource.model.create_record(data)
  resource.postprocess(data, action=ACTIONS.CREATE)
 except storage_exceptions.UnicityError as e:
  obj = e.record
 return obj

def resource_create_object ( request , resource_cls , uri ) : ( resource_name , matchdict ) = view_lookup ( request , uri ) fakerequest = build_request ( request , { 'method' : 'PUT' , 'path' : uri } ) fakerequest . matchdict = matchdict fakerequest . bound_data = request . bound_data fakerequest . authn_type = request . authn_type fakerequest . selected_userid = request . selected_userid fakerequest . errors = request . errors fakerequest . current_resource_name = resource_name obj_id = matchdict [ 'id' ] context = RouteFactory ( fakerequest ) context . resource_name = resource_name resource = resource_cls ( fakerequest , context ) if ( not resource . model . id_generator . match ( obj_id ) ) : error_details = { 'location' : 'path' , 'description' : ( 'Invalid %s id' % resource_name ) } raise_invalid ( resource . request , ** error_details ) data = { 'id' : obj_id } try : obj = resource . model . create_record ( data ) resource . postprocess ( data , action = ACTIONS . CREATE ) except storage_exceptions . UnicityError as e : obj = e . record return obj
in the default bucket .