Re: [Zope-dev] Saving attributes for a DataSkin
Hi Johan,
Could you give a more complete traceback? It's hard to tell from just the error type..
thanks! -steve
Of course, here it comes. Regards, Johan Traceback (innermost last): File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 187, in publish File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: ProviderContainer) File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 171, in publish File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: changeUser) File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: changeUser) File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__ (Object: changeUser) File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, line 353, in _bindAndExec (Object: changeUser) File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Products/PythonScripts/PythonScript.py, line 330, in _exec (Object: changeUser) (Info: ({'script': <PythonScript instance at 8a1ffc8>, 'context': <LoginManager instance at 89d56e8>, 'container': <LoginManager instance at 89d56e8>, 'self': <TemplateDict object at 8a1e948>, 'traverse_subpath': []}, ('a', 'a', 'a', 'a', 'a'), {}, None)) File Script (Python), line 3, in changeUser File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Products/PythonScripts/zbytecodehacks/VSExec.py, line 429, in __setattr__ TypeError: (see above)
"JC" == Johan Carlsson <johanc@torped.se> writes:
JC> Hi, I'm having some trouble figuring out how to write a method JC> and a skinscript to save attributes of a DataSkin.
JC> Specialist is the LoginManager.
JC> DataSkin is:
JC> class EasyGroupUser(LoginUser): ... def getRoles(self): ... JC> def getDomains(self): ... def authenticate(self, password, JC> request): ...
JC> SkinScripts are: WITH QUERY sql_getUserFor(username=self.id) JC> COMPUTE username, password, challenge_question, JC> challenge_answer, admin_email
JC> WHEN OBJECT CHANGED STORE password, challenge_question, JC> challenge_answer, admin_email USING sql_changeUser( JC> username=self.id, newpassword=password, JC> challenge_question=challenge_question, JC> challenge_answer=challenge_answer, admin_email=admin_email, JC> oldpassword=OLD['oldpassword'] ) SAVING oldpassword = password
JC> Current Attribute Handling: admin_email Getters: SkinScript, JC> line 1 Setters: SkinScript, line 10 Deleters: SkinScript, line JC> 10 challenge_answer Getters: SkinScript, line 1 Setters: JC> SkinScript, line 10 Deleters: SkinScript, line 10 JC> challenge_question Getters: SkinScript, line 1 Setters: JC> SkinScript, line 10 Deleters: SkinScript, line 10 password JC> Getters: SkinScript, line 1 Setters: SkinScript, line 10 JC> Deleters: SkinScript, line 10
JC> The getter works alright, but when trying to set attributes JC> (that supposedly would be handle by the setter) with the JC> following Script (Python) I get the following error:
JC> ## Script (Python) "changeUser" ##bind container=container JC> ##bind context=context ##bind namespace=self ##bind JC> script=script ##bind subpath=traverse_subpath JC> ##parameters=username,password,challenge_question,challenge_answer,admin_email JC> ##title= ## user = context.getItem(username) JC> user.password=password JC> user.challenge_question=challenge_question JC> user.challenge_answer=challenge_answer JC> user.admin_email=admin_email
JC> ERROR MESSAGE: Error Type: TypeError Error Value: JC> attribute-less object (assign or del)
JC> So what am I doing wrong here? Any clues appreciated. JC> TIA/Johan Carlsson
JC> _______________________________________________ Zope-Dev JC> maillist - Zope-Dev@zope.org JC> http://lists.zope.org/mailman/listinfo/zope-dev ** No cross JC> posts or HTML encoding! ** (Related lists - JC> http://lists.zope.org/mailman/listinfo/zope-announce JC> http://lists.zope.org/mailman/listinfo/zope )
participants (1)
-
Johan Carlsson