Roundup Tracker - Issues

Issue 2551129

classification
Template not found return 500
Type: behavior Severity: normal
Components: Web interface Versions: 2.0.0
process
Status: fixed fixed
:
: rouilj : ced, rouilj
Priority: normal : patch

Created on 2021-04-16 07:29 by ced, last changed 2021-04-19 15:26 by rouilj.

Files
File name Uploaded Description Edit Remove
roundup-template-notfound.patch ced, 2021-04-16 07:29
Messages
msg7199 Author: [hidden] (ced) Date: 2021-04-16 07:29
We got frequently this exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/roundup/cgi/client.py", line 719, in inner_main
    self.write_html(self.renderContext())
  File "/usr/lib/python3.8/site-packages/roundup/cgi/client.py", line 1866, in renderContext
    tplname = self.selectTemplate(self.classname, self.template)
  File "/usr/lib/python3.8/site-packages/roundup/cgi/client.py", line 1859, in selectTemplate
    raise templating.NoTemplate('No template file exists for templating '
roundup.cgi.templating.NoTemplate: No template file exists for templating "issue" with template "calendar" (neither "issue.calendar" nor "_generic.calendar")


I think it is due to crawling bot but they keep trying because roundup return a status 500.
I think the NoTemplate exception should be catch in renderContext also when calling selectTemplate, here is a patch that does that.
msg7203 Author: [hidden] (rouilj) Date: 2021-04-19 01:02
Hello Cedric:

Applied in rev 6382:b35a50d02890.

Thanks for this patch. You are correct selectTemplate should
be included in the try. The try that you moved to include
selectTemplate includes an except templating.NoTemplate
handler already.

So it looks like that selectTemplate call was just incorrectly
placed.

I applied your patch. I also modified the except NoTemplate clause
to return a 400 response. With just your patch it returned a 200
code to the client which isn't right as the client is sending garbage.

I dusted off a test I have been working on for this case. Was going
to create the test first then fix the issue.

IIUC crawlers usually just follow existing links. Any idea how
they are ending up with the invalid template value? Is roundup
generating a broken template seeing somewhere? Do you have any
idea how this is happening? I see it on the crawlers for my demo
instance as well. It looks like it i using @template=empty.
msg7206 Author: [hidden] (ced) Date: 2021-04-19 13:23
On 2021-04-19 01:02, John Rouillard wrote:
> IIUC crawlers usually just follow existing links. Any idea how
> they are ending up with the invalid template value? Is roundup
> generating a broken template seeing somewhere? Do you have any
> idea how this is happening? I see it on the crawlers for my demo
> instance as well. It looks like it i using @template=empty.

For us it is crawling issue with calendar template which existed in
older version but no more since we migrated to jinja2 template.
msg7208 Author: [hidden] (rouilj) Date: 2021-04-19 15:26
Interesting. So it was a valid template which explains how the
bad template is being generated.

I'll close this now.

Have a great week.
History
Date User Action Args
2021-04-19 15:26:31rouiljsetstatus: open -> fixed
messages: + msg7208
2021-04-19 13:23:02cedsetmessages: + msg7206
2021-04-19 01:02:52rouiljsetstatus: new -> open
assignee: rouilj
resolution: fixed
messages: + msg7203
nosy: + rouilj
2021-04-16 07:29:12cedcreate