New submission from laurance <nlaura...@qubic.tv>:
Hi,
I changed my group's permission to a @property decorated method. This way I can
compute complex permission settings.
the eager load introduced in rc4 (?) of repoze.what.plugins.sql postulates that
permissions is a mapped attribute.
I submit this patch for approval as it is very basic (to solve, not to diagnose
:) )
----------
files: adapters.patch
messages: 440
nosy: nlaurance
priority: urgent
status: unread
title: repoze.what.plugins.sql bug with group permissions
topic: repoze.what
__________________________________
Repoze Bugs <b...@bugs.repoze.org>
<http://bugs.repoze.org/issue159>
__________________________________
--- /home/nlaurance/shabti/lib/python2.6/site-packages/repoze.what.plugins.sql-1.0rc4-py2.6.egg/repoze/what/plugins/sql/adapters.py 2010-01-14 15:46:22.000000000 +0100
+++ /home/nlaurance/tg21py265/lib/python2.6/site-packages/repoze.what.plugins.sql-1.0rc4-py2.6.egg/repoze/what/plugins/sql/adapters.py 2010-08-05 20:58:42.000000000 +0200
@@ -194,7 +194,12 @@
# "field" usually equals to {tg_package}.model.User.user_name
# or {tg_package}.model.Group.group_name
field = getattr(self.children_class, self.translations['item_name'])
- query = self.dbsession.query(self.children_class).options(eagerload(self.translations['sections']))
+
+ from sqlalchemy.exc import InvalidRequestError
+ try:
+ query = self.dbsession.query(self.children_class).options(eagerload(self.translations['sections']))
+ except InvalidRequestError: # permissions might be a decorated method
+ query = self.dbsession.query(self.children_class)
try:
item_as_row = query.filter(field==item_name).one()
except NoResultFound:
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev