Roundup Tracker - Issues

Issue 2551126

AttributeError: 'str' object has no attribute 'local'
Type: crash Severity: major
Components: Web interface Versions: 1.6.1, 1.6
Status: pending
: rouilj : reda, rouilj
Priority: high : patch

Created on 2021-04-08 07:15 by reda, last changed 2021-09-12 02:17 by rouilj.

File name Uploaded Description Edit Remove
templating_py_patch-r1.6.1.patch rouilj, 2021-04-11 02:39 patch to fix traceback against 1.6.1.
msg7173 Author: [hidden] (reda) Date: 2021-04-08 07:15
I am using roundup 1.6.1 and i get the following exception with the Date property "chiffrageDelai":

<type 'exceptions.AttributeError'> : 'str' object has no attribute 'local'

Les informations de déboguage suivent

    Dans python expression "context.chiffrageDelai.pretty('%Y-%m-%d')"
    Lors de l'évaluation de l'expression à la ligne 485
    Variables actuelles :
    config 	<roundup.configuration.CoreConfig instance at 0x7fe2cd32ca70>
    context 	<HTMLItem(0x7fe2cad4a8d0) issue 30774>
    db 	<roundup.cgi.templating.HTMLDatabase instance at 0x7fe2cad595a8>
    default 	<roundup.cgi.PageTemplates.TALES.Default instance at 0x7fe2cd42d050>
    false 	0
    i18n 	<roundup.cgi.TranslationService.TranslationService instance at 0x7fe2cb47f248>
    loop 	<roundup.cgi.PageTemplates.TALES.SafeMapping instance at 0x7fe2cad595f0>
    nothing 	None
    options 	{'ok_message': [], 'error_message': ['Erreur de modification\xc2\xa0: Cl\xc3\xa9 doc incorrecte : sans']}
    repeat 	<roundup.cgi.PageTemplates.TALES.SafeMapping instance at 0x7fe2cad595f0>
    request 	<HTMLRequest {'_context': None, 'startwith': 0, 'show': < instance at 0x7fe2cad59560>, 'classname': 'issue', 'special_char': '@', 'dispname': None, 'group': [], '_client': <roundup.cgi.client.Client instance at 0x7fe2cb45eb48>, 'template': 'item', 'input': <function input_html4 at 0x7fe2cd3d8398>, 'columns': [], 'sort': [], 'env': {'CONTENT_LENGTH': '4030', 'HTTP_AUTHORIZATION': None, 'SERVER_PORT': '8080', 'SERVER_NAME': '', 'HTTP_COOKIE': 'roundup_session_REX=MTYxNDk2NDQwMy41NjAuMDQwMDI5NjY0NzM0OA', 'HTTP_X_FORWARDED_FOR': '', 'HTTP_ACCEPT_LANGUAGE': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', 'HTTP_REFERER': '', 'HTTP_X_FORWARDED_HOST': '', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'POST', 'HTTP_HOST': '', 'PATH_INFO': 'issue30774', 'CONTENT_TYPE': 'multipart/form-data; boundary=---------------------------36321429803449636767669947981', 'TRACKER_NAME': 'rex', 'HTTP_ORIGIN': ''}, 'form': FieldStorage(None, None, [FieldStorage('@template', None, 'item'), FieldStorage('title', None, 'foating point error'), FieldStorage('priority', None, '2'), FieldStorage('type', None, '1'), FieldStorage('status', None, '5'), FieldStorage('produit', None, '3'), FieldStorage('version', None, '85'), FieldStorage('nosy', None, 'jerome'), FieldStorage('projet', None, '1'), FieldStorage('validReal', None, 'yes'), FieldStorage('versCible', None, '-1'), FieldStorage('assignedto', None, '728'), FieldStorage('intervenant', None, '3'), FieldStorage('etatIntervenant', None, '3'), FieldStorage('chiffrageCharge', None, '0.5'), FieldStorage('chiffrageDelai', None, '2021-03-25'), FieldStorage('realiseCharge', None, '0.5'), FieldStorage('realiseDelai', None, '2021-03-25'), FieldStorage('validation', None, 'test fourni'), FieldStorage('corrVexpl', None, 'no'), FieldStorage('fauxVexpl', None, ''), FieldStorage('corrVdev', None, 'no'), FieldStorage('fauxVdev', None, ''), FieldStorage('impactDoc', None, 'sans objet'), FieldStorage('nbJours', None, '0.5'), FieldStorage('@note', None, ''), FieldStorage('@file', '', ''), FieldStorage('@file@comment', None, ''), FieldStorage('@lastactivity', None, '2021-03-26.15:30:00'), FieldStorage('@csrf', None, '8df2abf461f1eb851382cd3a88b0b3b6e35eca8519bed2356315b5088bcda918'), FieldStorage('@action', None, 'edit'), FieldStorage('submit_button', None, 'Soumettre les changements')]), 'nodeid': '30774', 'base': '', 'user': <HTMLItem(0x7fe2cad4a690) user 728>, 'search_text': None, 'pagesize': 50, 'language': ['fr', 'fr_FR', 'en_US', 'en'], 'filterspec': {}, 'filter': [], 'client': <roundup.cgi.client.Client instance at 0x7fe2cb45eb48>}>
    template 	<roundup.cgi.engine_zopetal.RoundupPageTemplate instance at 0x7fe2cb783050>
    templates 	<roundup.cgi.engine_zopetal.Loader instance at 0x7fe2cd426ea8>
    tracker 	<roundup.instance.Tracker instance at 0x7fe2cd32c9e0>
    true 	1
    utils 	<roundup.cgi.templating.TemplatingUtils instance at 0x7fe2cad59518>
    admin 	True
    attrs 	{'tal:condition': 'python:context.chiffrageDelai.isset()', 'name': 'chiffrageDelai', 'tal:attributes': "value python:context.chiffrageDelai.pretty('%Y-%m-%d')"}
    columns_emises 	'priority,type,id,creation,title,creator,produit,version,status'
    columns_enregistres 	'priority,type,id,creation,title,creator,produit,version,assignedto,status'
    columns_showall 	'priority,type,id,creation,title,creator,produit,version,assignedto,status'
    creator 	False
    edit_chif_pipe 	True
    edit_etat_pipe 	True
    edit_issue 	True
    edit_pipe 	True
    edit_real_pipe 	True
    fixer 	True
    inter 	False
    is_edf 	True
    status_notresolved 	'-1,1,2,3,4,5,6,7'
    view_chif_pipe 	True
    view_real_pipe 	True
    Un problème est apparu dans votre modèle « issue.item.html ».

Historique complet :

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/", line 1647, in renderContext
    result = pt.render(self, None, None, **args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/", line 92, in render
    getEngine().getContext(c), output, tal=1, strictinsert=0)()
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 192, in __call__
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 666, in do_useMacro
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 411, in do_optTag_tal
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 396, in do_optTag
    return self.no_tag(start, program)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 391, in no_tag
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 689, in do_defineSlot
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 632, in do_condition
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 632, in do_condition
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 632, in do_condition
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 632, in do_condition
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 236, in interpret
    handlers[opcode](self, args)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 293, in do_startTag
    ok, name, s = attrAction(self, item)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/TAL/", line 359, in attrAction_tal
    evalue = self.engine.evaluateText(item[3])
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/PageTemplates/", line 231, in evaluateText
    text = self.evaluate(expr)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/PageTemplates/", line 225, in evaluate
    return expression(self)
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/PageTemplates/", line 67, in __call__
    return f()
  File "<string>", line 2, in f
  File "/usr/local/lib/python2.7/dist-packages/roundup/cgi/", line 1958, in pretty
    return self._value.local(offset).pretty(format)

How can i fix this ?
msg7174 Author: [hidden] (rouilj) Date: 2021-04-08 15:44
Hello reda:

This does looks like a bug.

However the bug was triggered by an error in your form. It reports as:

  Erreur de modification\xc2\xa0: Cl\xc3\xa9 doc incorrecte : sans

I am not able to understand what failed.

Because of this error the string submitted as the value
of chiffrageDelai was not converted into a date. So calling
local on it failed.

Fixing the issue that caused the initial error would remove the trigger
for the failure.

Changing context.chiffrageDelai.pretty('%Y-%m-%d') to plain() will 
succeed even if the trigger is present.

I started a discussion on the developer mailing list on the best
way to fix this. You can view the archive at:

The next version 2 release (mid July) will include the fix.
I do not expect there to be any more releases in the 1.6 line.
So I will also generate a patch for 1.6.1 that you can apply to
fix this issue.

Hopefully we will have a patch by next week.

Have a great day.

-- rouilj
msg7180 Author: [hidden] (reda) Date: 2021-04-09 07:27
Hello Rouilj,

Thank you for your help. I will wait for the patch. 

best regards,
msg7183 Author: [hidden] (rouilj) Date: 2021-04-11 02:02
Hi Reda:

Can you verify that the error message I reported was valid?

Please try the same update that caused the error after fixing
the error. Can you verify that the exception doesn't happen.

I just want to make sure I have diagnosed the cause of the error


-- rouilj
msg7184 Author: [hidden] (rouilj) Date: 2021-04-11 02:39
Hi reda:

Can you try this patch after testing with input that
doesn't trigger the error.

Then with this patch applied, please test with the same input
that caused the error.

Here is the patch against 1.6.1.


-- rouilj
msg7185 Author: [hidden] (rouilj) Date: 2021-04-11 02:40
Fix for this is on the main branch as rev 6377:a7e7314fb7d9.
msg7197 Author: [hidden] (reda) Date: 2021-04-15 08:21
Hi rouilj,

Thank u for the patch, i will not be able to test this week. I ll let you know next week. 

Best regards,
msg7343 Author: [hidden] (rouilj) Date: 2021-09-12 02:17
Reda, did you test the patch? It is in release 2.1.0 so if it needs more work
I would like to know.
Date User Action Args
2021-09-12 02:17:09rouiljsetmessages: + msg7343
2021-04-15 08:21:09redasetmessages: + msg7197
2021-04-11 02:41:43rouiljsetstatus: open -> pending
2021-04-11 02:40:42rouiljsetmessages: + msg7185
2021-04-11 02:39:45rouiljsetfiles: + templating_py_patch-r1.6.1.patch
keywords: + patch
messages: + msg7184
2021-04-11 02:02:21rouiljsetmessages: + msg7183
2021-04-09 07:27:52redasetmessages: + msg7180
2021-04-08 15:44:10rouiljsetstatus: new -> open
versions: + 1.6.1
nosy: + rouilj
messages: + msg7174
priority: high
assignee: rouilj
type: crash
2021-04-08 07:15:51redacreate