--- a/server/sqlutils.py Thu Jan 21 11:02:36 2010 +0100
+++ b/server/sqlutils.py Thu Jan 21 11:08:41 2010 +0100
@@ -8,6 +8,7 @@
__docformat__ = "restructuredtext en"
import os
+import subprocess
from os.path import exists
from warnings import warn
from datetime import datetime, date, timedelta
@@ -173,7 +174,7 @@
cmd = self.dbhelper.backup_command(self.dbname, self.dbhost,
self.dbuser, backupfile,
keepownership=False)
- if os.system(cmd):
+ if subprocess.call(cmd):
raise Exception('Failed command: %s' % cmd)
def restore_from_file(self, backupfile, confirm, drop=True):
@@ -182,7 +183,7 @@
self.encoding,
keepownership=False,
drop=drop):
- if os.system(cmd):
+ if subprocess.call(cmd):
print '-> Failed command: %s' % cmd
if not confirm('Continue anyway?', default='n'):
raise Exception('Failed command: %s' % cmd)
--- a/web/views/formrenderers.py Thu Jan 21 11:02:36 2010 +0100
+++ b/web/views/formrenderers.py Thu Jan 21 11:08:41 2010 +0100
@@ -27,6 +27,14 @@
return u'<input type="checkbox" name="%s" value="%s" %s %s />' % (
name, value, checked, attrs)
+def field_label(form, field):
+ # XXX with 3.6 we can now properly rely on 'if field.role is not None' and
+ # stop having a tuple for label
+ if isinstance(field.label, tuple): # i.e. needs contextual translation
+ return form._cw.pgettext(*field.label)
+ return form._cw._(field.label)
+
+
class FormRenderer(AppObject):
"""basic renderer displaying fields in a two columns table label | value
@@ -93,10 +101,7 @@
def render_label(self, form, field):
if field.label is None:
return u''
- if isinstance(field.label, tuple): # i.e. needs contextual translation
- label = self._cw.pgettext(*field.label)
- else:
- label = self._cw._(field.label)
+ label = field_label(form, field)
attrs = {'for': field.dom_id(form)}
if field.required:
attrs['class'] = 'required'
@@ -307,7 +312,7 @@
title=self._cw._('toggle check boxes'),
onclick="setCheckboxesState('eid', this.checked)"))
for field in subfields:
- w(u'<th>%s</th>' % self._cw._(field.label))
+ w(u'<th>%s</th>' % field_label(form, field))
w(u'</tr>')
super(EntityCompositeFormRenderer, self).render_fields(w, form, values)
if form.parent_form is None: