merge stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Jun 2009 16:59:26 +0200
branchstable
changeset 2160 17d624698661
parent 2159 0ca23d0eace2 (diff)
parent 2155 1dd3dfc6fd76 (current diff)
child 2161 200481e7b156
merge
--- a/cwctl.py	Tue Jun 23 20:04:15 2009 +0200
+++ b/cwctl.py	Wed Jun 24 16:59:26 2009 +0200
@@ -141,7 +141,7 @@
             if forkcmd:
                 status = system('%s %s' % (forkcmd, appid))
                 if status:
-                    sys.exit(status)
+                    print '%s exited with status %s' % (forkcmd, status)
             else:
                 self.run_arg(appid)
 
--- a/schema.py	Tue Jun 23 20:04:15 2009 +0200
+++ b/schema.py	Wed Jun 24 16:59:26 2009 +0200
@@ -32,8 +32,6 @@
 schema.use_py_datetime()
 nodes.use_py_datetime()
 
-_ = unicode
-
 BASEGROUPS = ('managers', 'users', 'guests', 'owners')
 
 _LOGGER = getLogger('cubicweb.schemaloader')
--- a/server/repository.py	Tue Jun 23 20:04:15 2009 +0200
+++ b/server/repository.py	Wed Jun 24 16:59:26 2009 +0200
@@ -209,11 +209,6 @@
             # initialized)
             for source in self.sources:
                 source.init()
-            # call application level initialisation hooks
-            self.hm.call_hooks('server_startup', repo=self)
-            # register a task to cleanup expired session
-            self.looping_task(self.config['session-time']/3.,
-                              self.clean_sessions)
         else:
             # call init_creating so for instance native source can configurate
             # tsearch according to postgres version
@@ -225,6 +220,12 @@
         for i in xrange(config['connections-pool-size']):
             self._available_pools.put_nowait(ConnectionsPool(self.sources))
         self._shutting_down = False
+        if not config.creating:
+            # call application level initialisation hooks
+            self.hm.call_hooks('server_startup', repo=self)
+            # register a task to cleanup expired session
+            self.looping_task(self.config['session-time']/3.,
+                              self.clean_sessions)
 
     # internals ###############################################################
 
--- a/skeleton/__pkginfo__.py.tmpl	Tue Jun 23 20:04:15 2009 +0200
+++ b/skeleton/__pkginfo__.py.tmpl	Wed Jun 24 16:59:26 2009 +0200
@@ -17,16 +17,16 @@
 short_desc = '%(shortdesc)s'
 long_desc = '''%(longdesc)s'''
 
-from os import listdir as _listdir
-from os.path import join, isdir
-
 web = 'http://www.cubicweb.org/project/%%s' %% distname
 
 pyversions = ['2.4']
 
-#from cubicweb.devtools.pkginfo import get_distutils_datafiles
-CUBES_DIR = join('share', 'cubicweb', 'cubes')
-THIS_CUBE_DIR = join(CUBES_DIR, '%(cubename)s')
+
+from os import listdir as _listdir
+from os.path import join, isdir, exists, dirname
+from glob import glob
+
+THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
 
 def listdir(dirpath):
     return [join(dirpath, fname) for fname in _listdir(dirpath)
@@ -34,12 +34,11 @@
             and not fname.endswith('~')
             and not isdir(join(dirpath, fname))]
 
-from glob import glob
 try:
     data_files = [
         # common files
         [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
-        ]    
+        ]
     # check for possible extended cube layout
     for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration'):
         if isdir(dirname):
@@ -47,8 +46,9 @@
     # Note: here, you'll need to add subdirectories if you want
     # them to be included in the debian package
 except OSError:
+    if exists(dirname(__file__)):
+        raise
     # we are in an installed directory
-    pass
 
 
 cube_eid = None # <=== FIXME if you need direct bug-subscription
--- a/web/box.py	Tue Jun 23 20:04:15 2009 +0200
+++ b/web/box.py	Wed Jun 24 16:59:26 2009 +0200
@@ -6,6 +6,7 @@
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
 __docformat__ = "restructuredtext en"
+_ = unicode
 
 from logilab.mtconverter import html_escape
 
@@ -20,8 +21,6 @@
                                       RawBoxItem, BoxSeparator)
 from cubicweb.web.action import UnregisteredAction
 
-_ = unicode
-
 
 class BoxTemplate(View):
     """base template for boxes, usually a (contextual) list of possible
--- a/web/views/startup.py	Tue Jun 23 20:04:15 2009 +0200
+++ b/web/views/startup.py	Wed Jun 24 16:59:26 2009 +0200
@@ -177,6 +177,7 @@
         self.w(u'<h1>%s</h1>' % _('Schema of the data model'))
         self.render_tabs(self.tabs, self.default_tab)
 
+
 class SchemaTabImageView(StartupView):
     id = 'schema-image'
 
@@ -189,6 +190,7 @@
             html_escape(self.req.build_url('view', vid='schemagraph', withmeta=0)),
             self.req._("graphical representation of the application'schema")))
 
+
 class SchemaTabTextView(StartupView):
     id = 'schema-text'
 
@@ -205,11 +207,12 @@
 
 
 class ManagerSchemaPermissionsView(StartupView, SecurityViewMixIn):
-    id = 'schema_security'
+    id = 'schema-security'
     __select__ = StartupView.__select__ & match_user_groups('managers')
 
     def call(self, display_relations=True,
              skiprels=('is', 'is_instance_of', 'identity', 'owned_by', 'created_by')):
+        self.req.add_css('cubicweb.acl.css')
         _ = self.req._
         formparams = {}
         formparams['sec'] = self.id
@@ -222,28 +225,31 @@
             entities = [eschema for eschema in entities
                         if not eschema.meta]
         # compute relations
-        relations = []
         if display_relations:
             relations = [rschema for rschema in schema.relations()
                          if not (rschema.is_final() or rschema.type in skiprels)]
             if not formparams['withmeta']:
                 relations = [rschema for rschema in relations
                              if not rschema.meta]
+        else:
+            relations = []
         # index
         self.w(u'<div id="schema_security"><a id="index" href="index"/>')
         self.w(u'<h2 class="schema">%s</h2>' % _('index').capitalize())
         self.w(u'<h4>%s</h4>' %   _('Entities').capitalize())
         ents = []
         for eschema in sorted(entities):
-            url = html_escape(self.build_url('schema', **formparams) + '#' + eschema.type)
-            ents.append(u'<a class="grey" href="%s">%s</a> (%s)' % (url,  eschema.type, _(eschema.type)))
-        self.w('%s' %  ', '.join(ents))
+            url = html_escape(self.build_url('schema', **formparams))
+            ents.append(u'<a class="grey" href="%s#%s">%s</a> (%s)' % (
+                url,  eschema.type, eschema.type, _(eschema.type)))
+        self.w(u', '.join(ents))
         self.w(u'<h4>%s</h4>' % (_('relations').capitalize()))
         rels = []
-        for eschema in sorted(relations):
-            url = html_escape(self.build_url('schema', **formparams) + '#' + eschema.type)
-            rels.append(u'<a class="grey" href="%s">%s</a> (%s), ' %  (url , eschema.type, _(eschema.type)))
-        self.w('%s' %  ', '.join(ents))
+        for rschema in sorted(relations):
+            url = html_escape(self.build_url('schema', **formparams))
+            rels.append(u'<a class="grey" href="%s#%s">%s</a> (%s), ' %  (
+                url , rschema.type, rschema.type, _(rschema.type)))
+        self.w(u', '.join(ents))
         # entities
         self.display_entities(entities, formparams)
         # relations