Discussion tool fails when PUTting a Page via FTP

Bug #1209232 reported by Alan O'Neill
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope CMF buildout
New
Undecided
Unassigned

Bug Description

I believe this bug is related to bug #1042836. When I FTP a page into Plone (such as the sample below), the value from the 'allowDiscussion' field is passed into

buildout-cache/eggs/Products.CMFDefault-2.2.3-py2.7.egg/Products/CMFDefault/DiscussionTool.py

as a string (i.e., either "True" or "False"), causing the line of code

content.allow_discussion = bool(int(allowDiscussion))

to fail with an error of

ValueError: invalid literal for int() with base 10: 'True'

I've patched my copy of Plone by adding the following lines of code just before the one mentioned above, and now FTPing a Page into Plone works. (I am not a Python programmer, so there's probably a much more elegant way of addressing this problem, and my hope is that my approach isn't breaking something else. :-)

Thanks!!

----------[ Potential Patch ]----------

# 8/6/2013: FTP uploads of pages (i.e., not files, etc.) send a
# string value of "True" or "False" to this function, which causes
# the int() function and thus the FTP PUT operation to fail.
if str(allowDiscussion) == 'True':
   allowDiscussion = True
elif str(allowDiscussion) == 'False':
   allowDiscussion = False

----------[ Version Information ]----------

Plone 4.3.1 (4306)
CMF 2.2.7
Zope 2.13.20
Python 2.7.4 (default, Jul 19 2013, 11:44:43) [GCC 4.6.3]
PIL 1.7.8 (Pillow)

----------[ Traceback ]----------

Traceback (innermost last):
  Module ZPublisher.Publish, line 60, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module webdav.NullResource, line 175, in PUT
  Module Products.Archetypes.WebDAVSupport, line 121, in PUT
  Module Products.Archetypes.utils, line 123, in mapply
  Module Products.Marshall.marshaller, line 107, in demarshall
  Module Products.Marshall.marshaller, line 90, in delegate
   - __traceback_info__: (<Products.Archetypes.Marshall.RFC822Marshaller instance at 0xadd98ec>, 'demarshall', <ATDocument at /Plone/Members/admin/ien>, {'mimetype': None, 'filename': 'ien', 'REQUEST': <FTPRequest, URL=http://localhost.localdomain:8021/Zope2/Plone/Members/admin/ien/PUT>, 'RESPONSE': FTPResponse(''), 'context': <ATDocument at /Plone/Members/admin/ien>})
  Module Products.Archetypes.utils, line 123, in mapply
  Module Products.Archetypes.Marshall, line 236, in demarshall
  Module Products.Archetypes.ExtensibleMetadata, line 287, in allowDiscussion
  Module Products.CMFDefault.DiscussionTool, line 89, in overrideDiscussionFor
ValueError: invalid literal for int() with base 10: 'True'

----------[ Sample 'Page' I used for testing ]----------

id: mypage
title: MYPAGE
description: Sample page.
subject:
relatedItems:
location:
language:
effectiveDate: None
expirationDate: None
creation_date: 2008/08/22 09:51:5.155000 GMT-4
modification_date: 2013/08/06 10:55:59.905240 GMT-4
creators: admin
contributors:
rights:
allowDiscussion: True
excludeFromNav: False
presentation: False
tableContents: False
Content-Type: text/html

<pre>Sample page
</pre>

Revision history for this message
Alan (alan-oneill) wrote :

I recently upgraded my instances of Plone to version to 4.3.2, and one of my users just reported this same problem. I'm wondering, then, if anyone has had a chance to take a look at this problem. If it's helpful, I can offer that applying the same page I originally mentioned to this latest version of Plone addresses the problem. Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.