def uservenue_factory(userinfo_param, j_venue_param, checkin_guid_list_param, checkin_list_param, is_unique_param): new_uservenue = UserVenue(parent=userinfo_param, location = db.GeoPt(j_venue_param['location']['lat'], j_venue_param['location']['lng'])) j_venue_param_loc = j_venue_param['location'] new_uservenue.update_location() new_uservenue.user = userinfo_param.user new_uservenue.venue_guid = str(j_venue_param['id']) if 'name' in j_venue_param: new_uservenue.name = j_venue_param['name'] if 'address' in j_venue_param_loc: new_uservenue.address = j_venue_param_loc['address'].replace('\n', ' ').replace('\r', ' ') if 'cross_street' in j_venue_param_loc: new_uservenue.cross_street = j_venue_param_loc['cross_street'] if 'state' in j_venue_param_loc: new_uservenue.state = j_venue_param_loc['state'] if 'zip' in j_venue_param_loc: new_uservenue.zipcode = j_venue_param_loc['zip'] if 'phone' in j_venue_param: new_uservenue.phone = j_venue_param['phone'] new_uservenue.has_parent = True new_uservenue.is_unique = is_unique_param new_uservenue.checkin_list = checkin_list_param new_uservenue.checkin_guid_list = checkin_guid_list_param if not new_uservenue.checkin_guid_list or len(new_uservenue.checkin_guid_list) is 0: new_uservenue.checkin_guid_list = [str(checkin_id) for checkin_id in new_uservenue.checkin_list] return new_uservenue