[Zope] External Method Problem
Özgür Caner
oc@teuto.net
Fri, 06 Jul 2001 14:20:37 +0200
Hello,
I've a external method called 'getUserGroups', for the code of this method look at the end of this message, and when I call this method with:
<dtml-var "getUserGroups (REQUEST['REMOTE_USER'])">
i get this error:
Traceback (innermost last):
File C:\PROGRA~1\zope\lib\python\ZPublisher\Publish.py, line 223, in publish_module
File C:\PROGRA~1\zope\lib\python\ZPublisher\Publish.py, line 187, in publish
File C:\PROGRA~1\zope\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File C:\PROGRA~1\zope\lib\python\ZPublisher\Publish.py, line 171, in publish
File C:\PROGRA~1\zope\lib\python\ZPublisher\mapply.py, line 160, in mapply
(Object: test)
File C:\PROGRA~1\zope\lib\python\ZPublisher\Publish.py, line 112, in call_object
(Object: test)
File C:\PROGRA~1\zope\lib\python\OFS\DTMLDocument.py, line 189, in __call__
(Object: test)
File C:\PROGRA~1\zope\lib\python\DocumentTemplate\DT_String.py, line 538,
in __call__
(Object: test)
File C:\PROGRA~1\zope\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval
(Object: getUserGroups (REQUEST['REMOTE_USER']))
(Info: getUserGroups)
File <string>, line 0, in ?
File C:\PROGRA~1\zope\lib\python\Products\ExternalMethod\ExternalMethod.py, line
269, in __call__
(Object: getUserGroups)
(Info: (('TEUTONET\\administrator',), {}, None))
File C:\PROGRA~1\zope\Extensions\getUserGroups.py, line 19, in getUserGroups
(Object: Traversable)
AttributeError: (see above)
Is this an error or a Security Feature of External Methods?
--- getUserGroups.py:
import win32net
import string
def getUserGroups (self, canon_username):
tmp = []
groups = []
dc = ''
server = ''
username = ''
if string.find (canon_username, '\\') != -1:
tmp = string.split (canon_username, '\\')
if (len (tmp) == 2):
dc = tmp [0]
username = tmp[1]
server = win32net.NetGetDCName ('', dc)
groups = win32net.NetUserGetGroups (server, username)
return groups
---
Thanks and greetings
Özgür Caner