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))
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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'
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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'
Exemplo n.º 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'
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 17
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
Exemplo n.º 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
Exemplo n.º 19
0
def due(obj):
    date = getattr(obj, "due", None)
    date = datify(date)
    return date is None and datetime.max or date
Exemplo n.º 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
Exemplo n.º 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()
Exemplo n.º 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
Exemplo n.º 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()
Exemplo n.º 24
0
def due(obj):
    date = getattr(obj, 'due', None)
    date = datify(date)
    return date is None and datetime.max or date
Exemplo n.º 25
0
 def setEffectiveDate(self, effective_date):
     # Set Dublin Core Date element - date resource becomes effective.
     self.effective_date = datify(effective_date)
Exemplo n.º 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
Exemplo n.º 27
0
 def setEffectiveDate(self, effective_date):
     # Set Dublin Core Date element - date resource becomes effective.
     self.effective_date = datify(effective_date)
Exemplo n.º 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
Exemplo n.º 29
0
 def setExpirationDate(self, expiration_date):
     # Set Dublin Core Date element - date resource expires.
     self.expiration_date = datify(expiration_date)
Exemplo n.º 30
0
 def setExpirationDate(self, expiration_date):
     # Set Dublin Core Date element - date resource expires.
     self.expiration_date = datify(expiration_date)