Ticket #469 (assigned Enhancement)
incompatible with python-sqlparse 0.1.3 (Debian Testing)
| Reported by: | patrick.ohly@… | Owned by: | glyph@… |
|---|---|---|---|
| Priority: | 1: Blocker | Milestone: | Later |
| Component: | Calendar Server | Severity: | Other |
| Keywords: | Cc: | kurt.leubner@…, carlos@… | |
| Port: |
Description (last modified by glyph@…) (diff)
When starting the server with the system's python-sqlparse 0.1.3 instead of the version 0.1.2 that it would use as fallback, the server fails with:
File "/home/pohly/src/CalendarServer/CalendarServer/twext/enterprise/dal/parseschema.py", line 232, in nextColumn
return self.parseColumn(maybeIdent.value)
File "/home/pohly/src/CalendarServer/CalendarServer/twext/enterprise/dal/parseschema.py", line 307, in parseColumn
theType = SQLType(typeName.value.encode("utf-8"), typeLength)
AttributeError: 'NoneType' object has no attribute 'encode'
Adding some print statements showed that it fails for varchar entries:
txdav/common/datastore/sql_schema/current.sql
create table CALENDAR_HOME (
RESOURCE_ID integer primary key default nextval('RESOURCE_ID_SEQ'),
=> OWNER_UID varchar(255) not null unique
);
In python-sqlparse, typeName.value was "varchar", same as the string representation of typeName itself. Based on that observation here's a crude patch which uses str(typeName) as default. Works for me, no idea whether it is the right fix...
-
CalendarServer/twext/enterprise/dal/parseschema.py
diff --git a/CalendarServer/twext/enterprise/dal/parseschema.py b/CalendarServer/twext/enterprise/dal/parseschema.py index 0978b5f..4e3fcb1 100644
a b class _ColumnParser(object): 304 304 # something else 305 305 typeLength = None 306 306 self.pushback(maybeTypeArgs) 307 theType = SQLType( typeName.value.encode("utf-8"), typeLength)307 theType = SQLType((typeName.value or str(typeName)).encode("utf-8"), typeLength) 308 308 theColumn = self.table.addColumn( 309 309 name=name.encode("utf-8"), type=theType 310 310 )
Attachments
Change History
comment:2 Changed 18 months ago by glyph@…
Thanks for reporting this issue. The real problem here is that sqlparse doesn't have a very stable API at this point, so using the exactly required version is very important.
With your patch, does the full test suite and CalDAVTester suite pass?
comment:3 Changed 18 months ago by glyph@…
- Owner changed from wsanchez@… to glyph@…
- Status changed from new to assigned
comment:4 Changed 18 months ago by wsanchez@…
- Priority changed from 5: Not set to 1: Blocker
- Milestone set to CalendarServer-4.x
comment:10 Changed 4 months ago by wsanchez@…
Same problem as #486?
Note: See
TracTickets for help on using
tickets.

