products.sqlalchemypas-1.0-py2.6.egg AttributeError:getGroupsForPrincipal

发布于 2025-01-08 05:35:11 字数 1549 浏览 0 评论 0 原文

我正在使用 products.sqlalchemypas-1.0-py2.6.egg 对 MSSQL 表中的用户进行身份验证。身份验证按预期工作,但现在我正在尝试实现组插件 从不同的表中获取组。发生的情况是,当我尝试登录时,它给我错误提示 AttributeError: getGroupsForPrincipal。

错误回溯是..

2012-02-21T15:33:14 INFO Zope 准备好处理请求


2012-02-21T15:39:25 ERROR Zope.SiteErrorLog 1329838765.580.598770330561 http://localhost:8060/dev/login_form

Traceback (innermost last):

 Module ZPublisher.Publish, line 115, in publish
 Module ZPublisher.BaseRequest, line 596, in traverse
 Module Products.PluggableAuthService.PluggableAuthService, line 235, in validate
 Module Products.PluggableAuthService.PluggableAuthService, line 735, in _findUser
 Module Products.PluggableAuthService.PluggableAuthService, line 668, in   _getGroupsForPrincipal
 AttributeError: getGroupsForPrincipal

我在plugin.py中的定义是...

def getGroupsForPrincipal(self, principal=getSecurityManager().getUser().getId(),request=None):
    "Getting groups from SIMS"
     import pdb; pdb.set_trace()
     groups = []
     results = self.simsGroupForUser(username=principal)
     for row in results.dictionaries():
        group = row.get('group')
        groups.append(group)
        return groups    

不知道为什么它无法在plugin.py中到达这个方法,但是有我在植入块中定义了此接口,以在我的 acl_user pas 对象中实现结果显示组接口。

[额外] 我尝试在调试器中导入我的插件,并尝试达到此方法并出现相同的错误,所以我不知道我是否需要专门定义任何内容来在我的pas中选择此方法。我确实在我的实现类中定义了 IGroupsPlugin。

任何评论一如既往都是很大的帮助。

I am using products.sqlalchemypas-1.0-py2.6.egg for authenticating user from MSSQL Table. Authentication work as expected but now I'm trying implementaing groups plugin to
get groups from different table. What happening is when I'm trying to loggin its giving me error saying AttributeError: getGroupsForPrincipal.

Error Traceback is ..

2012-02-21T15:33:14 INFO Zope Ready to handle requests


2012-02-21T15:39:25 ERROR Zope.SiteErrorLog 1329838765.580.598770330561 http://localhost:8060/dev/login_form

Traceback (innermost last):

 Module ZPublisher.Publish, line 115, in publish
 Module ZPublisher.BaseRequest, line 596, in traverse
 Module Products.PluggableAuthService.PluggableAuthService, line 235, in validate
 Module Products.PluggableAuthService.PluggableAuthService, line 735, in _findUser
 Module Products.PluggableAuthService.PluggableAuthService, line 668, in   _getGroupsForPrincipal
 AttributeError: getGroupsForPrincipal

My defination in plugin.py is ...

def getGroupsForPrincipal(self, principal=getSecurityManager().getUser().getId(),request=None):
    "Getting groups from SIMS"
     import pdb; pdb.set_trace()
     groups = []
     results = self.simsGroupForUser(username=principal)
     for row in results.dictionaries():
        group = row.get('group')
        groups.append(group)
        return groups    

Don't know why its not able to reach this method in plugin.py however there is implatemented block where I did define this interface to implement resulting showing groups interface in my acl_user pas object.

[added]
I've tried to import my plugin in debugger and tried to reach this method and have same error so I dont know Do I need to define anything specifically to pick this method in my pas. I did define in my implements class to impelement IGroupsPlugin.

Any comment is great help as always.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

赴月观长安 2025-01-15 05:35:12

刚刚发现我的文件缩进错误,这就是它给出属性错误的原因。感谢大家的时间和评论。

Just found that My file has wrong indentation, that why it was giving attributes error. Thanks all for your time and comments.

GRAY°灰色天空 2025-01-15 05:35:11

我认为您的方法定义没有达到您的预期。 principal=getSecurityManager().getUser().getId() 将在导入时而不是在方法执行时计算默认参数。

I don't think you method definition does what you expect it to. principal=getSecurityManager().getUser().getId() will calculate the default parameter at import time rather than at method execution time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文