11 # *ctl module should limit the number of import to be imported as quickly as |
11 # *ctl module should limit the number of import to be imported as quickly as |
12 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash |
12 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash |
13 # completion). So import locally in command helpers. |
13 # completion). So import locally in command helpers. |
14 import sys |
14 import sys |
15 from datetime import datetime |
15 from datetime import datetime |
16 from os import mkdir, chdir, getcwd |
16 from os import mkdir, chdir |
17 from os.path import join, exists, abspath, basename, normpath, split, isdir |
17 from os.path import join, exists, abspath, basename, normpath, split, isdir |
18 from warnings import warn |
18 from warnings import warn |
19 |
19 |
20 from logilab.common import STD_BLACKLIST |
20 from logilab.common import STD_BLACKLIST |
21 from logilab.common.clcommands import register_commands, pop_arg |
21 from logilab.common.clcommands import register_commands, pop_arg |
228 yield objid |
228 yield objid |
229 done.add(objid) |
229 done.add(objid) |
230 break |
230 break |
231 |
231 |
232 |
232 |
233 def defined_in_library(etype, rtype, tetype, role): |
|
234 """return true if the given relation definition exists in cubicweb's library |
|
235 """ |
|
236 if libschema is None: |
|
237 return False |
|
238 if role == 'subject': |
|
239 subjtype, objtype = etype, tetype |
|
240 else: |
|
241 subjtype, objtype = tetype, etype |
|
242 try: |
|
243 return libschema.rschema(rtype).has_rdef(subjtype, objtype) |
|
244 except KeyError: |
|
245 return False |
|
246 |
|
247 |
|
248 LANGS = ('en', 'fr', 'es') |
233 LANGS = ('en', 'fr', 'es') |
249 I18NDIR = join(BASEDIR, 'i18n') |
234 I18NDIR = join(BASEDIR, 'i18n') |
250 DEFAULT_POT_HEAD = r'''msgid "" |
235 DEFAULT_POT_HEAD = r'''msgid "" |
251 msgstr "" |
236 msgstr "" |
252 "Project-Id-Version: cubicweb %s\n" |
237 "Project-Id-Version: cubicweb %s\n" |