Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
icalendar.util.UIDGenerator Class Reference

List of all members.

Public Member Functions

def rnd_string
def uid

Static Public Attributes

tuple chars = list(ascii_letters + digits)

Detailed Description

If you are too lazy to create real uids.

NOTE: this doctest is disabled
(only two > instead of three)

Automatic semi-random uid
>> g = UIDGenerator()
>> uid = g.uid()
>> uid.ical()
'20050109T153222-7ekDDHKcw46QlwZK@example.com'

You should at least insert your own hostname to be more compliant
>> g = UIDGenerator()
>> uid = g.uid('Example.ORG')
>> uid.ical()
'20050109T153549-NbUItOPDjQj8Ux6q@Example.ORG'

You can also insert a path or similar
>> g = UIDGenerator()
>> uid = g.uid('Example.ORG', '/path/to/content')
>> uid.ical()
'20050109T153415-/path/to/content@Example.ORG'

Definition at line 9 of file util.py.


Member Function Documentation

def icalendar.util.UIDGenerator.rnd_string (   self,
  length = 16 
)

Definition at line 38 of file util.py.

00038 
00039     def rnd_string(self, length=16):
00040         "Generates a string with random characters of length"
00041         return ''.join([random.choice(self.chars) for i in range(length)])

Here is the caller graph for this function:

def icalendar.util.UIDGenerator.uid (   self,
  host_name = 'example.com',
  unique = '' 
)
Generates a unique id consisting of:
datetime-uniquevalue@host. Like:
20050105T225746Z-HKtJMqUgdO0jDUwm@example.com

Definition at line 42 of file util.py.

00042 
00043     def uid(self, host_name='example.com', unique=''):
00044         """
00045         Generates a unique id consisting of:
00046         datetime-uniquevalue@host. Like:
00047         20050105T225746Z-HKtJMqUgdO0jDUwm@example.com
00048         """
00049         from PropertyValues import vText, vDatetime
00050         unique = unique or self.rnd_string()
00051         return vText('%s-%s@%s' % (vDatetime.today().ical(), unique, host_name))

Here is the call graph for this function:


Member Data Documentation

tuple icalendar.util.UIDGenerator.chars = list(ascii_letters + digits) [static]

Definition at line 36 of file util.py.


The documentation for this class was generated from the following file: