equal
deleted
inserted
replaced
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 from logilab.mtconverter import xml_escape |
10 from logilab.mtconverter import xml_escape |
11 |
11 |
12 import locale |
12 import locale |
|
13 import sys |
|
14 import decimal |
|
15 import datetime as pydatetime |
13 from md5 import md5 |
16 from md5 import md5 |
14 import sys |
|
15 import datetime as pydatetime |
|
16 from datetime import datetime, timedelta, date |
17 from datetime import datetime, timedelta, date |
17 from time import time, mktime |
18 from time import time, mktime |
18 from random import randint, seed |
19 from random import randint, seed |
19 from calendar import monthrange |
20 from calendar import monthrange |
20 import decimal |
21 import decimal |
|
22 |
|
23 import simplejson |
21 |
24 |
22 # initialize random seed from current time |
25 # initialize random seed from current time |
23 seed() |
26 seed() |
24 try: |
27 try: |
25 strptime = datetime.strptime |
28 strptime = datetime.strptime |
114 msg = str(key) + "%.10f" % time() + str(randint(0, 1000000)) |
117 msg = str(key) + "%.10f" % time() + str(randint(0, 1000000)) |
115 return md5(msg).hexdigest() |
118 return md5(msg).hexdigest() |
116 else: |
119 else: |
117 from uuid import uuid4 |
120 from uuid import uuid4 |
118 def make_uid(key): |
121 def make_uid(key): |
119 return str(key) + str(uuid4()) |
122 # remove dash, generated uid are used as identifier sometimes (sql table |
|
123 # names at least) |
|
124 return str(key) + str(uuid4()).replace('-', '') |
|
125 |
120 |
126 |
121 def dump_class(cls, clsname): |
127 def dump_class(cls, clsname): |
122 """create copy of a class by creating an empty class inheriting |
128 """create copy of a class by creating an empty class inheriting |
123 from the given cls. |
129 from the given cls. |
124 |
130 |