--- a/devtools/__init__.py Tue Apr 06 20:54:35 2010 +0200
+++ b/devtools/__init__.py Fri Apr 09 15:01:14 2010 +0000
@@ -201,7 +201,7 @@
elif driver == 'postgres':
init_test_database_postgres(config)
elif driver == 'sqlserver2005':
- init_test_database_sqlserver2005(config, source)
+ init_test_database_sqlserver2005(config)
else:
raise ValueError('no initialization function for driver %r' % driver)
config._cubes = None # avoid assertion error
@@ -217,6 +217,8 @@
driver = config.sources()['system']['db-driver']
if driver == 'sqlite':
reset_test_database_sqlite(config)
+ if driver == 'sqlserver2005':
+ reset_test_database_sqlserver2005(config)
else:
raise ValueError('no reset function for driver %r' % driver)
@@ -236,7 +238,9 @@
if config.init_repository:
from cubicweb.server import init_repository
init_repository(config, interactive=False, drop=True, vreg=vreg)
-
+
+def reset_test_database_sqlserver2005(config):
+ pass
### sqlite test database handling ##############################################
--- a/devtools/testlib.py Tue Apr 06 20:54:35 2010 +0200
+++ b/devtools/testlib.py Fri Apr 09 15:01:14 2010 +0000
@@ -261,6 +261,12 @@
self.setup_database()
self.commit()
MAILBOX[:] = [] # reset mailbox
+ self._cnxs = []
+
+ def tearDown(self):
+ for cnx in self._cnxs:
+ if not cnx._closed:
+ cnx.close()
def setup_database(self):
"""add your database setup code by overriding this method"""
@@ -302,6 +308,7 @@
self.cnx = repo_connect(self.repo, unicode(login),
cnxprops=ConnectionProperties('inmemory'),
**kwargs)
+ self._cnxs.append(self.cnx)
if login == self.vreg.config.anonymous_user()[0]:
self.cnx.anonymous_connection = True
return self.cnx
@@ -310,6 +317,7 @@
if not self.cnx is self._orig_cnx:
try:
self.cnx.close()
+ self._cnxs.remove(self.cnx)
except ProgrammingError:
pass # already closed
self.cnx = self._orig_cnx
--- a/hooks/workflow.py Tue Apr 06 20:54:35 2010 +0200
+++ b/hooks/workflow.py Fri Apr 09 15:01:14 2010 +0000
@@ -193,7 +193,7 @@
raise ValidationError(entity.eid, {None: msg})
# True if we are coming back from subworkflow
swtr = session.transaction_data.pop((forentity.eid, 'subwfentrytr'), None)
- cowpowers = ('managers' in session.user.groups
+ cowpowers = (session.user.is_in_group('managers')
or not session.write_security)
# no investigate the requested state change...
try:
--- a/web/views/iprogress.py Tue Apr 06 20:54:35 2010 +0200
+++ b/web/views/iprogress.py Fri Apr 09 15:01:14 2010 +0000
@@ -264,4 +264,4 @@
int(100.*budget/maxi), color))
self.w(u'%s<br/>'
u'<canvas class="progressbar" id="canvas%s" width="100" height="10"></canvas>'
- % (short_title.replace(' ',' '), cid))
+ % (xml_escape(short_title), cid))