--- a/.hgtags Mon Feb 07 18:19:40 2011 +0100
+++ b/.hgtags Tue Feb 08 12:23:30 2011 +0100
@@ -179,3 +179,5 @@
1484257fe9aeb29d0210e635c12ae5b3d6118cfb cubicweb-debian-version-3.10.6-1
1959d97ebf2e6a0f7cd05d4cc48bb955c4351da5 cubicweb-version-3.10.7
bf5d9a1415e3c9abe6b68ba3b24a8ad741f9de3c cubicweb-debian-version-3.10.7-1
+e581a86a68f089946a98c966ebca7aee58a5718f cubicweb-version-3.10.8
+132b525de25bc75ed6389c45aee77e847cb3a437 cubicweb-debian-version-3.10.8-1
--- a/__pkginfo__.py Mon Feb 07 18:19:40 2011 +0100
+++ b/__pkginfo__.py Tue Feb 08 12:23:30 2011 +0100
@@ -1,4 +1,4 @@
-# pylint: disable=W0622,C0103
+ # pylint: disable=W0622,C0103
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
@@ -52,7 +52,7 @@
'Twisted': '',
# XXX graphviz
# server dependencies
- 'logilab-database': '>= 1.3.2',
+ 'logilab-database': '>= 1.3.3',
'pysqlite': '>= 2.5.5', # XXX install pysqlite2
}
--- a/debian/changelog Mon Feb 07 18:19:40 2011 +0100
+++ b/debian/changelog Tue Feb 08 12:23:30 2011 +0100
@@ -1,3 +1,9 @@
+cubicweb (3.10.8-1) unstable; urgency=low
+
+ * new upstream release
+
+ -- Sylvain Thénault <sylvain.thenault@logilab.fr> Wed, 02 Feb 2011 11:09:22 +0100
+
cubicweb (3.10.7-1) unstable; urgency=low
* new upstream release
--- a/debian/control Mon Feb 07 18:19:40 2011 +0100
+++ b/debian/control Tue Feb 08 12:23:30 2011 +0100
@@ -33,7 +33,7 @@
Conflicts: cubicweb-multisources
Replaces: cubicweb-multisources
Provides: cubicweb-multisources
-Depends: ${misc:Depends}, ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.3.2), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2
+Depends: ${misc:Depends}, ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.3.3), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2
Recommends: pyro (<< 4.0.0), cubicweb-documentation (= ${source:Version})
Description: server part of the CubicWeb framework
CubicWeb is a semantic web application framework.
--- a/ext/rest.py Mon Feb 07 18:19:40 2011 +0100
+++ b/ext/rest.py Tue Feb 08 12:23:30 2011 +0100
@@ -47,6 +47,8 @@
from cubicweb import UnknownEid
from cubicweb.ext.html4zope import Writer
+from cubicweb.web.views import vid_from_rset # XXX better not to import c.w.views here...
+
# We provide our own parser as an attempt to get rid of
# state machine reinstanciation
@@ -93,6 +95,23 @@
return [nodes.reference(rawtext, utils.unescape(rest), refuri=ref,
**options)], []
+def rql_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
+ """:rql:`Any X,Y WHERE X is CWUser, X login Y:table`"""
+ _cw = inliner.document.settings.context._cw
+ text = text.strip()
+ if ':' in text:
+ rql, vid = text.rsplit(u':', 1)
+ rql = rql.strip()
+ else:
+ rql, vid = text, None
+ _cw.ensure_ro_rql(rql)
+ rset = _cw.execute(rql, {'userid': _cw.user.eid})
+ if vid is None:
+ vid = vid_from_rset(_cw, rset, _cw.vreg.schema)
+ view = _cw.vreg['views'].select(vid, _cw, rset=rset)
+ content = view.render()
+ set_classes(options)
+ return [nodes.raw('', content, format='html')], []
def winclude_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
@@ -288,6 +307,7 @@
return
_INITIALIZED = True
register_canonical_role('eid', eid_reference_role)
+ register_canonical_role('rql', rql_role)
directives.register_directive('winclude', winclude_directive)
if pygments_directive is not None:
directives.register_directive('sourcecode', pygments_directive)
--- a/ext/test/unittest_rest.py Mon Feb 07 18:19:40 2011 +0100
+++ b/ext/test/unittest_rest.py Tue Feb 08 12:23:30 2011 +0100
@@ -56,5 +56,17 @@
''')
+
+ def test_rql_role_with_vid(self):
+ context = self.context()
+ out = rest_publish(context, ':rql:`Any X WHERE X is CWUser:table`')
+ self.assert_(out.endswith('<a href="http://testing.fr/cubicweb/cwuser/anon" title="">anon</a>'
+ '</td></tr></tbody></table></div>\n</div>\n</p>\n'))
+
+ def test_rql_role_without_vid(self):
+ context = self.context()
+ out = rest_publish(context, ':rql:`Any X WHERE X is CWUser`')
+ self.assertEqual(out, u'<p><h1>cwuser_plural</h1><div class="section"><a href="http://testing.fr/cubicweb/cwuser/admin" title="">admin</a></div><div class="section"><a href="http://testing.fr/cubicweb/cwuser/anon" title="">anon</a></div></p>\n')
+
if __name__ == '__main__':
unittest_main()
--- a/i18n/de.po Mon Feb 07 18:19:40 2011 +0100
+++ b/i18n/de.po Tue Feb 08 12:23:30 2011 +0100
@@ -1321,11 +1321,9 @@
#, python-format
msgid ""
-"can't set inlined=%(inlined)s, %(stype)s %(rtype)s %(otype)s has cardinality="
+"can't set inlined=True, %(stype)s %(rtype)s %(otype)s has cardinality="
"%(card)s"
msgstr ""
-"Kann 'inlined' = %(inlined)s nicht zuweisen, %(stype)s %(rtype)s %(otype)s "
-"hat die Kardinalität %(card)s"
msgid "cancel"
msgstr ""
@@ -4346,3 +4344,10 @@
msgid "you should probably delete that property"
msgstr "Sie sollten diese Eigenschaft wahrscheinlich löschen."
+
+#~ msgid ""
+#~ "can't set inlined=%(inlined)s, %(stype)s %(rtype)s %(otype)s has "
+#~ "cardinality=%(card)s"
+#~ msgstr ""
+#~ "Kann 'inlined' = %(inlined)s nicht zuweisen, %(stype)s %(rtype)s "
+#~ "%(otype)s hat die Kardinalität %(card)s"
--- a/i18n/en.po Mon Feb 07 18:19:40 2011 +0100
+++ b/i18n/en.po Tue Feb 08 12:23:30 2011 +0100
@@ -1275,7 +1275,7 @@
#, python-format
msgid ""
-"can't set inlined=%(inlined)s, %(stype)s %(rtype)s %(otype)s has cardinality="
+"can't set inlined=True, %(stype)s %(rtype)s %(otype)s has cardinality="
"%(card)s"
msgstr ""
--- a/i18n/es.po Mon Feb 07 18:19:40 2011 +0100
+++ b/i18n/es.po Tue Feb 08 12:23:30 2011 +0100
@@ -1321,11 +1321,11 @@
#, python-format
msgid ""
-"can't set inlined=%(inlined)s, %(stype)s %(rtype)s %(otype)s has cardinality="
+"can't set inlined=True, %(stype)s %(rtype)s %(otype)s has cardinality="
"%(card)s"
msgstr ""
-"no puede poner 'inlined' = %(inlined)s, %(stype)s %(rtype)s %(otype)s tiene "
-"cardinalidad %(card)s"
+"no puede poner 'inlined' = True, %(stype)s %(rtype)s %(otype)s "
+ "tiene cardinalidad %(card)s"
msgid "cancel"
msgstr ""
--- a/i18n/fr.po Mon Feb 07 18:19:40 2011 +0100
+++ b/i18n/fr.po Tue Feb 08 12:23:30 2011 +0100
@@ -1323,11 +1323,11 @@
#, python-format
msgid ""
-"can't set inlined=%(inlined)s, %(stype)s %(rtype)s %(otype)s has cardinality="
+"can't set inlined=True, %(stype)s %(rtype)s %(otype)s has cardinality="
"%(card)s"
msgstr ""
-"ne peut mettre 'inlined' = %(inlined)s, %(stype)s %(rtype)s %(otype)s a pour "
-"cardinalité %(card)s"
+"ne peut mettre 'inlined'=Vrai, %(stype)s %(rtype)s %(otype)s a "
+"pour cardinalité %(card)s"
msgid "cancel"
msgstr "annuler"
--- a/server/rqlannotation.py Mon Feb 07 18:19:40 2011 +0100
+++ b/server/rqlannotation.py Tue Feb 08 12:23:30 2011 +0100
@@ -195,7 +195,7 @@
for rel in sorted(relations, key=lambda x: (x.children[0].name, x.r_type)):
# only equality relation with a variable as rhs may be principal
if rel.operator() not in ('=', 'IS') \
- or not isinstance(rel.children[1].children[0], VariableRef):
+ or not isinstance(rel.children[1].children[0], VariableRef) or rel.neged(strict=True):
continue
if rel.scope is rel.stmt:
return rel
--- a/server/serverctl.py Mon Feb 07 18:19:40 2011 +0100
+++ b/server/serverctl.py Tue Feb 08 12:23:30 2011 +0100
@@ -75,7 +75,7 @@
user = raw_input('Connect as user ? [%r]: ' % default_user)
user = user.strip() or default_user
if user == source.get('db-user'):
- password = source['db-password']
+ password = source.get('db-password')
else:
password = getpass('password: ')
else:
@@ -219,7 +219,7 @@
return
user = source['db-user'] or None
cnx = confirm_on_error_or_die('connecting to database %s' % dbname,
- _db_sys_cnx, source, 'DROP DATABASE', user=user)
+ _db_sys_cnx, source, 'DROP DATABASE')
if cnx is ERROR:
return
cursor = cnx.cursor()
@@ -328,14 +328,15 @@
elif self.config.create_db:
print '\n'+underline_title('Creating the system database')
# connect on the dbms system base to create our base
- dbcnx = _db_sys_cnx(source, 'CREATE/DROP DATABASE and / or USER', verbose=verbose)
+ dbcnx = _db_sys_cnx(source, 'CREATE/DROP DATABASE and / or USER',
+ verbose=verbose)
cursor = dbcnx.cursor()
try:
if helper.users_support:
user = source['db-user']
if not helper.user_exists(cursor, user) and (automatic or \
ASK.confirm('Create db user %s ?' % user, default_is_yes=False)):
- helper.create_user(source['db-user'], source['db-password'])
+ helper.create_user(source['db-user'], source.get('db-password'))
print '-> user %s created.' % user
if dbname in helper.list_databases(cursor):
if automatic or ASK.confirm('Database %s already exists -- do you want to drop it ?' % dbname):
--- a/server/sources/rql2sql.py Mon Feb 07 18:19:40 2011 +0100
+++ b/server/sources/rql2sql.py Tue Feb 08 12:23:30 2011 +0100
@@ -991,24 +991,21 @@
unification (eg X attr1 A, Y attr2 A). In case of selection,
nothing to do here.
"""
- contextrels = {}
for var in rhs_vars:
if var.name in self._varmap:
# ensure table is added
self._var_info(var.variable)
principal = var.variable.stinfo.get('principal')
if principal is not None and principal is not relation:
- contextrels[var.name] = relation
- if not contextrels:
- return ''
- # we have to generate unification expression
- lhssql = self._inlined_var_sql(relation.children[0].variable,
- relation.r_type)
- try:
- self._state.ignore_varmap = True
- return '%s%s' % (lhssql, relation.children[1].accept(self))
- finally:
- self._state.ignore_varmap = False
+ # we have to generate unification expression
+ lhssql = self._inlined_var_sql(relation.children[0].variable,
+ relation.r_type)
+ try:
+ self._state.ignore_varmap = True
+ return '%s%s' % (lhssql, relation.children[1].accept(self))
+ finally:
+ self._state.ignore_varmap = False
+ return ''
def _visit_attribute_relation(self, rel):
"""generate SQL for an attribute relation"""
--- a/server/test/unittest_rql2sql.py Mon Feb 07 18:19:40 2011 +0100
+++ b/server/test/unittest_rql2sql.py Tue Feb 08 12:23:30 2011 +0100
@@ -180,6 +180,10 @@
FROM cw_Personne AS _X
WHERE _X.cw_prenom=lulu AND NOT (EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, in_group_relation AS rel_in_group1, cw_CWGroup AS _G WHERE rel_owned_by0.eid_from=_X.cw_eid AND rel_in_group1.eid_from=rel_owned_by0.eid_to AND rel_in_group1.eid_to=_G.cw_eid AND ((_G.cw_name=lulufanclub) OR (_G.cw_name=managers))))'''),
+ ('Any X WHERE X title V, NOT X wikiid V, NOT X title "parent", X is Card',
+ '''SELECT _X.cw_eid
+FROM cw_Card AS _X
+WHERE NOT (_X.cw_wikiid=_X.cw_title) AND NOT (_X.cw_title=parent)''')
]
--- a/web/data/cubicweb.ajax.box.js Mon Feb 07 18:19:40 2011 +0100
+++ b/web/data/cubicweb.ajax.box.js Tue Feb 08 12:23:30 2011 +0100
@@ -16,7 +16,7 @@
var d = loadRemote('json', ajaxFuncArgs(fname, null, eid, value));
d.addCallback(function() {
$('#' + holderid).empty();
- var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
+ var formparams = ajaxFuncArgs('render', null, 'ctxcomponents', boxid, eid);
$('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
if (msg) {
document.location.hash = '#header';
@@ -28,7 +28,7 @@
function ajaxBoxRemoveLinkedEntity(boxid, eid, relatedeid, delfname, msg) {
var d = loadRemote('json', ajaxFuncArgs(delfname, null, eid, relatedeid));
d.addCallback(function() {
- var formparams = ajaxFuncArgs('render', null, 'boxes', boxid, eid);
+ var formparams = ajaxFuncArgs('render', null, 'ctxcomponents', boxid, eid);
$('#' + cw.utils.domid(boxid) + eid).loadxhtml('json', formparams);
if (msg) {
document.location.hash = '#header';
--- a/web/data/cubicweb.ajax.js Mon Feb 07 18:19:40 2011 +0100
+++ b/web/data/cubicweb.ajax.js Tue Feb 08 12:23:30 2011 +0100
@@ -419,7 +419,7 @@
var d = loadRemote('json', ajaxFuncArgs('delete_bookmark', null, beid));
d.addCallback(function(boxcontent) {
$('#bookmarks_box').loadxhtml('json',
- ajaxFuncArgs('render', null, 'boxes',
+ ajaxFuncArgs('render', null, 'ctxcomponents',
'bookmarks_box'));
document.location.hash = '#header';
updateMessage(_("bookmark has been removed"));
@@ -633,7 +633,7 @@
reloadBox = cw.utils.deprecatedFunction(
'[3.9] reloadBox() is deprecated, use loadxhtml instead',
function(boxid, rql) {
- return reloadComponent(boxid, rql, 'boxes', boxid);
+ return reloadComponent(boxid, rql, 'ctxcomponents', boxid);
}
);