18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
19 """This modules defines func / methods for creating test repositories""" |
19 """This modules defines func / methods for creating test repositories""" |
20 |
20 |
21 __docformat__ = "restructuredtext en" |
21 __docformat__ = "restructuredtext en" |
22 |
22 |
|
23 import logging |
23 from random import randint, choice |
24 from random import randint, choice |
24 from copy import deepcopy |
25 from copy import deepcopy |
25 from datetime import datetime, date, time, timedelta |
26 from datetime import datetime, date, time, timedelta |
26 from decimal import Decimal |
27 from decimal import Decimal |
27 |
28 |
28 from logilab.common import attrdict |
29 from logilab.common import attrdict |
|
30 from logilab.mtconverter import xml_escape |
29 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint, |
31 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint, |
30 IntervalBoundConstraint, BoundaryConstraint, |
32 IntervalBoundConstraint, BoundaryConstraint, |
31 Attribute, actual_value) |
33 Attribute, actual_value) |
32 from rql.utils import decompose_b26 as base_decompose_b26 |
34 from rql.utils import decompose_b26 as base_decompose_b26 |
33 |
35 |
235 def generate_Any_content_format(self, entity, index, **kwargs): |
237 def generate_Any_content_format(self, entity, index, **kwargs): |
236 # content_format attribute of EmailPart has no vocabulary constraint, we |
238 # content_format attribute of EmailPart has no vocabulary constraint, we |
237 # need this method else stupid values will be set which make mtconverter |
239 # need this method else stupid values will be set which make mtconverter |
238 # raise exception |
240 # raise exception |
239 return u'text/plain' |
241 return u'text/plain' |
|
242 |
|
243 def generate_CWDataImport_log(self, entity, index, **kwargs): |
|
244 # content_format attribute of EmailPart has no vocabulary constraint, we |
|
245 # need this method else stupid values will be set which make mtconverter |
|
246 # raise exception |
|
247 logs = [u'%s\t%s\t%s\t%s<br/>' % (logging.ERROR, 'http://url.com?arg1=hop&arg2=hip', |
|
248 1, xml_escape('hjoio&oio"'))] |
|
249 return u'<br/>'.join(logs) |
240 |
250 |
241 |
251 |
242 class autoextend(type): |
252 class autoextend(type): |
243 def __new__(mcs, name, bases, classdict): |
253 def __new__(mcs, name, bases, classdict): |
244 for attrname, attrvalue in classdict.items(): |
254 for attrname, attrvalue in classdict.items(): |