--- a/cwconfig.py Tue Apr 05 12:48:53 2011 +0200
+++ b/cwconfig.py Tue Apr 05 13:24:02 2011 +0200
@@ -139,6 +139,7 @@
import sys
import os
import logging
+import logging.config
from smtplib import SMTP
from threading import Lock
from os.path import (exists, join, expanduser, abspath, normpath,
@@ -1098,7 +1099,7 @@
# read a config file if it exists
logconfig = join(self.apphome, 'logging.conf')
if exists(logconfig):
- logging.fileConfig(logconfig)
+ logging.config.fileConfig(logconfig)
def available_languages(self, *args):
"""return available translation for an instance, by looking for
--- a/dataimport.py Tue Apr 05 12:48:53 2011 +0200
+++ b/dataimport.py Tue Apr 05 13:24:02 2011 +0200
@@ -79,6 +79,7 @@
from logilab.common.decorators import cached
from logilab.common.deprecation import deprecated
+from cubicweb import QueryError
from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES
from cubicweb.server.utils import eschema_eid
from cubicweb.server.edition import EditedEntity
@@ -185,7 +186,7 @@
if res[dest] is None:
break
except ValueError, err:
- raise ValueError('error with %r field: %s' % (src, err))
+ raise ValueError('error with %r field: %s' % (src, err)), None, sys.exc_info()[-1]
return res
# user interactions ############################################################
@@ -540,6 +541,10 @@
def run(self):
self.errors = {}
+ if self.commitevery is None:
+ self.tell('Will commit all or nothing.')
+ else:
+ self.tell('Will commit every %s iterations' % self.commitevery)
for func, checks in self.generators:
self._checks = {}
func_name = func.__name__
@@ -558,7 +563,12 @@
err = func(buckets)
if err:
self.errors[title] = (help, err)
- txuuid = self.store.commit()
+ try:
+ txuuid = self.store.commit()
+ if txuuid is not None:
+ self.tell('Transaction commited (txuuid: %s)' % txuuid)
+ except QueryError, ex:
+ self.tell('Transaction aborted: %s' % ex)
self._print_stats()
if self.errors:
if self.askerror == 2 or (self.askerror and confirm('Display errors ?')):
@@ -566,8 +576,7 @@
for errkey, error in self.errors.items():
self.tell("\n%s (%s): %d\n" % (error[0], errkey, len(error[1])))
self.tell(pformat(sorted(error[1])))
- if txuuid is not None:
- print 'transaction id:', txuuid
+
def _print_stats(self):
nberrors = sum(len(err[1]) for err in self.errors.values())
self.tell('\nImport statistics: %i entities, %i types, %i relations and %i errors'
--- a/selectors.py Tue Apr 05 12:48:53 2011 +0200
+++ b/selectors.py Tue Apr 05 13:24:02 2011 +0200
@@ -387,7 +387,9 @@
class ExpectedValueSelector(Selector):
"""Take a list of expected values as initializer argument and store them
- into the :attr:`expected` set attribute.
+ into the :attr:`expected` set attribute. You may also give a set as single
+ argument, which will be then be referenced as set of expected values,
+ allowing modification to the given set to be considered.
You should implement the :meth:`_get_value(cls, req, **kwargs)` method
which should return the value for the given context. The selector will then
@@ -395,7 +397,10 @@
"""
def __init__(self, *expected):
assert expected, self
- self.expected = frozenset(expected)
+ if len(expected) == 1 and isinstance(expected[0], set):
+ self.expected = expected[0]
+ else:
+ self.expected = frozenset(expected)
def __str__(self):
return '%s(%s)' % (self.__class__.__name__,
--- a/web/data/cubicweb.old.css Tue Apr 05 12:48:53 2011 +0200
+++ b/web/data/cubicweb.old.css Tue Apr 05 13:24:02 2011 +0200
@@ -56,7 +56,7 @@
}
a, a:active, a:visited, a:link {
- color: #ff4500;
+ color: %(aColor)s;
text-decoration: none;
}
--- a/web/data/uiprops.py Tue Apr 05 12:48:53 2011 +0200
+++ b/web/data/uiprops.py Tue Apr 05 13:24:02 2011 +0200
@@ -94,7 +94,6 @@
# links
aColor = '#e6820e'
-aActiveColor = aVisitedColor = aLinkColor = lazystr('%(aColor)s')
# page frame
--- a/web/views/igeocodable.py Tue Apr 05 12:48:53 2011 +0200
+++ b/web/views/igeocodable.py Tue Apr 05 13:24:02 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -33,13 +33,13 @@
@property
@implements_adapter_compat('IGeocodable')
def latitude(self):
- """returns the latitude of the entity"""
+ """returns the latitude of the entity in degree (-90 < float < +90)"""
raise NotImplementedError
@property
@implements_adapter_compat('IGeocodable')
def longitude(self):
- """returns the longitude of the entity"""
+ """returns the longitude of the entity in degree (-180 < float < +180)"""
raise NotImplementedError
@implements_adapter_compat('IGeocodable')