Opened 13 years ago
Closed 8 years ago
#9908 closed defect (fixed)
TeamCalendarPlugin works partially
Reported by: | Owned by: | Chris Nelson | |
---|---|---|---|
Priority: | high | Component: | TeamCalendarPlugin |
Severity: | major | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description (last modified by )
Hi,
I have instaleld TeamCalendarPlugin and edited the trac.db with sqlite3 as instructed. The new tab "Team Calendar" showed up on the top right corner as promised.
When I go there and select the dates for users then I click "Apply Changes" button I get the following error message:
Most recent call last: File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.6/site-packages/teamcalendar-0.1-py2.6.egg/teamcalendar/calendar.py", line 246, in process_request self.update_timetable(tuples) File "/usr/lib/python2.6/site-packages/teamcalendar-0.1-py2.6.egg/teamcalendar/calendar.py", line 168, in update_timetable flat) File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/util.py", line 65, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 78, in execute result = PyFormatCursor.execute(self, *args) File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 56, in execute args or []) File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 48, in _rollback_on_error return function(self, *args, **kwargs)
Here is some info about the system: Trac 0.12.2 Babel 0.9.4 Docutils 0.6 Genshi 0.6 Pygments 1.1.1 pysqlite 2.6.3 Python 2.6.6 (r266:84292, Dec 7 2011, 20:38:36) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] pytz 2010h setuptools 0.6 SQLite 3.6.20 Subversion 1.6.11 (r934486) jQuery: 1.4.2 Installed Plugins: Default-CC 0.1 /usr/lib/python2.6/site-packages/Default_CC-0.1-py2.6.egg teamcalendar 0.1 /usr/lib/python2.6/site-packages/teamcalendar-0.1-py2.6.egg TracPrivateTickets 2.0.3 /usr/lib/python2.6/site-packages/TracPrivateTickets-2.0.3-py2.6.egg TracTicketDelete 2.0.1 /usr/lib/python2.6/site-packages/TracTicketDelete-2.0.1-py2.6.egg
Attachments (0)
Change History (11)
comment:1 Changed 13 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
Status: | new → assigned |
---|
I don't have an 0.12 Trac installation to test in (though I may set one up soon). Please try this with the current code just to be sure it's still there.
comment:4 Changed 13 years ago by
Hi Chris,
thank you for getting back to me. I have tried as you have suggested but still getting:
Oops… Trac detected an internal error: OperationalError: near ",": syntax error
Python Traceback Most recent call last: File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/web/main.py", line 237, in dispatch File "/usr/lib/python2.6/site-packages/teamcalendar-0.1-py2.6.egg/teamcalendar/calendar.py", line 246, in process_request File "/usr/lib/python2.6/site-packages/teamcalendar-0.1-py2.6.egg/teamcalendar/calendar.py", line 168, in update_timetable File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/util.py", line 65, in execute File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 78, in execute File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 56, in execute File "/usr/lib/python2.6/site-packages/Trac-0.12.2-py2.6.egg/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
comment:5 Changed 13 years ago by
That section of code was changes recently in an attempt to be DB-agnostic:
valuesClause = ','.join(('(%s,%s,%s)',) * len(inserts)) # FIXME - we likely want to do this earlier on all of tuples. inserts = [(t[0], t[1], t[2] and 1 or 0) for t in inserts] # Quickly flatten the list. List comprehension is always # weird. See http://stackoverflow.com/questions/952914 flat = [item for sublist in inserts for item in sublist] insert_cursor.execute("INSERT INTO %s " % self.table_name + \ "(ondate, username, availability) " + \ "VALUES %s" % valuesClause, flat)
It appears to be choking on the ',' after valuesClause
. But I don't know why. Perhaps it's a difference between the 0.11 DBAPI here and 0.12 you are using.
comment:6 Changed 12 years ago by
Kindly I'm getting the exact same errors as mentioned above with Trac 0.12.3, any update on this will be most appreciated. Thank you, Miller
comment:7 Changed 12 years ago by
Issue occurs for me as well on Trac 0.11.7, Python 2.5.2 and sqlite.
comment:8 Changed 12 years ago by
comment:9 follow-up: 10 Changed 11 years ago by
I had the same problem with calendar.py using Trac 0.11.7, Python 2.6 and sqlite3. The removed line break as suggested by ChrisNelson did not solve the problem. Instead, I changed calendar.py as follows:
I removed:
flat = [item for sublist in inserts for item in sublist] insert_cursor.execute("INSERT INTO %s " % self.table_name + \ "(ondate, username, availability) " + \ "VALUES %s" % valuesClause, flat)
and instead inserted
for i in inserts: insert_cursor.execute("INSERT INTO %s " % self.table_name + "(ondate, username, availability) " + "VALUES (%s,%s,%s)", i)
That is, each checked box is inserted into the database in a single command and not all together. Might be slower but at least works.
comment:10 Changed 11 years ago by
I changed the insert part to
if len(inserts): insert_cursor = db.cursor() for entry in inserts: entry_ = (entry[0], entry[1], entry[2] and 1 or 0) insert_cursor.execute("INSERT INTO %s " % self.table_name + "(ondate, username, availability) " + "VALUES (%s,%s,%s) " % entry_)
because this seems simpler. I did not add the code to trac hacks repository. However, now I get problems for trac users that do not have the TEAMCALENDAR_UPDATE_OTHERS permission. For such users the error "OperationalError: no such column: <user>" occurs. Anyone an idea why and how I can restrict the permissions?
(In [11434]) Add setup configuration to tag build with SVN version. Refs #9908.