[ZPatterns] specialist with SQL only storage

Steve Spicklemire steve@spvi.com
Thu, 29 Aug 2002 13:55:29 -0500


You want to use the propertysheets defined in the ZClass, or filesystem 
based methods in your subclass of DataSkin to modify the dataskin (or 
you can write an external method that does it). Something like:

patient.propertysheets.Basic.manage_changeProperties( PRENOM = 
'Gauthier' )

-steve

On Thursday, August 29, 2002, at 11:52  AM, Godefroid Chapelle wrote:

> At 20:34 28/08/2002, Steve Spicklemire wrote:
>> I think you'll need to subclass DataSkin, either with a ZClass, or a 
>> Python (filesystem based) class.
>>
>> -steve
>
> Thanks, I had already done that but without specifying "Include 
> standard Zope persistent object base".
>
> It's working now.
>
> I am now trying to use the
>
> WHEN OBJECT CHANGED STORE NOM, PRENOM, ID_ORG_ASS, NUM_OA,
> DATE_NAISSANCE,
> RUE1,
> RUE2,
> CODE_POSTAL,
> VILLE,
> TELEPHONE1 USING SQL_update(self)
>
> clause.
>
> I thought I could modify a dataskin attribute and that it would 
> automatically save the new data.
>
> When I try to modify an attribute with a python script
>
> '''
> patient = container.getItem(id)
> patient.PRENOM = 'Gauthier'
> return patient.index_html()
> '''
>
> in the specialist I get the error :
>
> Error Type: TypeError
> Error Value: attribute-less object (assign or del)
> Traceback (innermost last):
>   File C:\PROGRA~1\Zope251\lib\python\ZPublisher\Publish.py, line 150, 
> in publish_module
>   File C:\PROGRA~1\Zope251\lib\python\ZPublisher\Publish.py, line 114, 
> in publish
>   File C:\PROGRA~1\Zope251\lib\python\Zope\__init__.py, line 159, in 
> zpublisher_exception_hook
>     (Object: spec)
>   File C:\PROGRA~1\Zope251\lib\python\ZPublisher\Publish.py, line 98, 
> in publish
>   File C:\PROGRA~1\Zope251\lib\python\ZPublisher\mapply.py, line 88, in 
> mapply
>     (Object: changePRENOM)
>   File C:\PROGRA~1\Zope251\lib\python\ZPublisher\Publish.py, line 39, 
> in call_object
>     (Object: changePRENOM)
>   File C:\PROGRA~1\Zope251\lib\python\Shared\DC\Scripts\Bindings.py, 
> line 252, in __call__
>     (Object: changePRENOM)
>   File C:\PROGRA~1\Zope251\lib\python\Shared\DC\Scripts\Bindings.py, 
> line 283, in _bindAndExec
>     (Object: changePRENOM)
>   File 
> C:\PROGRA~1\Zope251\lib\python\Products\PythonScripts\PythonScript.py, 
> line 302, in _exec
>     (Object: changePRENOM)
>     (Info: ({'script': <PythonScript instance at 02437108>, 'context': 
> <Specialist instance at 01D097F8>, 'container': <Specialist instance at 
> 01D097F8>, 'traverse_subpath': []}, ('1',), {}, None))
>   File Script (Python), line 2, in changePRENOM
>   File C:\PROGRA~1\Zope251\lib\python\RestrictedPython\Guards.py, line 
> 72, in handler
> TypeError: (see above)
>
>
> I think I did not understand correctly how the object and/or attributes 
> is to be changed.
>
> Hope some of you can help me. Thanks.
> --
>
> Godefroid Chapelle
>
> BubbleNet sprl
> rue Victor Horta, 18 / 202
> 1348 Louvain-la-Neuve
> Belgium
>
> Tel + 32 (10) 459901
> Mob + 32 (477) 363942
>
> TVA 467 093 008
> RC Niv 49849