def get(self, startKey=None): ''' Return activities by pack of LIMIT at JSON format. If a start key is given in URL (it means a date like 2010-10-05-12-30-48), activities until this date are returned. Else latest activities are returned. Arguments: *startKey* The date until where activities should be returned. ''' if startKey: dateString = date_util.get_db_utc_date_from_url_date(startKey) docs = ActivityManager.get_all(startKey=dateString, tag="all") else: docs = ActivityManager.get_all() for doc in docs: try: subdoc = Activity.get_db().get(doc.docId) doc.subdoc = subdoc except: pass self.return_documents(docs)
def get(self, startKey=None): ''' Returns last posted pictures. If *startKey* is provided, it returns last picture posted until *startKey*. ''' get_doc = PictureManager.get_last_pictures if startKey: dateString = date_util.get_db_utc_date_from_url_date(startKey) docs = get_doc(dateString) else: docs = get_doc() self.render("templates/picture_rows.html", pictures=docs)
def get(self, startKey=None): ''' Returns last posted commons. If *startKey* is provided, it returns last common posted until *startKey*. ''' get_doc = CommonManager.get_last_commons if startKey: dateString = date_util.get_db_utc_date_from_url_date(startKey) docs = get_doc(dateString) else: docs = get_doc() self.render("templates/common_rows.html", commons=docs)
def return_documents_since(self, get_doc, startKey): ''' Use the get doc function that takes a date converted from startKey (startKey must be an url date or null) as parameter to send desired documents to client. Return documents by pack at JSON format. If a start key is given in URL (it means a date like 2010-10-05-12-30-48), documents until this date are returned. Else latest documents are returned. ''' if startKey: dateString = date_util.get_db_utc_date_from_url_date(startKey) docs = get_doc(dateString) else: docs = get_doc() self.return_documents(docs)
def return_documents_since(self, get_doc, startKey, tag=None): ''' Use the get doc function that takes a date converted from startKey (startKey must be an url date or null) as parameter to send desired documents to client. Return documents by pack at JSON format. If a start key is given in URL (it means a date like 2010-10-05-12-30-48), documents until this date are returned. Else latest documents are returned. ''' if startKey: dateString = date_util.get_db_utc_date_from_url_date(startKey) docs = get_doc(startKey=dateString, tag=tag) else: docs = get_doc() self.return_documents(docs)
def when_i_convert_url_date_2011_02_01_13_45_32_to_utc_date(step, urlDate): world.date = date_util.get_db_utc_date_from_url_date(urlDate) world.date = date_util.get_date_from_db_date(world.date)