[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
Gustavo Narea m...@gustavonarea.net added the comment: This has been solved in v1.0.1. Thank you, Nicolas! -- priority: urgent - feature status: done-cbb - resolved __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
System message: __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
System message: __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
laurance nlaura...@qubic.tv added the comment: patch with tests __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __diff -Naur -x '*svn' -x coverage official//repoze/what/plugins/sql/adapters.py trunk//repoze/what/plugins/sql/adapters.py --- official//repoze/what/plugins/sql/adapters.py 2011-01-11 23:27:49.0 +0100 +++ trunk//repoze/what/plugins/sql/adapters.py 2011-01-11 22:41:23.0 +0100 @@ -63,6 +63,7 @@ from sqlalchemy.exceptions import SQLAlchemyError from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm import eagerload +from sqlalchemy.exc import InvalidRequestError from repoze.what.adapters import BaseSourceAdapter, SourceError @@ -194,7 +195,11 @@ # 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'])) +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: diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/dependency_links.txt trunk//repoze.what.plugins.sql.egg-info/dependency_links.txt --- official//repoze.what.plugins.sql.egg-info/dependency_links.txt 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/dependency_links.txt 2011-01-11 20:48:19.0 +0100 @@ -0,0 +1 @@ + diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/entry_points.txt trunk//repoze.what.plugins.sql.egg-info/entry_points.txt --- official//repoze.what.plugins.sql.egg-info/entry_points.txt 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/entry_points.txt 2011-01-11 20:48:19.0 +0100 @@ -0,0 +1 @@ + \ No newline at end of file diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/namespace_packages.txt trunk//repoze.what.plugins.sql.egg-info/namespace_packages.txt --- official//repoze.what.plugins.sql.egg-info/namespace_packages.txt 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/namespace_packages.txt 2011-01-11 20:48:19.0 +0100 @@ -0,0 +1,3 @@ +repoze +repoze.what +repoze.what.plugins diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/not-zip-safe trunk//repoze.what.plugins.sql.egg-info/not-zip-safe --- official//repoze.what.plugins.sql.egg-info/not-zip-safe 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/not-zip-safe 2011-01-11 20:48:19.0 +0100 @@ -0,0 +1 @@ + diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/PKG-INFO trunk//repoze.what.plugins.sql.egg-info/PKG-INFO --- official//repoze.what.plugins.sql.egg-info/PKG-INFO 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/PKG-INFO 2011-01-11 20:48:19.0 +0100 @@ -0,0 +1,30 @@ +Metadata-Version: 1.0 +Name: repoze.what.plugins.sql +Version: 1.0.1dev-r0 +Summary: The repoze.what SQL plugin +Home-page: http://what.repoze.org/docs/plugins/sql/ +Author: Gustavo Narea +Author-email: repoze-dev@lists.repoze.org +License: BSD-derived (http://www.repoze.org/LICENSE.txt) +Description: ** +The repoze.what SQL plugin +** + +This is an adapters plugin for repoze.what. + +The SQL plugin makes repoze.what support sources defined in SQLAlchemy-managed +databases by providing one group adapter, one permission adapter and one +utility to configure both in one go (optionally, when the group source and the +permission source have a relationship). + +Keywords: web application wsgi server wsgi sql sqlalchemy elixir authorization repoze +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Database +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI +Classifier: Topic :: Security diff -Naur -x '*svn' -x coverage official//repoze.what.plugins.sql.egg-info/requires.txt trunk//repoze.what.plugins.sql.egg-info/requires.txt --- official//repoze.what.plugins.sql.egg-info/requires.txt 1970-01-01 01:00:00.0 +0100 +++ trunk//repoze.what.plugins.sql.egg-info/requires.txt 2011-01-11 20:48:19.0 +0100 @@
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
Forest list8a.for...@tibit.com added the comment: Removing myself again. nlaurance, you don't have to keep adding me. If you'd really like to chat, we can use email. :) -- nosy: -forest __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
laurance nlaura...@qubic.tv added the comment: up anyway I can help with tests for this ? -- assignedto: Gustavo - forest nosy: +forest __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
Forest list8a.for...@tibit.com added the comment: I don't remember this bug, nor am I on the repoze.what dev team. Are you sure you meant to assign it to me? -- assignedto: forest - nlaurance nosy: -forest __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
Gustavo Narea m...@gustavonarea.net added the comment: Looks good to me, but I have to write a couple of tests (one for the groups and another for the permissions) for it before releasing it. Unfortunately the tests are more complex than the actual change because of the new fixtures, so I'll leave it for tomorrow. Thanks for the patch! -- status: unread - in-progress __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
System message: -- assignedto: - Gustavo nosy: +Gustavo __ Repoze Bugs b...@bugs.repoze.org http://bugs.repoze.org/issue159 __ ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [issue159] repoze.what.plugins.sql bug with group permissions
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.0 +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.0 +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