Opened 15 years ago
Last modified 5 years ago
#5627 new defect
TicketModifiedFiles 1.00: a single quote in an modified SVN file name causes an error
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Component: | TicketModifiedFilesPlugin |
Severity: | blocker | Keywords: | patch modified files OperationalError quote |
Cc: | richard.lyders@… | Trac Release: | 0.11 |
Description (last modified by )
TicketModifiedFiles 1.00 reports error [OperationalError: near "s": syntax error] when one of modified SVN files for a ticket has name that contains a single quote [eg, "today's"]
The file name in SVN can be deleted/renamed, but the error still occurs since TicketModifiedFiles still encounters the old file name and thus still errors out. I don't know how to work around this. I simply have to turn off modified files, but I love this plugin, so I hope it gets fixed soon!
I'm not very familiar with Python. I'll see about fixing it myself as I have time to dig into it.
ERROR STACK:
Oops… Trac detected an internal error: OperationalError: near "s": syntax error If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team. Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket. Otherwise, please ==== How to Reproduce ==== While doing a GET operation on `/ticket/1351`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {'id': u'1351'} }}} User Agent was: `Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)` ==== System Information ==== || '''Trac''' || `0.12dev-r7454` || || '''Python''' || `2.5.1 (r251, Feb 13 2008, 06:34:30) ` [[br]] `[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)]` || || '''setuptools''' || `0.6c9` || || '''SQLite''' || `3.5.1` || || '''pysqlite''' || `2.3.5` || || '''Genshi''' || `0.5.1` || || '''mod_python''' || `3.3.1` || || '''Pygments''' || `1.0` || || '''Subversion''' || `1.4.6 (r28521)` || || '''jQuery:''' || `1.2.6` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 447, in _dispatch_request dispatcher.dispatch(req) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 229, in dispatch content_type) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 703, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 128, in __or__ return Stream(_ensure(function(self)), serializer=self.serializer) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 790, in inner data) File "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 72, in filter_stream numconflictingtickets = self.__process_ticket_request(req, True) File "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 153, in __process_ticket_request cursor.execute("SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change WHERE path='%s')" % file) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/util.py", line 51, in execute return self.cursor.execute(sql) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 59, in execute args or []) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 51, in _rollback_on_error return function(self, *args, **kwargs) OperationalError: near "s": syntax error }}} a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it. Python Traceback Most recent call last: * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 447, in _dispatch_request Code fragment: 442. try: 443. if not env and env_error: 444. raise HTTPInternalError(env_error) 445. try: 446. dispatcher = RequestDispatcher(env) 447. dispatcher.dispatch(req) 448. except RequestDone: 449. pass 450. resp = req._response or [] 451. 452. except HTTPException, e: Local variables: Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher object at 0x494ee2c> e OperationalError('near "s": syntax error',) env <trac.env.Environment object at 0xe316cc> env_error None exc_info (<class 'pysqlite2.dbapi2.OperationalError'>, OperationalError('near "s": ... filename '/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-p ... frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 446 message u'OperationalError: near "s": syntax error' req <Request "GET u'/ticket/1351'"> resp [] tb <traceback object at 0x5e35cac> tb_hide None traceback 'Traceback (most recent call last):\n File ... * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 229, in dispatch Code fragment: 224. pprint(data, out) 225. req.send(out.getvalue(), 'text/plain') 226. else: 227. output = chrome.render_template(req, template, 228. data, 229. content_type) 230. # Give the session a chance to persist changes 231. if req.session: 232. req.session.save() 233. 234. req.send(output, content_type or 'text/html') Local variables: Name Value chosen_handler <trac.ticket.web_ui.TicketModule object at 0x494e8cc> chrome <trac.web.chrome.Chrome object at 0x495bbcc> content_type None data {'comment': None, 'attachments': {'attach_href': ... e TypeError("'NoneType' object does not support item assignment",) err (<class 'pysqlite2.dbapi2.OperationalError'>, OperationalError('near "s": ... handler <trac.ticket.web_ui.TicketModule object at 0x494e8cc> req <Request "GET u'/ticket/1351'"> resp ('ticket.html', {'comment': None, 'attachments': {'attach_href': ... self <trac.web.main.RequestDispatcher object at 0x494ee2c> template 'ticket.html' * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 703, in render_template Code fragment: 698. 699. stream = template.generate(**data) 700. 701. # Filter through ITemplateStreamFilter plugins 702. if self.stream_filters: 703. stream |= self._filter_stream(req, method, filename, stream, data) 704. 705. if fragment: 706. return stream 707. 708. if method == 'text': Local variables: Name Value content_type 'text/html' data {'abs_url_of': <function get_abs_url at 0x7f551ec>, 'comment': None, ... filename 'ticket.html' fragment False method 'xhtml' req <Request "GET u'/ticket/1351'"> self <trac.web.chrome.Chrome object at 0x495bbcc> stream <genshi.core.Stream object at 0x3ba120c> template <MarkupTemplate "ticket.html"> * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 128, in __or__ Local variables: Name Value function <function inner at 0x7f557d4> self <genshi.core.Stream object at 0x3ba120c> * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 790, in inner Code fragment: 785. 786. def _filter_stream(self, req, method, filename, stream, data): 787. def inner(stream, ctxt=None): 788. for filter in self.stream_filters: 789. stream = filter.filter_stream(req, method, filename, stream, 790. data) 791. return stream 792. return inner 793. Local variables: Name Value ctxt None data {'abs_url_of': <function get_abs_url at 0x7f551ec>, 'comment': None, ... filename 'ticket.html' filter <ticketmodifiedfiles.ticketmodifiedfiles.TicketModifiedFilesPlugin object ... method 'xhtml' req <Request "GET u'/ticket/1351'"> self <trac.web.chrome.Chrome object at 0x495bbcc> stream <genshi.core.Stream object at 0x7f5a32c> * File "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 72, in filter_stream Local variables: Name Value data {'abs_url_of': <function get_abs_url at 0x7f551ec>, 'comment': None, ... filename 'ticket.html' method 'xhtml' req <Request "GET u'/ticket/1351'"> self <ticketmodifiedfiles.ticketmodifiedfiles.TicketModifiedFilesPlugin object ... stream <genshi.core.Stream object at 0x7f5a32c> * File "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 153, in __process_ticket_request Local variables: Name Value author u'richard.lyders' cursor <trac.db.util.IterableCursor object at 0x5e318cc> db <trac.db.pool.PooledConnection object at 0x7f5a9ac> file u"corisplus/branches/richard.lyders/trac/1351/Today's testing call.msg" files [u'corisplus/branches/richard.lyders/trac/1351', ... filestatus {} id 1351 ignored_statuses [u'closed'] justnumconflictingtickets True match <_sre.SRE_Match object at 0x7f66660> message u'#1351 moved files from #1319' node_change (u'corisplus/branches/richard.lyders/trac/1351/Todays testing call.msg', ... repos <trac.versioncontrol.cache.CachedRepository object at 0x31e4ccc> req <Request "GET u'/ticket/1351'"> rev u'3691' revisions [] self <ticketmodifiedfiles.ticketmodifiedfiles.TicketModifiedFilesPlugin object ... tempstr [u'', u' remove quote'] tempticketslist [] thisticket <trac.ticket.model.Ticket object at 0x7f5a82c> ticket 1351 ticketsperfile {u'corisplus/branches/richard.lyders/trac/1351': []} time 1249506746 validrevision True * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/util.py", line 51, in execute Code fragment: 46. # -- In case of SQL errors, uncomment the following 'print' statements 47. # print 'execute', repr(sql) 48. if args: 49. # print repr(args) 50. return self.cursor.execute(sql_escape_percent(sql), args) 51. return self.cursor.execute(sql) 52. 53. def executemany(self, sql, args=None): 54. # print 'executemany', repr(sql) 55. if args: 56. # print repr(args) Local variables: Name Value args None self <trac.db.util.IterableCursor object at 0x5e318cc> sql u"SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change ... * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 59, in execute Code fragment: 54. raise 55. def execute(self, sql, args=None): 56. if args: 57. sql = sql % (('?',) * len(args)) 58. return self._rollback_on_error(sqlite.Cursor.execute, sql, 59. args or []) 60. def executemany(self, sql, args=None): 61. if args: 62. sql = sql % (('?',) * len(args[0])) 63. return self._rollback_on_error(sqlite.Cursor.executemany, sql, 64. args or []) Local variables: Name Value args None self <trac.db.sqlite_backend.PyFormatCursor object at 0x7f6676c> sql u"SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change ... * File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 51, in _rollback_on_error Code fragment: 46. sqlite_version_string = '%d.%d.%d' % (_ver[0], _ver[1], int(_ver[2])) 47. 48. class PyFormatCursor(sqlite.Cursor): 49. def _rollback_on_error(self, function, *args, **kwargs): 50. try: 51. return function(self, *args, **kwargs) 52. except sqlite.DatabaseError, e: 53. self.cnx.rollback() 54. raise 55. def execute(self, sql, args=None): 56. if args: Local variables: Name Value args (u"SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change ... e OperationalError('near "s": syntax error',) function <method 'execute' of 'pysqlite2.dbapi2.Cursor' objects> kwargs {} self <trac.db.sqlite_backend.PyFormatCursor object at 0x7f6676c> File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 447, in _dispatch_request dispatcher.dispatch(req) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 229, in dispatch content_type) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 703, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 128, in __or__File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 790, in inner data) File "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 72, in filter_streamFile "/home/rlyders/trac/python/lib/python2.5/site-packages/TicketModifiedFiles-1.00-py2.5.egg/ticketmodifiedfiles/ticketmodifiedfiles.py", line 153, in __process_ticket_requestFile "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/util.py", line 51, in execute return self.cursor.execute(sql) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 59, in execute args or []) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/db/sqlite_backend.py", line 51, in _rollback_on_error return function(self, *args, **kwargs) System Information: User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729) Trac: 0.12dev-r7454 Python: 2.5.1 (r251, Feb 13 2008, 06:34:30) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] setuptools: 0.6c9 SQLite: 3.5.1 pysqlite: 2.3.5 Genshi: 0.5.1 mod_python: 3.3.1 Pygments: 1.0 Subversion: 1.4.6 (r28521) jQuery: 1.2.6 TracGuide — The Trac User and Administration Guide
Attachments (0)
Change History (8)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
BTW: adding the call to file = file.replace("'","") did solve the problem where the ticket couldn't even be opened. Now, a ticket can be opened/edited even if it has a modified file in svn that includes a single quote in the name, but if you click on modified files then it errors out with the following. This is less important because at least I can open the ticket, but this still is an error and I hope to look at this some time soon if I can make time for it.
@!html Oops… Trac detected an internal error: TypeError: object of type 'Undefined' has no len() If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team. Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket. Otherwise, please ==== How to Reproduce ==== While doing a GET operation on `/modifiedfiles/1351`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {'id': u'1351'} }}} User Agent was: `Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729)` ==== System Information ==== || '''Trac''' || `0.12dev-r7454` || || '''Python''' || `2.5.1 (r251, Feb 13 2008, 06:34:30) ` [[br]] `[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)]` || || '''setuptools''' || `0.6c9` || || '''SQLite''' || `3.5.1` || || '''pysqlite''' || `2.3.5` || || '''Genshi''' || `0.5.1` || || '''mod_python''' || `3.3.1` || || '''Pygments''' || `1.0` || || '''Subversion''' || `1.4.6 (r28521)` || || '''jQuery:''' || `1.2.6` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 447, in _dispatch_request dispatcher.dispatch(req) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/main.py", line 229, in dispatch content_type) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 728, in render_template return stream.render(method, doctype=doctype) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 179, in render return encode(generator, method=method, encoding=encoding, out=out) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 60, in encode return _encode(u''.join(list(iterator))) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 311, in __call__ for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 753, in __call__ for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 592, in __call__ for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 698, in __call__ for kind, data, pos in chain(stream, [(None, None, None)]): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/output.py", line 532, in __call__ for ev in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 780, in _strip_accesskeys for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Trac-0.12dev_r7454-py2.5.egg/trac/web/chrome.py", line 769, in _generate for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/markup.py", line 298, in _match ctxt, start=idx + 1, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/markup.py", line 298, in _match ctxt, start=idx + 1, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/markup.py", line 245, in _match for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 543, in _exec for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 533, in _eval for event in substream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 496, in _eval for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 551, in _flatten for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/path.py", line 141, in _generate subevent = stream.next() File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/markup.py", line 234, in _strip event = stream.next() File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 543, in _exec for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 533, in _eval for event in substream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 496, in _eval for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 551, in _flatten for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/path.py", line 141, in _generate subevent = stream.next() File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/markup.py", line 234, in _strip event = stream.next() File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 543, in _exec for event in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 533, in _eval for event in substream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 496, in _eval for kind, data, pos in stream: File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 558, in _flatten for event in self._flatten(substream, ctxt, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 558, in _flatten for event in self._flatten(substream, ctxt, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 558, in _flatten for event in self._flatten(substream, ctxt, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 558, in _flatten for event in self._flatten(substream, ctxt, **vars): File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 557, in _flatten **vars) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 272, in _apply_directives stream = directives[0](iter(stream), directives[1:], ctxt, **vars) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/directives.py", line 656, in __call__ matched = bool(_eval_expr(self.expr, ctxt, **vars)) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/base.py", line 286, in _eval_expr retval = expr.evaluate(ctxt) File "/home/rlyders/trac/python/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg/genshi/template/eval.py", line 180, in evaluate return eval(self.code, _globals, {'__data__': data}) File "/home/rlyders/trac/projects/.egg-cache/TicketModifiedFiles-1.00-py2.5.egg-tmp/ticketmodifiedfiles/templates/ticketmodifiedfiles.html", line 34, in <Expression u'ticketisclosed == False and len(ticketsperfile[filename]) > 0'> <py:when test="ticketisclosed == False and len(ticketsperfile[filename]) > 0"> TypeError: object of type 'Undefined' has no len() }}} a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it. Python Traceback Most recent call last: * File "/home/rlyders/trac/projects/.egg-cache/TicketModifiedFiles-1.00-py2.5.egg-tmp/ticketmodifiedfiles/templates/ticketmodifiedfiles.html", line 34, in <Expression u'ticketisclosed == False and len(ticketsperfile[filename]) > 0'> > 0"> 35. (ticket<py:choose><py:when test="len(ticketsperfile[filename]) > 1">s</py:when></py:choose> <py:for each="relticketid in ticketsperfile[filename]"><py:choose><py:when test="relticketid != ticketsperfile[filename][0] and relticketid != ticketsperfile[filename][-1]">, </py:when></py:choose><py:choose><py:when test="relticketid != ticketsperfile[filename][0] and relticketid == ticketsperfile[filename][-1]"> and </py:when></py:choose></py:for>) 36. </py:when> 37. </py:choose> 38. </span> 39. </li> Local variables: Name Value __data__ [{'filename': u"corisplus/branches/richard.lyders/trac/1351/Today's ... File "/home/rlyders/trac/projects/.egg-cache/TicketModifiedFiles-1.00-py2.5.egg-tmp/ticketmodifiedfiles/templates/ticketmodifiedfiles.html", line 34, in <Expression u'ticketisclosed == False and len(ticketsperfile[filename]) > 0'> <py:when test="ticketisclosed == False and len(ticketsperfile[filename]) > 0"> System Information: User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13 (.NET CLR 3.5.30729) Trac: 0.12dev-r7454 Python: 2.5.1 (r251, Feb 13 2008, 06:34:30) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] setuptools: 0.6c9 SQLite: 3.5.1 pysqlite: 2.3.5 Genshi: 0.5.1 mod_python: 3.3.1 Pygments: 1.0 Subversion: 1.4.6 (r28521) jQuery: 1.2.6 TracGuide — The Trac User and Administration Guide
comment:3 Changed 15 years ago by
Status: | new → assigned |
---|
Thanks for your report Richard. This bug seems logical, because of this single ' in the filename. I am not really able to work on this project right now, but I'll try to fix it as soon as possible.
comment:4 Changed 14 years ago by
Keywords: | patch added |
---|
comment:5 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:6 Changed 14 years ago by
Owner: | changed from Emilien Klein to Ryan J Ollos |
---|---|
Status: | assigned → new |
Reassigning as part of maintainership transfer of TicketModifiedFiles to rjollos.
comment:7 Changed 14 years ago by
To avoid SQL injection problems, you should probably do something like this:
@@ -112,7 +112,10 @@ class TicketModifiedFilesPlugin(Component): db = self.env.get_read_db() cursor = db.cursor() #Retrieve all the revisions which's messages contain "#<TICKETID>" - cursor.execute("SELECT rev, time, author, message FROM revision WHERE message LIKE '%%#%s%%'" % id) + # parameter substitution will format %s into ? (or other + # database API specific place holder), so other % chars have + # to be escaped + cursor.execute("SELECT rev, time, author, message FROM revision WHERE message LIKE %s", ('%%#%s%%' % id,)) repos = self.env.get_repository() for rev, time, author, message, in cursor: #Filter out non-related revisions. @@ -153,7 +156,7 @@ class TicketModifiedFilesPlugin(Component): #Get the list of conflicting tickets per file tempticketslist = [] - cursor.execute("SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change WHERE path='%s')" % file) + cursor.execute("SELECT message FROM revision WHERE rev IN (SELECT rev FROM node_change WHERE path=%s)", (file,)) for message, in cursor: #Extract the ticket number match = re.search(r'#([0-9]+)', message)
comment:8 Changed 5 years ago by
Owner: | Ryan J Ollos deleted |
---|
From what I gather the "file" parameter to line # 153 in ticketmodifiedfiles.py needs to have any single-quotes converted to two successive single-quotes so that the SQL command is valid. Currently a filename of "Today's" causes an error because is results in the following bad SQL:
BAD SQL:
Here is what the CORRECTED SQL would look like if the single-quote in the "file" parameter was properly prepared for use by SQL:
so, to fix this, the "file" parameter should be have a simple replace run against it before being passed to SQL: