# HG changeset patch # User Alexandre Fayolle # Date 1321894698 -3600 # Node ID 7e0d1fb1092dba9a97bfa93c1ba835396b10d2c8 # Parent e1b21db042d626ae1284d6ac7363a0b91dabba6f use dbhelper functions to get default date / datetime (closes #2094544) diff -r e1b21db042d6 -r 7e0d1fb1092d __pkginfo__.py --- a/__pkginfo__.py Tue Nov 22 11:26:06 2011 +0100 +++ b/__pkginfo__.py Mon Nov 21 17:58:18 2011 +0100 @@ -52,7 +52,7 @@ 'Twisted': '', # XXX graphviz # server dependencies - 'logilab-database': '>= 1.5.0', + 'logilab-database': '>= 1.8.1', 'pysqlite': '>= 2.5.5', # XXX install pysqlite2 } diff -r e1b21db042d6 -r 7e0d1fb1092d debian/control --- a/debian/control Tue Nov 22 11:26:06 2011 +0100 +++ b/debian/control Mon Nov 21 17:58:18 2011 +0100 @@ -35,7 +35,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.5.0), 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.8.1), 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. diff -r e1b21db042d6 -r 7e0d1fb1092d hooks/syncschema.py --- a/hooks/syncschema.py Tue Nov 22 11:26:06 2011 +0100 +++ b/hooks/syncschema.py Mon Nov 21 17:58:18 2011 +0100 @@ -484,6 +484,11 @@ # set default value, using sql for performance and to avoid # modification_date update if default: + if rdefdef.object in ('Date', 'Datetime'): + if default == 'TODAY': + default = syssource.dbhelper.sql_current_date() + elif default == 'NOW': + default = syssource.dbhelper.sql_current_timestamp() session.system_sql('UPDATE %s SET %s=%%(default)s' % (table, column), {'default': default})