[ckan-changes] commit/ckan: kindly: [model] add support for sqlite

Bitbucket commits-noreply at bitbucket.org
Fri Jun 17 23:55:47 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/1faf1ad8fc5c/
changeset:   1faf1ad8fc5c
branch:      feature-1141-moderated-edits-ajax
user:        kindly
date:        2011-06-18 01:33:06
summary:     [model] add support for sqlite
affected #:  4 files (87 bytes)

--- a/ckan/lib/dictization/model_dictize.py	Fri Jun 17 23:52:39 2011 +0100
+++ b/ckan/lib/dictization/model_dictize.py	Sat Jun 18 00:33:06 2011 +0100
@@ -90,7 +90,7 @@
         q = q.where(rev_table.c.revision_timestamp <= revision_date)
         q = q.where(rev_table.c.expired_timestamp > revision_date)
     elif pending:
-        q = q.where(rev_table.c.expired_timestamp == '9999-12-31')
+        q = q.where(rev_table.c.expired_timestamp == datetime.datetime(9999, 12, 31))
     else:
         q = q.where(rev_table.c.current == True)
 


--- a/ckan/logic/action/update.py	Fri Jun 17 23:52:39 2011 +0100
+++ b/ckan/logic/action/update.py	Sat Jun 18 00:33:06 2011 +0100
@@ -80,7 +80,7 @@
         old_current.current = False
         session.add(old_current)
 
-    latest_rev = q.filter_by(expired_timestamp='9999-12-31').one()
+    latest_rev = q.filter_by(expired_timestamp=datetime.datetime(9999, 12, 31)).one()
     latest_rev.current = True
     if latest_rev.state in ('pending-deleted', 'deleted'):
         latest_rev.state = 'deleted'


--- a/ckan/model/core.py	Fri Jun 17 23:52:39 2011 +0100
+++ b/ckan/model/core.py	Sat Jun 18 00:33:06 2011 +0100
@@ -29,12 +29,13 @@
 
 
 def make_revisioned_table(table):
+    import datetime
     revision_table = vdm.sqlalchemy.make_revisioned_table(table)
     revision_table.append_column(Column('expired_id', 
                                  Text))
     revision_table.append_column(Column('revision_timestamp', DateTime))
     revision_table.append_column(Column('expired_timestamp', DateTime, 
-                                 default='9999-12-31'))
+                                 default=datetime.datetime(9999, 12, 31)))
     revision_table.append_column(Column('current', Boolean))
     return revision_table
 


--- a/ckan/model/meta.py	Fri Jun 17 23:52:39 2011 +0100
+++ b/ckan/model/meta.py	Sat Jun 18 00:33:06 2011 +0100
@@ -61,7 +61,7 @@
                     session.add(old)
 
             q = session.query(revision_cls)
-            q = q.filter_by(expired_timestamp='9999-12-31', id=obj.id)
+            q = q.filter_by(expired_timestamp=datetime(9999, 12, 31), id=obj.id)
             results = q.all()
 
             for rev_obj in results:

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list