コード例 #1
0
ファイル: steps.py プロジェクト: DopeChicCity/newebe
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
コード例 #2
0
ファイル: steps.py プロジェクト: HeartbliT/IReVeAI
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
コード例 #3
0
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
コード例 #4
0
ファイル: steps.py プロジェクト: mike-perdide/newebe
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
コード例 #5
0
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)
コード例 #6
0
ファイル: handlers.py プロジェクト: DopeChicCity/newebe
 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)
コード例 #7
0
ファイル: handlers.py プロジェクト: mpmedia/newebe
 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)
コード例 #8
0
ファイル: handlers.py プロジェクト: HeartbliT/IReVeAI
 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)
コード例 #9
0
ファイル: handlers.py プロジェクト: HeartbliT/IReVeAI
 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)
コード例 #10
0
ファイル: steps.py プロジェクト: mpmedia/newebe
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)
コード例 #11
0
ファイル: models.py プロジェクト: WentaoXu/newebe
    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
コード例 #12
0
ファイル: models.py プロジェクト: mike-perdide/newebe
    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
コード例 #13
0
    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
コード例 #14
0
ファイル: models.py プロジェクト: HeartbliT/IReVeAI
    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
コード例 #15
0
    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
コード例 #16
0
ファイル: models.py プロジェクト: DopeChicCity/newebe
    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
コード例 #17
0
ファイル: steps.py プロジェクト: DopeChicCity/newebe
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)
コード例 #18
0
ファイル: steps.py プロジェクト: HeartbliT/IReVeAI
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)