Opened 4 years ago
Last modified 4 years ago
#13847 new defect
Exception "Invalid query constraint value"
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | WikiCalendarMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.4 |
Description
I am upgrading my Trac server from 0.12 to the latest, 1.4.2. I have used WikiCalendar for a long time, and now apparently WikiTicketCalendar comes with it. I tried using it, but there was a problem. Note: The Trac instance is a new scratch environment with a couple test tickets and such.
FYI, I am using "trunk" of WikiCalendar as of today.
Attempting one of the example invocations:
[[WikiTicketCalendar(*,*,true,/Meeting-%Y-%m-%d)]]
... I get an exception:
QueryValueError: Invalid query constraint value
I'm not adept enough at Trac plugin development to fully understand what might actually be going wrong, but in a small amount of debugging it seems that at least some query passes succeed, and they appear to have similar (or the same) query string ...
As a work-around, I caught the exception. The calendar appears and the day with a log entry (I added one with the WikiCalendar to test it) is red, as I would expect. I'm not sure if other features of WikiTicketCalendar are being lost, since I'm really not familiar with it yet.
Here is the work-around I placed in ticket.py in order to make it (appear to) work:
try: result = query.execute(req) except: result = []
Attachments (3)
Change History (16)
comment:1 Changed 4 years ago by
Owner: | set to Ryan J Ollos |
---|---|
Status: | new → accepted |
Changed 4 years ago by
Attachment: | wikiticketcalendar_patch_for_trac_142.patch added |
---|
Changed 4 years ago by
Attachment: | wikiticketcalendar_div_patch_for_trac_142.patch added |
---|
Sorry for the chatter, but I found a better solution to the tag issue here. The new Trac "tag" feature needs a proper tag name. The failure came where no tag was used/needed, so I tried "div". Seems fine, I guess.
Changed 4 years ago by
For reference (FWIW), I am enclosing the simplistic Blog plugin I'm using with the WikiCalendarMacro.
comment:3 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Thanks for raising the issue. Looks like some code wasn't modified correctly when WikiTicketCalendarMacro was integrated.
comment:4 follow-ups: 8 11 Changed 4 years ago by
... And thanks for helping with this.
My system will not accept a colon as a date/time separator. It seems that ".."
does work, though. Apparently it does not on your system, as you left out that part of the patch. When I looked at this before, the items that were being joined already had a lot of colons in the strings. Is this a locale issue? I'm just guessing.
if name == 'WikiTicketCalendar': daystr = ('..').join([ format_datetime(first_day, locale=locale), format_datetime(last_day, locale=locale)]) provider = WikiCalendarTicketProvider(env)
Also, I think you inadvertently left a print
statement in ticket.py
query_string += '&cols=%s' % cols print(query_string) query = Query.from_string(self.env, query_string)
comment:5 Changed 4 years ago by
For instance, I see from this section:
... That two dots are used as the range delimiter for time variables in query strings:
created=2007-01-01..2008-01-01 | query tickets created in 2007 |
comment:6 Changed 4 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 Changed 4 years ago by
Replying to anonymous:
My system will not accept a colon as a date/time separator. It seems that
".."
does work, though.
What is the error message (preferably a traceback from the log)?
comment:9 Changed 4 years ago by
This is the original cause of the ticket itself -- this range separator character.
2020-08-26 09:19:42,849 Trac[formatter] ERROR: Macro WikiTicketCalendar(*,*,true,/Dan/Blog/Meeting-%Y-%m-%d) failed for <Resource u'wiki:Dan/MacroTest'>: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py", line 818, in _macro_formatter return macro.ensure_inline(macro.process(args), in_paragraph) File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py", line 389, in process text = self.processor(text) File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py", line 361, in _macro_processor text) File "/mnt/c/Users/dmahn/ApacheTest/conf/trac/plugins/expanded/WikiCalendarMacro-2.2.0.dev0-py2.7.egg/wikicalendar/macros.py", line 491, in expand_macro '='.join(['created', daystr])) File "/mnt/c/Users/dmahn/ApacheTest/conf/trac/plugins/expanded/WikiCalendarMacro-2.2.0.dev0-py2.7.egg/wikicalendar/ticket.py", line 61, in harvest result = query.execute(req) File "/usr/local/lib/python2.7/dist-packages/trac/ticket/query.py", line 301, in execute sql, args = self.get_sql(req, cached_ids, authname, tzinfo, locale) File "/usr/local/lib/python2.7/dist-packages/trac/ticket/query.py", line 712, in get_sql raise QueryValueError(errors) QueryValueError: Invalid query constraint value
comment:10 Changed 4 years ago by
In query.py, starting at line 513, I see use of the ".." separator:
if name in self.time_fields: if not value: clause = "COALESCE({0},''){1}=%s" \ .format(col, '!' if neg else '') args = [''] return clause, args if '..' in value: (start, end) = [each.strip() for each in value.split('..', 1)] else: (start, end) = (value.strip(), '') start = user_parse_date(start) end = user_parse_date(end)
comment:11 Changed 4 years ago by
comment:12 Changed 4 years ago by
Would be useful to know output of:
$ locale LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL=
comment:13 Changed 4 years ago by
Owner: | Ryan J Ollos deleted |
---|---|
Status: | reopened → new |
I'll return to ticket if there is more info provided.
Apparent fixes for invalid constraint value as well as a further issue regarding "tag" needing to be callable.