[Zope-dev] Saving attributes for a DataSkin
Johan Carlsson
johanc@torped.se
Fri, 9 Mar 2001 17:23:26 +0100
>=20
> Hi Johan,
>=20
> Could you give a more complete traceback? It's hard to tell
> from just the error type..=20
>=20
> 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/Binding=
s.py, line 324, in __call__
(Object: changeUser)
File =
/bigshare/zopeservers/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Binding=
s.py, line 353, in _bindAndExec
(Object: changeUser)
File =
/bigshare/zopeservers/Zope-2.3.0-src/lib/python/Products/PythonScripts/Py=
thonScript.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/zb=
ytecodehacks/VSExec.py, line 429, in __setattr__
TypeError: (see above)
> >>>>> "JC" =3D=3D Johan Carlsson <johanc@torped.se> writes:
>=20
> JC> Hi, I'm having some trouble figuring out how to write a method
> JC> and a skinscript to save attributes of a DataSkin.
>=20
> JC> Specialist is the LoginManager.
>=20
> JC> DataSkin is:
>=20
> JC> class EasyGroupUser(LoginUser): ... def getRoles(self): ...
> JC> def getDomains(self): ... def authenticate(self, password,
> JC> request): ...
>=20
> JC> SkinScripts are: WITH QUERY sql_getUserFor(username=3Dself.id)
> JC> COMPUTE username, password, challenge_question,
> JC> challenge_answer, admin_email
>=20
> JC> WHEN OBJECT CHANGED STORE password, challenge_question,
> JC> challenge_answer, admin_email USING sql_changeUser(
> JC> username=3Dself.id, newpassword=3Dpassword,
> JC> challenge_question=3Dchallenge_question,
> JC> challenge_answer=3Dchallenge_answer, =
admin_email=3Dadmin_email,
> JC> oldpassword=3DOLD['oldpassword'] ) SAVING oldpassword =3D =
password
>=20
> 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
>=20
>=20
> 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:
>=20
> JC> ## Script (Python) "changeUser" ##bind container=3Dcontainer
> JC> ##bind context=3Dcontext ##bind namespace=3Dself ##bind
> JC> script=3Dscript ##bind subpath=3Dtraverse_subpath
> JC> =
##parameters=3Dusername,password,challenge_question,challenge_answer,admi=
n_email
> JC> ##title=3D ## user =3D context.getItem(username)
> JC> user.password=3Dpassword
> JC> user.challenge_question=3Dchallenge_question
> JC> user.challenge_answer=3Dchallenge_answer
> JC> user.admin_email=3Dadmin_email
>=20
> JC> ERROR MESSAGE: Error Type: TypeError Error Value:
> JC> attribute-less object (assign or del)
>=20
> JC> So what am I doing wrong here? Any clues appreciated.
> JC> TIA/Johan Carlsson
>=20
>=20
>=20
> 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 )
>=20