[Zope] Re: assignment to form records

Evan Simpson evan@4-am.com
Thu, 06 Mar 2003 14:39:47 -0600


Fernando Martins wrote:
> I've a script who gets two parameters from a form: Code (int), Fields
> (record).
...
> Fields.a_field = 1
> 
> I get the error

I routinely patch Zope so that 'record' instances and the SQL Record 
subclasses that it generates are writable:

(in $ZOPE/lib/python/ZPublisher/HTTPRequest.py)
class record:
     # Allow access to record methods and values from DTML
     __allow_access_to_unprotected_subobjects__=1
     _guarded_writes = 1

(in $ZOPE/lib/python/Shared/DC/ZRDB/Result.py)
         class r(Record, Implicit, brains, zbrains):
             'Result record class'
             _guarded_writes = 1

I see no reason why 'record' objects shouldn't be mutable like this, but 
I've never discussed it with anyone.

Cheers,

Evan @ 4-am