def __init__(self, db, db_result=None, **query): #soldakiler bu sınıfa ait özellikler, sağdakiler veritabanındaki karşılıkları olacak attr_db = { "id": "_id", "type": "type", "name": "name", "summary": "summary", "count": "count" } #veritabanından bilgi çeker, eğer bu sınıf kendini çağırırsa 2. kez database sorgulamasını engelledik if db_result is None: db_result = db.find("ornekler_tablosu", convert_params(attr_db, query)) #eğer databaseden birden fazla sonuç dönderse items adı altında bu sınıf kendi kendini listeye ekliyecektir if type(db_result) is list: self.items = [] for i in db_result: self.items.append(Ornek(db, db_result=i, id=i["_id"])) return #üstteki dict in veritabanına karşılık gelen kısımlar bu sınıfa eklenirken olmayanlar yada null olanlar es geçilecek add_attr_db(self, db_result, attr_db) #veritabanındaki id dizisinden kendine alt nesneler ekler self.child_items = [] for id in db_result.get('_ids_ornek_child') or (): if id is not None: self.child_items.append(OrnekChild(db, id=id))
def __init__(self, db, db_result=None, **query): attr_db = {"id": "_id", "name": "name", "url": "url"} if db_result is None: db_result = db.find("photo_sources", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = {"id": "_id", "url": "url"} if db_result is None: db_result = db.find("page_links", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "name": "name", "description": "description", "type": "type", "editable": "editable", "public": "public", "collaborative": "collaborative", "url": "url", "created_at": "created-at", "updated_at": "updated_at", "log_view": "log-view", "follower_count": "follower-count", "listitems_count": "listitems-count" } if db_result is None: db_result = db.find("listed_groups_items", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_user') is not None: self.user = User(db, _id=db_result["_id_user"]) if db_result.get('_id_photos_groups_item') is not None: self.photo_item = PhotoItem(db, _id=db_result["_id_photos_groups_item"]) if db_result.get('_id_listed_groups_items_listitems') is not None: self.item = ListedItemListitem(db, _id=db_result["_id_listed_groups_items_listitems"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "type": "type", "name": "name", "count": "count" } if db_result is None: db_result = db.find("photos", convert_params(attr_db, query)) if type(db_result) is list: self.items = [] for i in db_result: self.items.append(Photos(db, db_result=i, id=i["_id"])) return add_attr_db(self, db_result, attr_db) self.photos = [] for id in db_result.get('_ids_photos_groups') or (): if id is not None: self.photos.append(PhotoItem(db, id=id))
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "days": "days", "rendered_time": "rendered-time" } if db_result is None: db_result = db.find("hours_timeframes", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "count": "count", "summary": "summary", "type": "type" } if db_result is None: db_result = db.find("likes", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "text": "text", "indices_start": "indices_start" } if db_result is None: db_result = db.find("phrases_samples", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "unconfirmed_count": "unconfirmed_Count", "marked": "marked", "last_checkin_expired_at": "lastCheckinExpiredAt" } if db_result is None: db_result = db.find("been_here", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = {"id": "_id", "phrase": "phrase", "count": "count"} if db_result is None: db_result = db.find("phrases", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_phrases_samples') is not None: self.phrase_sample = PhrasesSample( db, id=db_result["_id_phrases_samples"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "display_name": "display-name", "display_value": "display-value", "pier_tier": "pier-tier" } if db_result is None: db_result = db.find("attributes_items", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "type": "type", "label": "label", "anchor": "anchor", "url": "url", "mobilUrl": "mobilUrl" } if db_result is None: db_result = db.find("menu", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "best_name": "best-name", "best_name_lang": "best-name-lang", "logo_prefix": "logo-prefix", "logo_suffix": "logo-suffix" } if db_result is None: db_result = db.find("venue_chains", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "phone": "phone", "twitter": "twitter", "facebook": "facebook", "facebook_username": "******", "facebook_name": "facebook_name", "instagram": "instagram" } if db_result is None: db_result = db.find("contact", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "city": "city", "state": "state", "postalCode": "postalCode" } if db_result is None: db_result = db.find("cities", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_country') is not None: self.country = Country(db, id=db_result["_id_country"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "address": "address", "crossStreet": "crossStreet", "lat": "lat", "lgn": "lgn" } if db_result is None: db_result = db.find("location", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get("_id_city") is not None: self.city = City(db, _id=db_result["_id_city"])
def __init__(self, db, db_result=None, **query): attr_db = {"id": "_id", "created_at": "created-at"} if db_result is None: db_result = db.find("listed_groups_items_listitems", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_tips_groups_items') is not None: self.tips_item = TipsItem(db, id=db_result["_id_tips_groups_items"]) if db_result.get('_id_photos_groups_items') is not None: self.photo_item = PhotoItem( db, id=db_result["_id_photos_groups_items"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "name": "name", "plural_name": "pluralName", "short_name": "shortName", "icon_prefix": "icon_prefix", "icon_suffix": "icon_suffix", "primary": "primary" } if db_result is None: db_result = db.find("categories", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): print(query) attr_db = { "id": "_id", "firstName": "firstName", "gender": "gender", "prefix": "prefix", "suffix": "suffix", "type": "type" } print(convert_params(attr_db, query)) if db_result is None: db_result = db.find("users", convert_params(attr_db, query)) if type(db_result) is list: self.items = [] for i in db_result: self.items.append(User(db, db_result=i, id=i["_id"])) return add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "description": "description", "banner": "banner" } if db_result is None: db_result = db.find("page", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) self.page_links = [] for id in db_result.get('_ids_page_links') or (): if id is not None: self.page_links.append(PageLink(db, id=id))
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "status": "status", "rich_status_text": "rich-status-text", "is_open": "is-open", "is_local_holiday": "is-local-holiday" } if db_result is None: db_result = db.find("hours", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) self.frames = [] for id in db_result.get('_ids_hours_timeframes') or (): if id is not None: self.frames.append(HoursTimeFrame(db, id=id))
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "summary": "summary", "type": "type", "reason_name": "reason-name" } if db_result is None: db_result = db.find("reasons_items", convert_params(attr_db, query)) if type(db_result) is list: self.items = [] for i in db_result: self.items.append(ReasonsItem(db, db_result=i, id=i["_id"])) return add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "tip_count": "tipCount", "users_count": "usersCount", "checkins_count": "checkinsCount", "visits_count": "visitsCount" } if db_result is None: db_result = db.find("stats", convert_params(attr_db, query)) if type(db_result) is list: self.items = [] for i in db_result: self.items.append(Stats(db, db_result=i, id=i["_id"])) return add_attr_db(self, db_result, attr_db)
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "highlight_value": "higlight_value", "highligth_text_value": "highligth_text_value" } if db_result is None: db_result = db.find("colors", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_highlight_photo') is not None: self._id_highlight_photo = PhotoItem( db, id=db_result["_id_highlight_photo"]) if db_result.get('_id_higlight_text_photo') is not None: self._id_highlight_photo = PhotoItem( db, id=db_result["_id_higlight_text_photo"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "created_at": "created-at", "text": "text", "type": "type", "like": "like", "log_view": "logView", "agree_count": "agree-count", "disagree_count": "disagree-count", "todo_count": "todo-count" } if db_result is None: db_result = db.find("tips_groups_items", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db) if db_result.get('_id_likes') is not None: self.likes = Likes(db, id=db_result["_id_likes"]) if db_result.get('_id_user') is not None: self.user = User(db, id=db_result["_id_user"])
def __init__(self, db, db_result=None, **query): attr_db = { "id": "_id", "name": "name", "has_menu": "hasMenu", "venuescol": "venuescol", "like": "like", "dislike": "dislike", "ok": "ok", "rating": "rating", "rating_color": "ratingColor", "rating_signals": "ratingSignals", "allow_menu_url_edit": "allowMenuUrlEdit", "created_at": "created-at" } if db_result is None: db_result = db.find("venues", convert_params(attr_db, query)) if type(db_result) is list: self.items = [] for i in db_result: self.items.append(Venue(db, db_result=i, id=i["_id"])) return add_attr_db(self, db_result, attr_db) self.categories = [] for id in db_result.get('_ids_categories') or (): if id is not None: self.categories.append(Category(db, id=id)) if db_result.get('_id_location') is not None: self.location = Location(db, id=db_result["_id_location"]) if db_result.get('_id_contact') is not None: self.contact = Contact(db, id=db_result["_id_contact"]) if db_result.get('_id_stats') is not None: self.stats = Stats(db, id=db_result["_id_stats"]) if db_result.get('_id_price') is not None: self.prices = Prices(db, id=db_result["_id_price"]) if db_result.get('_id_likes') is not None: self.likes = Likes(db, id=db_result["_id_likes"]) if db_result.get('_id_menu') is not None: self.menu = Menu(db, id=db_result["_id_menu"]) if db_result.get('_id_been_here') is not None: self.been_here = BeenHere(db, id=db_result["_id_been_here"]) if db_result.get('_id_photos') is not None: self.photos = Photos(db, id=db_result["_id_photos"]) if db_result.get('_id_page') is not None: self.page = Page(db, id=db_result["_id_page"]) if db_result.get('_id_here-now') is not None: self.here_now = HereNow(db, id=db_result["_id_here-now"]) self.reasons = [] for id in db_result.get('_ids_reason_items') or (): if id is not None: self.reasons.append(ReasonsItem(db, id=id)) self.tips = [] for id in db_result.get('_ids_tips_groups') or (): if id is not None: self.tips.append(TipsGroup(db, id=id)) self.listed = [] for id in db_result.get('_ids_listed_groups') or (): if id is not None: self.listed.append(ListedGroup(db, id=id)) self.phrases = [] for id in db_result.get('_ids_phrases') or (): if id is not None: self.phrases.append(Phrases(db, id=id)) self.hours = [] for id in db_result.get('_ids_hours') or (): if id is not None: self.hours.append(Hours(db, id=id)) self.tips = [] for id in db_result.get('_ids_tips_groups') or (): if id is not None: self.tips.append(TipsGroup(db, id=id)) self.chains = [] for id in db_result.get('_ids_venue_chains') or (): if id is not None: self.chains.append(Chain(db, id=id)) self.attributes = [] for id in db_result.get('_ids_attributes') or (): if id is not None: self.attributes.append(Attribute(db, id=id)) if db_result.get('_id_best_photo') is not None: self.best_photo = PhotoItem(db, id=db_result["_id_best_photo"]) if db_result.get('_id_colors') is not None: self.color = Color(db, id=db_result["_id_colors"])
def __init__(self, db, db_result=None, **query): attr_db = {"id": "_id", "country": "country", "cc": "cc"} if db_result is None: db_result = db.find("countries", convert_params(attr_db, query)) add_attr_db(self, db_result, attr_db)