def render(self, obj):
     value = self.get_value(obj)
     if value in (NO_VALUE, None):
         return u""
     datetime = datify(value)
     tlc = obj.unrestrictedTraverse('@@plone').toLocalizedTime
     return translate(tlc(datetime))
Example #2
0
 def EffectiveDate(self, zone=None):
     # Dublin Core Date element - date resource becomes effective.
     if zone is None:
         zone = _zone
     ed = getattr(self, 'effective_date', None)
     ed = datify(ed)
     return ed and ed.toZone(zone).ISO() or 'None'
Example #3
0
 def ExpirationDate(self, zone=None):
     # Dublin Core Date element - date resource expires.
     if zone is None:
         zone = _zone
     ed = getattr(self, 'expiration_date', None)
     ed = datify(ed)
     return ed and ed.toZone(zone).ISO() or 'None'
Example #4
0
 def EffectiveDate(self, zone=None):
     # Dublin Core Date element - date resource becomes effective.
     if zone is None:
         zone = _zone
     ed = getattr(self, 'effective_date', None)
     ed = datify(ed)
     return ed and ed.toZone(zone).ISO() or 'None'
Example #5
0
 def setModificationDate(self, modification_date=None):
     # Set the date when the resource was last modified.
     # When called without an argument, sets the date to now.
     if modification_date is None:
         self.modification_date = DateTime()
     else:
         self.modification_date = datify(modification_date)
Example #6
0
 def setModificationDate(self, modification_date=None):
     # Set the date when the resource was last modified.
     # When called without an argument, sets the date to now.
     if modification_date is None:
         self.modification_date = DateTime()
     else:
         self.modification_date = datify(modification_date)
Example #7
0
 def ExpirationDate(self, zone=None):
     # Dublin Core Date element - date resource expires.
     if zone is None:
         zone = _zone
     ed = getattr(self, 'expiration_date', None)
     ed = datify(ed)
     return ed and ed.toZone(zone).ISO() or 'None'
Example #8
0
 def effective(self):
     # Dublin Core Date element - date resource becomes effective.
     date = getattr(self, 'effective_date', _marker)
     if date is _marker:
         date = getattr(self, 'creation_date', None)
     date = datify(date)
     return date is None and FLOOR_DATE or date
Example #9
0
 def effective(self):
     # Dublin Core Date element - date resource becomes effective.
     date = getattr(self, 'effective_date', _marker)
     if date is _marker:
         date = getattr(self, 'creation_date', None)
     date = datify(date)
     return date is None and FLOOR_DATE or date
Example #10
0
def due_case(obj):
    """
    :return: value of field due for cases
    """
    date = getattr(obj, 'due', None)
    date = datify(date)
    return date is None and datetime.max or date
Example #11
0
 def modified(self):
     # Dublin Core Date element - date resource last modified.
     date = self.modification_date
     if date is None:
         # Upgrade.
         date = DateTime(self._p_mtime)
         self.modification_date = date
     date = datify(date)
     return date
Example #12
0
 def modified(self):
     # Dublin Core Date element - date resource last modified.
     date = self.modification_date
     if date is None:
         # Upgrade.
         date = DateTime(self._p_mtime)
         self.modification_date = date
     date = datify(date)
     return date
Example #13
0
 def CreationDate(self, zone=None):
     # Dublin Core Date element - date resource created.
     if zone is None:
         zone = _zone
     # return unknown if never set properly
     if self.creation_date:
         date = datify(self.creation_date)
         return date.toZone(zone).ISO()
     else:
         return 'Unknown'
Example #14
0
 def CreationDate(self, zone=None):
     # Dublin Core Date element - date resource created.
     if zone is None:
         zone = _zone
     # return unknown if never set properly
     if self.creation_date:
         date = datify(self.creation_date)
         return date.toZone(zone).ISO()
     else:
         return 'Unknown'
Example #15
0
    def Date(self, zone=None):
        # Dublin Core Date element - default date.
        if zone is None:
            zone = _zone
        # Return effective_date if set, modification date otherwise
        date = getattr(self, 'effective_date', None)
        if date is None:
            date = self.modified()

        date = datify(date)
        return date.toZone(zone).ISO()
Example #16
0
    def Date(self, zone=None):
        # Dublin Core Date element - default date.
        if zone is None:
            zone = _zone
        # Return effective_date if set, modification date otherwise
        date = getattr(self, 'effective_date', None)
        if date is None:
            date = self.modified()

        date = datify(date)
        return date.toZone(zone).ISO()
 def modified(self):
     connection = self.getConnection()
     if not connection or not 'modification_date' in connection.fieldnames.keys():
         return super(SQLDexterityItem, self).modified()
     # Dublin Core Date element - date resource last modified.
     date = self.modification_date
     if date is None:
         # Upgrade.
         if self._p_mtime:
             date = self._p_mtime
         else:
             date = datetime.datetime.now()
         self.modification_date = date
     date = datify(date)
     return date
Example #18
0
 def modified(self):
     connection = self.getConnection()
     if not connection or not 'modification_date' in connection.fieldnames.keys(
     ):
         return super(SQLDexterityItem, self).modified()
     # Dublin Core Date element - date resource last modified.
     date = self.modification_date
     if date is None:
         # Upgrade.
         if self._p_mtime:
             date = self._p_mtime
         else:
             date = datetime.datetime.now()
         self.modification_date = date
     date = datify(date)
     return date
Example #19
0
def due(obj):
    date = getattr(obj, "due", None)
    date = datify(date)
    return date is None and datetime.max or date
Example #20
0
 def created(self):
     # Dublin Core Date element - date resource created.
     # allow for non-existent creation_date, existed always
     date = getattr(self, 'creation_date', None)
     date = datify(date)
     return date is None and FLOOR_DATE or date
Example #21
0
 def ModificationDate(self, zone=None):
     # Dublin Core Date element - date resource last modified.
     if zone is None:
         zone = _zone
     date = datify(self.modified())
     return date.toZone(zone).ISO()
Example #22
0
 def expires(self):
     # Dublin Core Date element - date resource expires.
     date = getattr(self, 'expiration_date', None)
     date = datify(date)
     return date is None and CEILING_DATE or date
Example #23
0
 def ModificationDate(self, zone=None):
     # Dublin Core Date element - date resource last modified.
     if zone is None:
         zone = _zone
     date = datify(self.modified())
     return date.toZone(zone).ISO()
Example #24
0
def due(obj):
    date = getattr(obj, 'due', None)
    date = datify(date)
    return date is None and datetime.max or date
Example #25
0
 def setEffectiveDate(self, effective_date):
     # Set Dublin Core Date element - date resource becomes effective.
     self.effective_date = datify(effective_date)
Example #26
0
 def expires(self):
     # Dublin Core Date element - date resource expires.
     date = getattr(self, 'expiration_date', None)
     date = datify(date)
     return date is None and CEILING_DATE or date
Example #27
0
 def setEffectiveDate(self, effective_date):
     # Set Dublin Core Date element - date resource becomes effective.
     self.effective_date = datify(effective_date)
Example #28
0
 def created(self):
     # Dublin Core Date element - date resource created.
     # allow for non-existent creation_date, existed always
     date = getattr(self, 'creation_date', None)
     date = datify(date)
     return date is None and FLOOR_DATE or date
Example #29
0
 def setExpirationDate(self, expiration_date):
     # Set Dublin Core Date element - date resource expires.
     self.expiration_date = datify(expiration_date)
Example #30
0
 def setExpirationDate(self, expiration_date):
     # Set Dublin Core Date element - date resource expires.
     self.expiration_date = datify(expiration_date)