Exemple #1
0
 def uid(self, host_name='example.com', unique=''):
     """
     Generates a unique id consisting of:
     datetime-uniquevalue@host. Like:
     [email protected]
     """
     from prop import vText, vDatetime
     unique = unique or self.rnd_string()
     return vText('%s-%s@%s' % (vDatetime.today().ical(), unique, host_name))
Exemple #2
0
 def uid(self, host_name='example.com', unique=''):
     """
     Generates a unique id consisting of:
     datetime-uniquevalue@host. Like:
     [email protected]
     """
     from prop import vText, vDatetime
     unique = unique or self.rnd_string()
     return vText('%s-%s@%s' %
                  (vDatetime.today().ical(), unique, host_name))
Exemple #3
0
 def property_items(self):
     """
     Returns properties in this component and subcomponents as:
     [(name, value), ...]
     """
     vText = types_factory['text']
     properties = [('BEGIN', vText(self.name).ical())]
     property_names = self.keys()
     property_names.sort()
     for name in property_names:
         values = self[name]
         if type(values) == ListType:
             # normally one property is one line
             for value in values:
                 properties.append((name, value))
         else:
             properties.append((name, values))
     # recursion is fun!
     for subcomponent in self.subcomponents:
         properties += subcomponent.property_items()
     properties.append(('END', vText(self.name).ical()))
     return properties