Projects
Wiki     Timeline     Roadmap     Browse Source     View Tickets     New Ticket     Search

Ticket #469 (assigned Enhancement)

Opened 18 months ago

Last modified 4 months ago

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): 
    304304                # something else 
    305305                typeLength = None 
    306306                self.pushback(maybeTypeArgs) 
    307         theType = SQLType(typeName.value.encode("utf-8"), typeLength) 
     307        theType = SQLType((typeName.value or str(typeName)).encode("utf-8"), typeLength) 
    308308        theColumn = self.table.addColumn( 
    309309            name=name.encode("utf-8"), type=theType 
    310310        ) 

Attachments

patch (693 bytes) - added by patrick.ohly@… 18 months ago.

Change History

Changed 18 months ago by patrick.ohly@…

comment:1 Changed 18 months ago by glyph@…

  • Description modified (diff)

Fixing formatting.

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:5 Changed 8 months ago by mail@…

btw. issue #486 modifies the same line of code.

comment:6 Changed 6 months ago by kurt.leubner@…

  • Cc kurt.leubner@… added

Cc Me!

comment:7 Changed 6 months ago by kurt.leubner@…

  • Cc kurt.leubner@… removed

Cc Me!

comment:8 Changed 6 months ago by kurt.leubner@…

  • Cc kurt.leubner@… added

Cc Me!

comment:9 Changed 4 months ago by wsanchez@…

  • Milestone changed from CalendarServer-4.x to Later

comment:10 Changed 4 months ago by wsanchez@…

Same problem as #486?

comment:11 Changed 4 months ago by carlos@…

  • Cc carlos@… added

Cc Me!

Note: See TracTickets for help on using tickets.