membership and iteration in form records

Bug #143880 reported by Bertrand Croq
2
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Low
Unassigned

Bug Description

When submitting a form with :record fields (eg: <input name="myrecord.thekey:record" value="value"/>) we get dict-like object for these fields.

It would be great if we could use "if 'thekey' in form.myrecord:..." and "for key in myrecord:..." as it is possible to do with dict since Python 2.4.

By now, we have to use "if 'thekey' in form.myrecord.keys():..." and "for key in myrecord.keys():..." as with Python < 2.4.

Tags: feature zope
Revision history for this message
Andreas Jung (ajung) wrote :

Patches are welcome

Revision history for this message
Philipp von Weitershausen (philikon) wrote :

To give you a hint where to start: the class that's responsible for records is ZPublisher.HTTPRequest.record. A simple unit test should accompany the patch.

Revision history for this message
Bertrand Croq (bcroq) wrote :

Uploaded: patch

Thanks for the tips... here is a simple patch.
Sorry, no unittest, but it has been tested.

Revision history for this message
Andreas Jung (ajung) wrote :

A patch requires tests in order to be accepted.

Revision history for this message
Andreas Jung (ajung) wrote :

Changes: submitter email, edited transcript, importance (medium => low)

Revision history for this message
Andreas Jung (ajung) wrote :
Changed in zope2:
status: New → Fix Committed
Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

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