def ensure_that_common_date_is_ok_with_time_zone(step): world.date_common = world.commons[0] common_db = CommonManager.get_common(world.date_common["_id"]) date = date_util.convert_utc_date_to_timezone(common_db.date) date = date_util.get_db_date_from_date(date) assert world.date_common["date"] == date
def ensure_that_picture_date_is_ok_with_time_zone(step): world.date_picture = world.pictures[0] picture_db = PictureManager.get_picture(world.date_picture["_id"]) date = date_util.convert_utc_date_to_timezone(picture_db.date) date = date_util.get_db_date_from_date(date) assert world.date_picture["date"] == date
def check_that_request_date_is_set_to_europe_paris_timezone(step, timezone): Contact._db = db2 contact = ContactManager.getRequestedContacts().first() Contact._db = db date = date_util.get_date_from_db_date(world.contacts[0]["requestDate"]) tz = pytz.timezone(timezone) date = date.replace(tzinfo=tz) assert_equals( date_util.convert_utc_date_to_timezone(contact.requestDate, tz), date)
def on_common_found(self, common, id): ''' Returns for given id the HTML representation of corresponding common. ''' common.date = date_util.convert_utc_date_to_timezone(common.date) if common.isFile: self.render("templates/common.html", common=common) else: self.render("templates/common_empty.html", common=common)
def on_picture_found(self, picture, id): ''' Returns for given id the HTML representation of corresponding picture. ''' picture.date = date_util.convert_utc_date_to_timezone(picture.date) if picture.isFile: self.render("templates/picture.html", picture=picture) else: self.render("templates/picture_empty.html", picture=picture)
def toDict(self, localized=True): """ Return a dict representation of the document (copy). Removes _rev key and convert date field and request date field to local timezone if *localized* is set to True. """ docDict = NewebeDocument.toDict(self, localized) if localized and docDict.get("requestDate", ""): utc_date = date_util.get_date_from_db_date(docDict.get("requestDate")) date = date_util.convert_utc_date_to_timezone(utc_date) docDict["requestDate"] = date_util.get_db_date_from_date(date) return docDict
def toDict(self, localized=True): ''' Return a dict representation of the document (copy). Removes _rev key and convert date field and last modified field to local timezone if *localized* is set to True. ''' docDict = NewebeDocument.toDict(self, localized) if localized and "lastModified" in docDict: utc_date = get_date_from_db_date(docDict.get("lastModified")) date = convert_utc_date_to_timezone(utc_date) docDict["lastModified"] = get_db_date_from_date(date) return docDict
def toDict(self, localized=True): ''' Return a dict representation of the document (copy). Removes _rev key and convert date field and request date field to local timezone if *localized* is set to True. ''' docDict = NewebeDocument.toDict(self, localized) if localized and docDict.get("requestDate", ""): utc_date = date_util.get_date_from_db_date( docDict.get("requestDate")) date = date_util.convert_utc_date_to_timezone(utc_date) docDict["requestDate"] = date_util.get_db_date_from_date(date) return docDict
def toDict(self, localized=True): ''' Return a dict representation of the document (copy). Removes _rev key and convert date field to local timezone if *localized* is set to True. ''' docDict = self.__dict__["_doc"].copy() if "_rev" in docDict: del docDict["_rev"] if localized and docDict.get("date", None): utc_date = get_date_from_db_date(docDict.get("date")) date = convert_utc_date_to_timezone(utc_date) docDict["date"] = get_db_date_from_date(date) return docDict
def when_i_convert_2011_02_01_12_45_32_to_timezone_date(step, db_date): date = date_util.get_date_from_db_date(db_date) world.date = date_util.convert_utc_date_to_timezone(date)