1 """additional cubicweb-ctl commands and command handlers for cubicweb and cubicweb's |
1 """additional cubicweb-ctl commands and command handlers for cubicweb and cubicweb's |
2 cubes development |
2 cubes development |
3 |
3 |
4 :organization: Logilab |
4 :organization: Logilab |
5 :copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
7 """ |
7 """ |
8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 import sys |
10 import sys |
|
11 from datetime import datetime |
11 from os import walk, mkdir, chdir, listdir, getcwd |
12 from os import walk, mkdir, chdir, listdir, getcwd |
12 from os.path import join, exists, abspath, basename, normpath, split, isdir |
13 from os.path import join, exists, abspath, basename, normpath, split, isdir |
13 |
14 |
14 |
15 |
15 from logilab.common import STD_BLACKLIST |
16 from logilab.common import STD_BLACKLIST |
16 from logilab.common.modutils import get_module_files |
17 from logilab.common.modutils import get_module_files |
17 from logilab.common.textutils import get_csv |
18 from logilab.common.textutils import get_csv |
18 |
19 |
19 from cubicweb import CW_SOFTWARE_ROOT as BASEDIR |
20 from cubicweb import CW_SOFTWARE_ROOT as BASEDIR, BadCommandUsage |
20 from cubicweb.__pkginfo__ import version as cubicwebversion |
21 from cubicweb.__pkginfo__ import version as cubicwebversion |
21 from cubicweb import BadCommandUsage |
|
22 from cubicweb.toolsutils import Command, register_commands, confirm, copy_skeleton |
22 from cubicweb.toolsutils import Command, register_commands, confirm, copy_skeleton |
23 from cubicweb.web.webconfig import WebConfiguration |
23 from cubicweb.web.webconfig import WebConfiguration |
24 from cubicweb.server.serverconfig import ServerConfiguration |
24 from cubicweb.server.serverconfig import ServerConfiguration |
25 |
25 |
26 |
26 |
100 vreg.set_schema(schema) |
100 vreg.set_schema(schema) |
101 w(DEFAULT_POT_HEAD) |
101 w(DEFAULT_POT_HEAD) |
102 _generate_schema_pot(w, vreg, schema, libschema=libschema, cube=cube) |
102 _generate_schema_pot(w, vreg, schema, libschema=libschema, cube=cube) |
103 |
103 |
104 def _generate_schema_pot(w, vreg, schema, libschema=None, cube=None): |
104 def _generate_schema_pot(w, vreg, schema, libschema=None, cube=None): |
105 from mx.DateTime import now |
|
106 from cubicweb.common.i18n import add_msg |
105 from cubicweb.common.i18n import add_msg |
107 w('# schema pot file, generated on %s\n' % now().strftime('%Y-%m-%d %H:%M:%S')) |
106 w('# schema pot file, generated on %s\n' % datetime.now().strftime('%Y-%m-%d %H:%M:%S')) |
108 w('# \n') |
107 w('# \n') |
109 w('# singular and plural forms for each entity type\n') |
108 w('# singular and plural forms for each entity type\n') |
110 w('\n') |
109 w('\n') |
111 if libschema is not None: |
110 if libschema is not None: |
112 entities = [e for e in schema.entities() if not e in libschema] |
111 entities = [e for e in schema.entities() if not e in libschema] |
449 dependancies = '%r,' % includes[0] |
448 dependancies = '%r,' % includes[0] |
450 else: |
449 else: |
451 dependancies = ', '.join(repr(cube) for cube in includes) |
450 dependancies = ', '.join(repr(cube) for cube in includes) |
452 else: |
451 else: |
453 dependancies = '' |
452 dependancies = '' |
454 from mx.DateTime import now |
|
455 context = {'cubename' : cubename, |
453 context = {'cubename' : cubename, |
456 'distname' : distname, |
454 'distname' : distname, |
457 'shortdesc' : shortdesc, |
455 'shortdesc' : shortdesc, |
458 'longdesc' : longdesc or shortdesc, |
456 'longdesc' : longdesc or shortdesc, |
459 'dependancies' : dependancies, |
457 'dependancies' : dependancies, |
460 'version' : cubicwebversion, |
458 'version' : cubicwebversion, |
461 'year' : str(now().year), |
459 'year' : str(datetime.now().year), |
462 'author': self['author'], |
460 'author': self['author'], |
463 'author-email': self['author-email'], |
461 'author-email': self['author-email'], |
464 'author-web-site': self['author-web-site'], |
462 'author-web-site': self['author-web-site'], |
465 } |
463 } |
466 copy_skeleton(skeldir, cubedir, context) |
464 copy_skeleton(skeldir, cubedir, context) |