zopefoundation / Zope

Zope is an open-source web application server.
https://zope.readthedocs.io
Other
352 stars 99 forks source link

Issue with manage_addPageTemplate #1130

Closed GiaBen closed 1 year ago

GiaBen commented 1 year ago

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

Try to add the product Page Template within the ZMI with id and no file

What I expect to happen:

To see the product appears in the ZMI

What actually happened:

I got the following error: Traceback (innermost last):

Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 390, in publish_module
Module ZPublisher.WSGIPublisher, line 285, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 68, in call_object
Module Products.PageTemplates.ZopePageTemplate, line 379, in manage_addPageTemplate

AttributeError: 'str' object has no attribute 'filename'

What version of Python and Zope/Addons I am using:

python 3.11.3

Linux python 3.11.3 zope 5.8.2

yurij7070 commented 1 year ago

This issue fixed by replacing line 377 in ZopePageTemplate.py if REQUEST and 'file' in REQUEST: replace with if REQUEST and 'file' in REQUEST and REQUEST.get('file'):

GiaBen commented 1 year ago

Thanks Yurij, it makes sense (now). It works just fine.