--- a/common/migration.py Thu Jul 23 15:07:12 2009 +0200
+++ b/common/migration.py Thu Jul 23 15:07:25 2009 +0200
@@ -11,7 +11,7 @@
import sys
import os
import logging
-from tempfile import mktemp
+import tempfile
from os.path import exists, join, basename, splitext
from logilab.common.decorators import cached
@@ -337,7 +337,7 @@
configfile = self.config.main_config_file()
if self._option_changes:
read_old_config(self.config, self._option_changes, configfile)
- newconfig = mktemp()
+ newconfig = mkstemp()
for optdescr in self._option_changes:
if optdescr[0] == 'added':
optdict = self.config.get_option_def(optdescr[1])
--- a/cwconfig.py Thu Jul 23 15:07:12 2009 +0200
+++ b/cwconfig.py Thu Jul 23 15:07:25 2009 +0200
@@ -581,24 +581,24 @@
@classmethod
def runtime_dir(cls):
"""run time directory for pid file..."""
- return env_path('CW_RUNTIME', cls.RUNTIME_DIR, 'run time')
+ return env_path('CW_RUNTIME_DIR', cls.RUNTIME_DIR, 'run time')
@classmethod
def registry_dir(cls):
"""return the control directory"""
- return env_path('CW_REGISTRY', cls.REGISTRY_DIR, 'registry')
+ return env_path('CW_INSTANCES_DIR', cls.REGISTRY_DIR, 'registry')
@classmethod
def instance_data_dir(cls):
"""return the instance data directory"""
- return env_path('CW_INSTANCE_DATA',
+ return env_path('CW_INSTANCES_DATA_DIR',
cls.INSTANCE_DATA_DIR or cls.REGISTRY_DIR,
'additional data')
@classmethod
def migration_scripts_dir(cls):
"""cubicweb migration scripts directory"""
- return env_path('CW_MIGRATION', cls.MIGRATION_DIR, 'migration')
+ return env_path('CW_MIGRATION_DIR', cls.MIGRATION_DIR, 'migration')
@classmethod
def config_for(cls, appid, config=None):
--- a/devtools/devctl.py Thu Jul 23 15:07:12 2009 +0200
+++ b/devtools/devctl.py Thu Jul 23 15:07:25 2009 +0200
@@ -254,13 +254,12 @@
if args:
raise BadCommandUsage('Too much arguments')
import shutil
- from tempfile import mktemp
+ import tempfile
import yams
from logilab.common.fileutils import ensure_fs_mode
from logilab.common.shellutils import globfind, find, rm
from cubicweb.common.i18n import extract_from_tal, execute
- tempdir = mktemp()
- mkdir(tempdir)
+ tempdir = tempdir.mkdtemp()
potfiles = [join(I18NDIR, 'entities.pot')]
print '******** extract schema messages'
schemapot = join(tempdir, 'schema.pot')
@@ -348,14 +347,13 @@
def update_cube_catalogs(cubedir):
import shutil
- from tempfile import mktemp
+ import tempfile
from logilab.common.fileutils import ensure_fs_mode
from logilab.common.shellutils import find, rm
from cubicweb.common.i18n import extract_from_tal, execute
toedit = []
cube = basename(normpath(cubedir))
- tempdir = mktemp()
- mkdir(tempdir)
+ tempdir = tempfile.mkdtemp()
print '*' * 72
print 'updating %s cube...' % cube
chdir(cubedir)
--- a/doc/book/en/admin/instance-config.rst Thu Jul 23 15:07:12 2009 +0200
+++ b/doc/book/en/admin/instance-config.rst Thu Jul 23 15:07:25 2009 +0200
@@ -6,7 +6,7 @@
While creating an instance, a configuration file is generated in::
- $ (CW_REGISTRY) / <instance> / <configuration name>.conf
+ $ (CW_INSTANCES_DIR) / <instance> / <configuration name>.conf
For example::
--- a/doc/book/en/admin/setup.rst Thu Jul 23 15:07:12 2009 +0200
+++ b/doc/book/en/admin/setup.rst Thu Jul 23 15:07:25 2009 +0200
@@ -116,9 +116,9 @@
following environment variables as follows::
export CW_CUBES_PATH=~/lib/cubes
- export CW_REGISTRY=~/etc/cubicweb.d/
- export CW_INSTANCE_DATA=$CW_REGISTRY
- export CW_RUNTIME=/tmp
+ export CW_INSTANCES_DIR=~/etc/cubicweb.d/
+ export CW_INSTANCES_DATA_DIR=$CW_INSTANCES_DIR
+ export CW_RUNTIME_DIR=/tmp
.. note::
The values given above are our suggestions but of course
--- a/doc/book/en/intro/concepts/index.rst Thu Jul 23 15:07:12 2009 +0200
+++ b/doc/book/en/intro/concepts/index.rst Thu Jul 23 15:07:25 2009 +0200
@@ -64,7 +64,7 @@
On a Unix system, the instances are usually stored in the directory
:file:`/etc/cubicweb.d/`. During development, the :file:`~/etc/cubicweb.d/`
-directory is looked up, as well as the paths in :envvar:`CW_REGISTRY`
+directory is looked up, as well as the paths in :envvar:`CW_INSTANCES_DIR`
environment variable.
The term application can refer to an instance or to a cube, depending on the
--- a/schemas/base.py Thu Jul 23 15:07:12 2009 +0200
+++ b/schemas/base.py Thu Jul 23 15:07:25 2009 +0200
@@ -102,7 +102,7 @@
# 0..n cardinality for entities created by internal session (no attached user)
# and to support later deletion of a user which has created some entities
cardinality = '**'
- subject = '**'
+ subject = '*'
object = 'CWUser'
class created_by(RelationType):
@@ -115,20 +115,20 @@
# 0..1 cardinality for entities created by internal session (no attached user)
# and to support later deletion of a user which has created some entities
cardinality = '?*'
- subject = '**'
+ subject = '*'
object = 'CWUser'
class creation_date(RelationType):
"""creation time of an entity"""
cardinality = '11'
- subject = '**'
+ subject = '*'
object = 'Datetime'
class modification_date(RelationType):
"""latest modification time of an entity"""
cardinality = '11'
- subject = '**'
+ subject = '*'
object = 'Datetime'
--- a/schemas/bootstrap.py Thu Jul 23 15:07:12 2009 +0200
+++ b/schemas/bootstrap.py Thu Jul 23 15:07:25 2009 +0200
@@ -233,7 +233,7 @@
'delete': (),
}
cardinality = '1*'
- subject = '**'
+ subject = '*'
object = 'CWEType'
class is_instance_of(RelationType):
@@ -248,7 +248,7 @@
'delete': (),
}
cardinality = '+*'
- subject = '**'
+ subject = '*'
object = 'CWEType'
class specializes(RelationType):
--- a/server/serverctl.py Thu Jul 23 15:07:12 2009 +0200
+++ b/server/serverctl.py Thu Jul 23 15:07:25 2009 +0200
@@ -649,7 +649,7 @@
import tempfile
srcappid = pop_arg(args, 1, msg="No source application specified !")
destappid = pop_arg(args, msg="No destination application specified !")
- output = tempfile.mktemp()
+ output = tempfile.mkstemp()
if ':' in srcappid:
host, srcappid = srcappid.split(':')
_remote_dump(host, srcappid, output, self.config.sudo)
--- a/server/test/unittest_schemaserial.py Thu Jul 23 15:07:12 2009 +0200
+++ b/server/test/unittest_schemaserial.py Thu Jul 23 15:07:25 2009 +0200
@@ -23,15 +23,15 @@
def test_eschema2rql1(self):
self.assertListEquals(list(eschema2rql(schema.eschema('CWAttribute'))),
[
- ('INSERT CWEType X: X description %(description)s,X final %(final)s,X meta %(meta)s,X name %(name)s',
+ ('INSERT CWEType X: X description %(description)s,X final %(final)s,X name %(name)s',
{'description': u'define a final relation: link a final relation type from a non final entity to a final entity type. used to build the application schema',
- 'meta': True, 'name': u'CWAttribute', 'final': False})
+ 'name': u'CWAttribute', 'final': False})
])
def test_eschema2rql2(self):
self.assertListEquals(list(eschema2rql(schema.eschema('String'))), [
- ('INSERT CWEType X: X description %(description)s,X final %(final)s,X meta %(meta)s,X name %(name)s',
- {'description': u'', 'final': True, 'meta': True, 'name': u'String'})])
+ ('INSERT CWEType X: X description %(description)s,X final %(final)s,X name %(name)s',
+ {'description': u'', 'final': True, 'name': u'String'})])
def test_eschema2rql_specialization(self):
self.assertListEquals(list(specialize2rql(schema)),
@@ -44,8 +44,8 @@
def test_rschema2rql1(self):
self.assertListEquals(list(rschema2rql(schema.rschema('relation_type'))),
[
- ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X meta %(meta)s,X name %(name)s,X symetric %(symetric)s',
- {'description': u'link a relation definition to its relation type', 'meta': True, 'symetric': False, 'name': u'relation_type', 'final' : False, 'fulltext_container': None, 'inlined': True}),
+ ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s',
+ {'description': u'link a relation definition to its relation type', 'symetric': False, 'name': u'relation_type', 'final' : False, 'fulltext_container': None, 'inlined': True}),
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s',
{'rt': 'relation_type', 'description': u'', 'composite': u'object', 'oe': 'CWRType',
@@ -63,7 +63,7 @@
def test_rschema2rql2(self):
self.assertListEquals(list(rschema2rql(schema.rschema('add_permission'))),
[
- ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X meta %(meta)s,X name %(name)s,X symetric %(symetric)s', {'description': u'core relation giving to a group the permission to add an entity or relation type', 'meta': True, 'symetric': False, 'name': u'add_permission', 'final': False, 'fulltext_container': None, 'inlined': False}),
+ ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s', {'description': u'core relation giving to a group the permission to add an entity or relation type', 'symetric': False, 'name': u'add_permission', 'final': False, 'fulltext_container': None, 'inlined': False}),
('INSERT CWRelation X: X cardinality %(cardinality)s,X composite %(composite)s,X description %(description)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s',
{'rt': 'add_permission', 'description': u'groups allowed to add entities/relations of this type', 'composite': None, 'oe': 'CWGroup', 'ordernum': 3, 'cardinality': u'**', 'se': 'CWEType'}),
@@ -79,8 +79,8 @@
def test_rschema2rql3(self):
self.assertListEquals(list(rschema2rql(schema.rschema('cardinality'))),
[
- ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X meta %(meta)s,X name %(name)s,X symetric %(symetric)s',
- {'description': u'', 'meta': False, 'symetric': False, 'name': u'cardinality', 'final': True, 'fulltext_container': None, 'inlined': False}),
+ ('INSERT CWRType X: X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s',
+ {'description': u'', 'symetric': False, 'name': u'cardinality', 'final': True, 'fulltext_container': None, 'inlined': False}),
('INSERT CWAttribute X: X cardinality %(cardinality)s,X defaultval %(defaultval)s,X description %(description)s,X fulltextindexed %(fulltextindexed)s,X indexed %(indexed)s,X internationalizable %(internationalizable)s,X ordernum %(ordernum)s,X relation_type ER,X from_entity SE,X to_entity OE WHERE SE name %(se)s,ER name %(rt)s,OE name %(oe)s',
{'rt': 'cardinality', 'description': u'subject/object cardinality', 'internationalizable': True, 'fulltextindexed': False, 'ordernum': 5, 'defaultval': None, 'indexed': False, 'cardinality': u'?1', 'oe': 'String', 'se': 'CWRelation'}),
@@ -100,31 +100,31 @@
def test_updateeschema2rql1(self):
self.assertListEquals(list(updateeschema2rql(schema.eschema('CWAttribute'))),
- [('SET X description %(description)s,X final %(final)s,X meta %(meta)s,X name %(name)s WHERE X is CWEType, X name %(et)s',
- {'description': u'define a final relation: link a final relation type from a non final entity to a final entity type. used to build the application schema', 'meta': True, 'et': 'CWAttribute', 'final': False, 'name': u'CWAttribute'}),
+ [('SET X description %(description)s,X final %(final)s,X name %(name)s WHERE X is CWEType, X name %(et)s',
+ {'description': u'define a final relation: link a final relation type from a non final entity to a final entity type. used to build the application schema', 'et': 'CWAttribute', 'final': False, 'name': u'CWAttribute'}),
])
def test_updateeschema2rql2(self):
self.assertListEquals(list(updateeschema2rql(schema.eschema('String'))),
- [('SET X description %(description)s,X final %(final)s,X meta %(meta)s,X name %(name)s WHERE X is CWEType, X name %(et)s',
- {'description': u'', 'meta': True, 'et': 'String', 'final': True, 'name': u'String'})
+ [('SET X description %(description)s,X final %(final)s,X name %(name)s WHERE X is CWEType, X name %(et)s',
+ {'description': u'', 'et': 'String', 'final': True, 'name': u'String'})
])
def test_updaterschema2rql1(self):
self.assertListEquals(list(updaterschema2rql(schema.rschema('relation_type'))),
[
- ('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X meta %(meta)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s',
+ ('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s',
{'rt': 'relation_type', 'symetric': False,
'description': u'link a relation definition to its relation type',
- 'meta': True, 'final': False, 'fulltext_container': None, 'inlined': True, 'name': u'relation_type'})
+ 'final': False, 'fulltext_container': None, 'inlined': True, 'name': u'relation_type'})
])
def test_updaterschema2rql2(self):
expected = [
- ('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X meta %(meta)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s',
+ ('SET X description %(description)s,X final %(final)s,X fulltext_container %(fulltext_container)s,X inlined %(inlined)s,X name %(name)s,X symetric %(symetric)s WHERE X is CWRType, X name %(rt)s',
{'rt': 'add_permission', 'symetric': False,
'description': u'core relation giving to a group the permission to add an entity or relation type',
- 'meta': True, 'final': False, 'fulltext_container': None, 'inlined': False, 'name': u'add_permission'})
+ 'final': False, 'fulltext_container': None, 'inlined': False, 'name': u'add_permission'})
]
for i, (rql, args) in enumerate(updaterschema2rql(schema.rschema('add_permission'))):
yield self.assertEquals, (rql, args), expected[i]
--- a/test/unittest_cwconfig.py Thu Jul 23 15:07:12 2009 +0200
+++ b/test/unittest_cwconfig.py Thu Jul 23 15:07:25 2009 +0200
@@ -8,7 +8,6 @@
import sys
import os
from os.path import dirname, join, abspath
-from tempfile import mktemp
from logilab.common.testlib import TestCase, unittest_main
from logilab.common.changelog import Version
--- a/test/unittest_cwctl.py Thu Jul 23 15:07:12 2009 +0200
+++ b/test/unittest_cwctl.py Thu Jul 23 15:07:25 2009 +0200
@@ -13,9 +13,9 @@
if os.environ.get('APYCOT_ROOT'):
root = os.environ['APYCOT_ROOT']
CUBES_DIR = '%s/local/share/cubicweb/cubes/' % root
- os.environ['CW_CUBES'] = CUBES_DIR
+ os.environ['CW_CUBES_PATH'] = CUBES_DIR
REGISTRY_DIR = '%s/etc/cubicweb.d/' % root
- os.environ['CW_REGISTRY_DIR'] = REGISTRY_DIR
+ os.environ['CW_INSTANCES_DIR'] = REGISTRY_DIR
from cubicweb.cwconfig import CubicWebConfiguration
CubicWebConfiguration.load_cwctl_plugins()
--- a/web/data/external_resources Thu Jul 23 15:07:12 2009 +0200
+++ b/web/data/external_resources Thu Jul 23 15:07:25 2009 +0200
@@ -18,7 +18,7 @@
#IE_STYLESHEETS = DATADIR/cubicweb.ie.css
# Javascripts files to include in HTML headers
-#JAVASCRIPTS = DATADIR/jqyery.js, DATADIR/cubicweb.python.js, DATADIR/jquery.json.js, DATADIR/cubicweb.compat.js, DATADIR/cubicweb.htmlhelpers.js
+#JAVASCRIPTS = DATADIR/jquery.js, DATADIR/cubicweb.python.js, DATADIR/jquery.json.js, DATADIR/cubicweb.compat.js, DATADIR/cubicweb.htmlhelpers.js
# path to favicon (relative to the application main script, seen as a
# directory, hence .. when you are not using an absolute path)
--- a/web/test/data/schema/testschema.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/test/data/schema/testschema.py Thu Jul 23 15:07:25 2009 +0200
@@ -5,6 +5,11 @@
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
+
+from yams.buildobjs import (EntityType, RelationDefinition, RelationType, String,
+ Int, SubjectRelation)
+from yams.constraints import IntervalBoundConstraint
+
class Salesterm(EntityType):
described_by_test = SubjectRelation('File', cardinality='1*', composite='subject')
amount = Int(constraints=[IntervalBoundConstraint(0, 100)])
--- a/web/test/unittest_form.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/test/unittest_form.py Thu Jul 23 15:07:25 2009 +0200
@@ -161,7 +161,7 @@
def test_richtextfield_2(self):
self.req.use_fckeditor = lambda: True
- self._test_richtextfield('<input name="description_format:%(eid)s" style="display: block" type="hidden" value="text/rest"></input><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="0"></textarea>')
+ self._test_richtextfield('<input name="description_format:%(eid)s" style="display: block" type="hidden" value="text/rest" /><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="0"></textarea>')
def test_filefield(self):
@@ -172,14 +172,14 @@
data=Binary('new widgets system'))
form = FFForm(self.req, redirect_path='perdu.com', entity=file)
self.assertTextEquals(self._render_entity_field('data', form),
- '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""></input>
+ '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value="" />
<a href="javascript: toggleVisibility('data:%(eid)s-advanced')" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
<div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain"></input><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8"></input><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain" /><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8" /><br/>
</div>
<br/>
-<input name="data:%(eid)s__detach" type="checkbox"></input>
+<input name="data:%(eid)s__detach" type="checkbox" />
detach attached file
''' % {'eid': file.eid})
@@ -196,14 +196,14 @@
data=Binary('new widgets system'))
form = EFFForm(self.req, redirect_path='perdu.com', entity=file)
self.assertTextEquals(self._render_entity_field('data', form),
- '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value=""></input>
+ '''<input id="data:%(eid)s" name="data:%(eid)s" tabindex="0" type="file" value="" />
<a href="javascript: toggleVisibility('data:%(eid)s-advanced')" title="show advanced fields"><img src="http://testing.fr/cubicweb/data/puce_down.png" alt="show advanced fields"/></a>
<div id="data:%(eid)s-advanced" class="hidden">
-<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain"></input><br/>
-<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8"></input><br/>
+<label for="data_format:%(eid)s">data_format</label><input id="data_format:%(eid)s" maxlength="50" name="data_format:%(eid)s" size="45" tabindex="1" type="text" value="text/plain" /><br/>
+<label for="data_encoding:%(eid)s">data_encoding</label><input id="data_encoding:%(eid)s" maxlength="20" name="data_encoding:%(eid)s" size="20" tabindex="2" type="text" value="UTF-8" /><br/>
</div>
<br/>
-<input name="data:%(eid)s__detach" type="checkbox"></input>
+<input name="data:%(eid)s__detach" type="checkbox" />
detach attached file
<p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p>
<textarea cols="80" name="data:%(eid)s" onkeyup="autogrow(this)" rows="3" tabindex="3">new widgets system</textarea>''' % {'eid': file.eid})
@@ -214,9 +214,9 @@
upassword = StringField(widget=PasswordInput)
form = PFForm(self.req, redirect_path='perdu.com', entity=self.entity)
self.assertTextEquals(self._render_entity_field('upassword', form),
- '''<input id="upassword:%(eid)s" name="upassword:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"></input>
+ '''<input id="upassword:%(eid)s" name="upassword:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__" />
<br/>
-<input name="upassword-confirm:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__"></input>
+<input name="upassword-confirm:%(eid)s" tabindex="0" type="password" value="__cubicweb_internal_field__" />
<span class="emphasis">confirm password</span>''' % {'eid': self.entity.eid})
--- a/web/test/unittest_urlrewrite.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/test/unittest_urlrewrite.py Thu Jul 23 15:07:25 2009 +0200
@@ -29,12 +29,14 @@
self.assertListEquals(rules, [
('foo' , dict(rql='Foo F')),
('/index' , dict(vid='index2')),
- ('/schema', {'vid': 'schema'}),
+ ('/schema', dict(vid='schema')),
('/myprefs', dict(vid='propertiesform')),
('/siteconfig', dict(vid='systempropertiesform')),
+ ('/siteinfo', dict(vid='info')),
('/manage', dict(vid='manage')),
- ('/notfound', {'vid': '404'}),
- ('/error', {'vid': 'error'}),
+ ('/notfound', dict(vid='404')),
+ ('/error', dict(vid='error')),
+ ('/sparql', dict(vid='sparql')),
('/schema/([^/]+?)/?$', {'rql': r'Any X WHERE X is CWEType, X name "\1"', 'vid': 'eschema'}),
('/add/([^/]+?)/?$' , dict(vid='creation', etype=r'\1')),
('/doc/images/(.+?)/?$', dict(fid='\\1', vid='wdocimages')),
--- a/web/test/unittest_viewselector.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/test/unittest_viewselector.py Thu Jul 23 15:07:25 2009 +0200
@@ -22,8 +22,9 @@
('logout', actions.LogoutAction)]
SITEACTIONS = [('siteconfig', actions.SiteConfigurationAction),
('manage', actions.ManageAction),
- ('schema', schema.ViewSchemaAction)]
-
+ ('schema', schema.ViewSchemaAction),
+ ('siteinfo', actions.SiteInfoAction),
+ ]
class ViewSelectorTC(EnvBasedTC):
@@ -173,6 +174,7 @@
('text', baseviews.TextView),
('treeview', treeview.TreeView),
('vcard', vcard.VCardCWUserView),
+ ('wfhistory', workflow.WFHistoryView),
('xbel', xbel.XbelView),
('xml', xmlrss.XMLView),
])
--- a/web/views/__init__.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/views/__init__.py Thu Jul 23 15:07:25 2009 +0200
@@ -8,7 +8,7 @@
__docformat__ = "restructuredtext en"
import os
-from tempfile import mktemp
+import tempfile
from rql import nodes
@@ -109,7 +109,7 @@
def cell_call(self, row=0, col=0):
self.row, self.col = row, col # in case one need it
- tmpfile = mktemp('.png')
+ tmpfile = tempfile.mkstemp('.png')
try:
self._generate(tmpfile)
self.w(open(tmpfile).read())
--- a/web/views/actions.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/views/actions.py Thu Jul 23 15:07:25 2009 +0200
@@ -286,7 +286,7 @@
title = _('manage')
order = 20
-class ManageAction(ManagersAction):
+class SiteInfoAction(ManagersAction):
id = 'siteinfo'
title = _('info')
order = 30
--- a/web/views/boxes.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/views/boxes.py Thu Jul 23 15:07:25 2009 +0200
@@ -144,20 +144,16 @@
if 'in_state' in entity.e_schema.subject_relations() and entity.in_state:
_ = self.req._
state = entity.in_state[0]
- transitions = list(state.transitions(entity))
- if transitions:
- menu_title = u'%s: %s' % (_('state'), state.view('text'))
- menu_items = []
- for tr in transitions:
- url = entity.absolute_url(vid='statuschange', treid=tr.eid)
- menu_items.append(self.mk_action(_(tr.name), url))
- box.append(BoxMenu(menu_title, menu_items))
- # when there are no possible transition, put state if the menu if
- # there are some other actions
- elif not box.is_empty():
- menu_title = u'<a title="%s">%s: <i>%s</i></a>' % (
- _('no possible transition'), _('state'), state.view('text'))
- box.append(RawBoxItem(menu_title, 'boxMainactions'))
+ menu_title = u'%s: %s' % (_('state'), state.view('text'))
+ menu_items = []
+ for tr in state.transitions(entity):
+ url = entity.absolute_url(vid='statuschange', treid=tr.eid)
+ menu_items.append(self.mk_action(_(tr.name), url))
+ wfurl = self.build_url('cwetype/%s'%entity.e_schema, vid='workflow')
+ menu_items.append(self.mk_action(_('view workflow'), wfurl))
+ wfurl = entity.absolute_url(vid='wfhistory')
+ menu_items.append(self.mk_action(_('view history'), wfurl))
+ box.append(BoxMenu(menu_title, menu_items))
return None
def linkto_url(self, entity, rtype, etype, target):
--- a/web/views/sparql.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/views/sparql.py Thu Jul 23 15:07:25 2009 +0200
@@ -21,7 +21,7 @@
class SparqlForm(forms.FieldsForm):
id = 'sparql'
- sparql = formfields.StringField(help=_('type here a sparql qyery'))
+ sparql = formfields.StringField(help=_('type here a sparql query'))
resultvid = formfields.StringField(choices=((_('table'), 'table'),
(_('sparql xml'), 'sparqlxml')),
widget=fwdgs.Radio,
--- a/web/views/workflow.py Thu Jul 23 15:07:12 2009 +0200
+++ b/web/views/workflow.py Thu Jul 23 15:07:25 2009 +0200
@@ -18,6 +18,7 @@
from cubicweb.selectors import (implements, has_related_entities,
relation_possible, match_form_params)
from cubicweb.interfaces import IWorkflowable
+from cubicweb.view import EntityView
from cubicweb.web import stdmsgs, action, component, form
from cubicweb.web.form import FormViewMixIn
from cubicweb.web.formfields import StringField, RichTextField
@@ -66,13 +67,9 @@
def redirectpath(self, entity):
return entity.rest_path()
-
-class WFHistoryVComponent(component.EntityVComponent):
- """display the workflow history for entities supporting it"""
+class WFHistoryView(EntityView):
id = 'wfhistory'
- __select__ = (component.EntityVComponent.__select__
- & relation_possible('wf_info_for', role='object'))
- context = 'navcontentbottom'
+ __select__ = relation_possible('wf_info_for', role='object')
title = _('Workflow history')
def cell_call(self, row, col, view=None):
@@ -101,6 +98,15 @@
self.wview('table', rset, title=_(self.title), displayactions=False,
displaycols=displaycols, headers=headers)
+class WFHistoryVComponent(component.EntityVComponent):
+ """display the workflow history for entities supporting it"""
+ id = 'wfhistory'
+ __select__ = WFHistoryView.__select__ & component.EntityVComponent.__select__
+ context = 'navcontentbottom'
+ title = _('Workflow history')
+
+ def cell_call(self, row, col, view=None):
+ self.wview('wfhistory', self.rset, row=row, col=col, view=view)
# workflow entity types views #################################################