--- a/dbapi.py Fri Oct 14 15:19:25 2011 +0200
+++ b/dbapi.py Fri Oct 14 16:42:10 2011 +0200
@@ -332,7 +332,7 @@
except KeyError:
# this occurs usually during test execution
self._ = self.__ = unicode
- self.pgettext = lambda x, y: y
+ self.pgettext = lambda x, y: unicode(y)
self.debug('request default language: %s', self.lang)
# entities cache management ###############################################
--- a/sobjects/parsers.py Fri Oct 14 15:19:25 2011 +0200
+++ b/sobjects/parsers.py Fri Oct 14 16:42:10 2011 +0200
@@ -61,9 +61,14 @@
ustr = ustr.split('.',1)[0]
return datetime.strptime(ustr, '%Y-%m-%d %H:%M:%S')
DEFAULT_CONVERTERS['Datetime'] = convert_datetime
+# XXX handle timezone, though this will be enough as TZDatetime are
+# serialized without time zone by default (UTC time). See
+# cw.web.views.xmlrss.SERIALIZERS.
+DEFAULT_CONVERTERS['TZDatetime'] = convert_datetime
def convert_time(ustr):
return totime(datetime.strptime(ustr, '%H:%M:%S'))
DEFAULT_CONVERTERS['Time'] = convert_time
+DEFAULT_CONVERTERS['TZTime'] = convert_time
def convert_interval(ustr):
return time(seconds=int(ustr))
DEFAULT_CONVERTERS['Interval'] = convert_interval
--- a/sobjects/test/unittest_parsers.py Fri Oct 14 15:19:25 2011 +0200
+++ b/sobjects/test/unittest_parsers.py Fri Oct 14 16:42:10 2011 +0200
@@ -16,6 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import with_statement
+
from datetime import datetime
from cubicweb.devtools.testlib import CubicWebTC
@@ -228,13 +230,15 @@
('unknown', 'http://testing.fr/cubicweb/', 'system')))
)
session.set_cnxset()
- stats = dfsource.pull_data(session, force=True, raise_on_error=True)
+ with session.security_enabled(read=False): # avoid Unauthorized due to password selection
+ stats = dfsource.pull_data(session, force=True, raise_on_error=True)
self.assertEqual(stats['created'], set())
self.assertEqual(len(stats['updated']), 2)
self.repo._type_source_cache.clear()
self.repo._extid_cache.clear()
session.set_cnxset()
- stats = dfsource.pull_data(session, force=True, raise_on_error=True)
+ with session.security_enabled(read=False): # avoid Unauthorized due to password selection
+ stats = dfsource.pull_data(session, force=True, raise_on_error=True)
self.assertEqual(stats['created'], set())
self.assertEqual(len(stats['updated']), 2)
session.commit()
@@ -255,7 +259,8 @@
self.commit()
# test everything is still fine after source synchronization
session.set_cnxset()
- stats = dfsource.pull_data(session, force=True, raise_on_error=True)
+ with session.security_enabled(read=False): # avoid Unauthorized due to password selection
+ stats = dfsource.pull_data(session, force=True, raise_on_error=True)
rset = self.sexecute('EmailAddress X WHERE X address "syt@logilab.fr"')
self.assertEqual(len(rset), 1)
e = rset.get_entity(0, 0)
@@ -273,7 +278,8 @@
self.commit()
# test everything is still fine after source synchronization
session.set_cnxset()
- stats = dfsource.pull_data(session, force=True, raise_on_error=True)
+ with session.security_enabled(read=False): # avoid Unauthorized due to password selection
+ stats = dfsource.pull_data(session, force=True, raise_on_error=True)
rset = self.sexecute('EmailAddress X WHERE X address "syt@logilab.fr"')
self.assertEqual(len(rset), 0)
rset = self.sexecute('Any X WHERE X use_email E, X login "sthenault"')
--- a/test/unittest_schema.py Fri Oct 14 15:19:25 2011 +0200
+++ b/test/unittest_schema.py Fri Oct 14 16:42:10 2011 +0200
@@ -193,8 +193,8 @@
'fabrique_par', 'final', 'firstname', 'for_user', 'fournit',
'from_entity', 'from_state', 'fulltext_container', 'fulltextindexed',
- 'has_group_permission', 'has_text',
- 'identity', 'in_group', 'in_state', 'indexed',
+ 'has_text',
+ 'identity', 'in_group', 'in_state', 'in_synchronization', 'indexed',
'initial_state', 'inlined', 'internationalizable', 'is', 'is_instance_of',
'label', 'last_login_time', 'latest_retrieval', 'lieu', 'login',
@@ -209,7 +209,7 @@
'read_permission', 'relation_type', 'relations', 'require_group',
- 'specializes', 'state_of', 'subworkflow', 'subworkflow_exit', 'subworkflow_state', 'surname', 'symmetric', 'synchronizing', 'synopsis',
+ 'specializes', 'state_of', 'subworkflow', 'subworkflow_exit', 'subworkflow_state', 'surname', 'symmetric', 'synopsis',
'tags', 'timestamp', 'title', 'to_entity', 'to_state', 'transition_of', 'travaille', 'type',
--- a/view.py Fri Oct 14 15:19:25 2011 +0200
+++ b/view.py Fri Oct 14 16:42:10 2011 +0200
@@ -469,7 +469,7 @@
translate = lambda val: val
# XXX [0] because of missing Union support
rql_syntax_tree = self.cw_rset.syntax_tree()
- rqlstdescr = rql_syntax_tree.get_description(mainindex)[0]
+ rqlstdescr = rql_syntax_tree.get_description(mainindex, translate)[0]
labels = []
for colidx, label in enumerate(rqlstdescr):
labels.append(self.column_label(colidx, label, translate))
@@ -496,7 +496,7 @@
etypes = self.cw_rset.column_types(colidx)
if translate_func is not None:
etypes = map(translate_func, etypes)
- label = ','.join(etypes)
+ label = u','.join(etypes)
return label