[Zope] authentication in a pythonscript
Steve Spicklemire
steve@spvi.com
Tue, 23 Oct 2001 08:08:09 -0500
Hi Joachim,
Here is one that works for me:
## Script (Python) "userAuthenticate"
##bind container=3Dcontainer
##bind context=3Dcontext
##bind namespace=3D
##bind script=3Dscript
##bind subpath=3Dtraverse_subpath
##parameters=3Dmanager, request, username, password
##title=3DAuthenticate a User
##
#
# Get user inforamtion from Gadfly and check password given.
#
result =3D container.selectSQL(personID=3Dusername)
if result and result[0].passwd =3D=3D password:
return 1
else:
return 0
On Monday, October 22, 2001, at 10:33 AM, Joachim Schmitz wrote:
> how do I call a python-script form python. I am using the LoginManage=20=
> and
> wrote the authenticate function as a python-script. But when this is=20=
> called
> from within the login-manager, I get
>
> Type Error
>
>
> Traceback (innermost last):
> File ...Zope-2.4.1/lib/python/ZPublisher/Publish.py, line 223, in=20=
> publish_module
> File ...Zope-2.4.1/lib/python/ZPublisher/Publish.py, line 187, in=20=
> publish
> File ...Zope-2.4.1/lib/python/Zope/__init__.py, line 226, in=20
> zpublisher_exception_hook
> (Object: LockableItem)
> File ...Zope-2.4.1/lib/python/ZPublisher/Publish.py, line 162, in=20=
> publish
> File ...Zope-2.4.1/lib/python/ZPublisher/BaseRequest.py, line 447,=20=
> in traverse
> File ...ZInstanceHome/Products/LoginManager/LoginManager.py, line=20=
> 238, in validate
> (Object: ProviderContainer)
> File .../ZInstanceHome/Products/LoginManager/LoginMethods.py, line=20=
> 302, in findLogin
> (Object: PlugInBase)
> File ...Zope-2.4.1/lib/python/Shared/DC/Scripts/Bindings.py, line=20=
> 324, in __call__
> (Object: authenticate)
> File ...Zope-2.4.1/lib/python/Shared/DC/Scripts/Bindings.py, line=20=
> 354, in _bindAndExec
> (Object: authenticate)
> File=20
> ...Zope-2.4.1/lib/python/Products/PythonScripts/PythonScript.py, line=20=
> 363, in _exec
> (Object: authenticate)
> (Info: (None, ('test', <h3>form</h3><table><tr valign=3D"t.....the=
=20
> whole
> source of the loginForm
> TypeError: (see above)
>
> I tried serveral bindings for the python-script but none worked.
>
>
>
> Mit freundlichen Gr=FC=DFen
>
> Joachim Schmitz
>
> AixtraWare, Ing. B=FCro f=FCr Internetanwendungen
> H=FCsgenstr. 33a, D-52457 Aldenhoven
> Telefon: +49-2464-8851, FAX: +49-2464-905163
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )