equal
deleted
inserted
replaced
39 |
39 |
40 import sys, os, logging |
40 import sys, os, logging |
41 from StringIO import StringIO |
41 from StringIO import StringIO |
42 |
42 |
43 from logilab.common.logging_ext import set_log_methods |
43 from logilab.common.logging_ext import set_log_methods |
|
44 from yams.constraints import BASE_CONVERTERS |
44 |
45 |
45 |
46 |
46 if os.environ.get('APYCOT_ROOT'): |
47 if os.environ.get('APYCOT_ROOT'): |
47 logging.basicConfig(level=logging.CRITICAL) |
48 logging.basicConfig(level=logging.CRITICAL) |
48 else: |
49 else: |
118 else: |
119 else: |
119 binary.write(fobj.read()) |
120 binary.write(fobj.read()) |
120 binary.seek(0) |
121 binary.seek(0) |
121 return binary |
122 return binary |
122 |
123 |
|
124 def str_or_binary(value): |
|
125 if isinstance(value, Binary): |
|
126 return value |
|
127 return str(value) |
|
128 BASE_CONVERTERS['Password'] = str_or_binary |
|
129 |
|
130 |
123 |
131 |
124 # use this dictionary to rename entity types while keeping bw compat |
132 # use this dictionary to rename entity types while keeping bw compat |
125 ETYPE_NAME_MAP = {} |
133 ETYPE_NAME_MAP = {} |
126 |
134 |
127 # XXX cubic web cube migration map. See if it's worth keeping this mecanism |
135 # XXX cubic web cube migration map. See if it's worth keeping this mecanism |