New issue 63 by runyaga: SA 0.6 and Plone 4/CM 0.6 issue
http://code.google.com/p/contentmirror/issues/detail?id=63
Two issues:
SA.Table object not being able to evaluate to boolean:
SA/CM generating postgresql DDL was fubared
SA.Table:
line 47 of peer.py
self.transformer.table object can not be evaluated to a Boolean value.
The workaround I ended up doing was either:
if self.tranformer.table is not None
and then str(self.trasnformer.table) when it concatenates another value
(3 lines below 47)
(Pdb) !self.transformer.table
Table('atdocument', MetaData(None), Column('content_id', Integer(),
ForeignKey('content.content_id'), table=<atdocument>, primary_key=True,
nullable=False), Column('text', Text(length=None, convert_unicode=False,
assert_unicode=None, unicode_error=None, _warn_on_bytestring=False),
table=<atdocument>), Column('presentation', Boolean(create_constraint=True,
name=None), table=<atdocument>), Column('tablecontents',
Boolean(create_constraint=True, name=None), table=<atdocument>),
schema=None)
(Pdb) if self.transformer.table: print 'hi'
*** TypeError: Boolean value of this clause is not defined
DDL Foobar:
- So this is the strangest thing. 3 types were causing problems:
- Boolean, BLOB, DATETIME
Manually I ended up changing ddl from BOOLEAN to smallint (then in
pgadmin created boolean)
Then changing BLOB to bytea
Changing DATETIME to timestamp
Using latest ubuntu py2.6, paster plone3_site defining 4a3 as version with
postgresql 8.4
I think testing around this tease out this issue quickly. It does not
appear to be a CM issue. But you are faster than me in identifying the
real culprit
Regarding BOOLEAN, it could help to just change the CHECK statements. For
the usual content types, my DDL script created lines like these:
CHECK (excludefromnav IN (0, 1))
In Postgres, Boolean is represented as TRUE, 't', 'true', 'y', 'yes',
and '1' (and the opposites), so one can change these lines to
CHECK (excludefromnav IN ('0', '1'))
In my case, that helped and made the SQL statements work.
I didn't examine the code of ddl.py very closely, so I can't tell where the
wrong types BLOB and DATETIME for postgres come from - CM or SQLAlchemy?