Hola, José!

I've attached a patch that fixes a bunch of things, which I'll explain below. 
Please note that it depends on the latest repoze.what revision in the 
repository because I've just added support for read-only adapters in the 
testutil (so now they are fully supported).

Most of the tests that don't pass now seem are caused by a pyparsing 
> ParseException: Expected "]" (at char 4), (line:1, col:5)

So the other failures may be a consequence of this. I would've solved that, 
but I've never used pyparsing (yet).

On Friday December 5, 2008 23:13:07 [EMAIL PROTECTED] wrote:
> 1) Mea culpa. Corrected the typo, added the namespaces, corrected setup.py
> to add VERSION.txt, and tests/*.ini files. 'python setup.py test' runs and
> generates no output.

Thanks! It took me a while to spot the problem, but it turned out to be that 
the test files had execute permissions and thus they were ignored.

> 2) Added 'self.is_writable = False'. I'm working on the writable version.

Cool :)

> It's easy if you don't mind to trow away all the comments in the source
> files on each change.

I think that would not be a problem.

> 3) No more __init__ in INIAdapter subclasses.
> 4) Created public repository on:
>     http://github.com/jdinuncio/repoze.what.plugins.ini/tree/master

That's awesome. It's very handy to keep track of the development.

> Thanks!

Thanks to you for taking the time to extend repoze.what!

> BTW: Is it OK to use repoze-dev for this thread?

Sure. As Chris already pointed out, this is definitely the right place ;-)

Gustavo Narea <http://gustavonarea.net/>.

Get rid of unethical constraints! Get freedomware:
diff --git a/repoze/what/plugins/ini/ini.py b/repoze/what/plugins/ini/ini.py
index b8f77c7..27a4066 100755
--- a/repoze/what/plugins/ini/ini.py
+++ b/repoze/what/plugins/ini/ini.py
@@ -51,7 +51,7 @@ class INIAdapter(BaseSourceAdapter):
         return self.info.keys()
     def _get_section_items(self, section):
-        return set(sef.info[section])
+        return set(self.info[section])
     def _find_sections(self, hint):
         raise SourceError('This is implemented in the groups and '
@@ -61,25 +61,9 @@ class INIAdapter(BaseSourceAdapter):
         raise SourceError('For including items you must edit the '
                           'INI file directly.')
-    def _exclude_items(self, section, items):
-        raise SourceError('For excluding items you must edit the '
-                          'INI file directly.')
     def _item_is_included(self, section, item):
         return item in self.info[section]
-    def _create_section(self, section):
-        raise SourceError('For create a new section you must edit the '
-                          'INI file directly.')
-    def _edit_section(self, section, new_section):
-        raise SourceError('For edit a section you must edit the '
-                          'INI file directly.')
-    def _delete_section(self, section):
-        raise SourceError('For delete a section you must edit the '
-                          'INI file directly.')
     def _section_exists(self, section):
         return section in self.info
@@ -89,10 +73,10 @@ class INIGroupAdapter(INIAdapter):
     def _find_sections(self, hint):
         userid = hint['repoze.who.userid']
-        answer = []
+        answer = set()
         for section in self.info.keys():
             if userid in self.info[section]:
-                answer.append(section)
+                answer.add(section)
         return answer
@@ -100,10 +84,10 @@ class INIPermissionsAdapter(INIAdapter):
     """INI Permissions Adapters."""
     def _find_sections(self, hint):
-        answer = []
+        answer = set()
         for section in self.info.keys():
             if hint in self.info[section]:
-                answer.append(section)
+                answer.add(section)
         return answer
diff --git a/setup.py b/setup.py
index c847ed9..592d576 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,10 @@ setup(name='repoze.what.plugins.ini',
+      tests_require=['repoze.what', 'nose'],
+      test_suite="nose.collector",
       install_requires=['repoze.what', 'pyparsing'],
       namespace_packages=['repoze', 'repoze.what', 'repoze.what.plugins'],
-      entry_points='',
+      entry_points="""\
+      """,
diff --git a/tests/test_parser.py b/tests/test_parser.py
old mode 100755
new mode 100644
diff --git a/tests/test_plugin_ini.py b/tests/test_plugin_ini.py
old mode 100755
new mode 100644
index 0c7296f..2660639
--- a/tests/test_plugin_ini.py
+++ b/tests/test_plugin_ini.py
@@ -18,15 +18,16 @@
 import os.path
 import unittest
-from repoze.what.adapters.testutil import GroupsAdapterTester
-from repoze.what.adapters.testutil import PermissionsAdapterTester
+from repoze.what.adapters.testutil import ReadOnlyGroupsAdapterTester, \
+                                          ReadOnlyPermissionsAdapterTester
 from repoze.what.plugins.ini import INIGroupAdapter
 from repoze.what.plugins.ini import INIPermissionsAdapter
 current_dir = os.path.abspath(os.path.dirname(__file__))
-class TestINIGroupAdapterTester(GroupsAdapterTester, unittest.TestCase):
+class TestINIGroupAdapterTester(ReadOnlyGroupsAdapterTester,
+                                unittest.TestCase):
     '''Test Suite for INI group source adapter.'''
     def setUp(self):
         super(TestINIGroupAdapterTester, self).setUp()
@@ -34,7 +35,8 @@ class TestINIGroupAdapterTester(GroupsAdapterTester, unittest.TestCase):
         self.adapter = INIGroupAdapter(fake_groups)
-class TestINIPermissionsTester(PermissionsAdapterTester, unittest.TestCase):
+class TestINIPermissionsTester(ReadOnlyPermissionsAdapterTester, 
+                               unittest.TestCase):
     '''Test Suite for INI permission source adapter.'''
     def setUp(self):
         super(TestINIPermissionsTester, self).setUp()
Repoze-dev mailing list

Reply via email to