web2py / pydal

A pure Python Database Abstraction Layer
BSD 3-Clause "New" or "Revised" License
497 stars 140 forks source link

AttributeError: 'PostgreBoolean' object has no attribute '_config_json' #389

Open RekGRpth opened 8 years ago

RekGRpth commented 8 years ago

solving:

diff --git a/pydal/adapters/postgres.py b/pydal/adapters/postgres.py
index b27c085..1f196fe 100644
--- a/pydal/adapters/postgres.py
+++ b/pydal/adapters/postgres.py
@@ -215,6 +215,9 @@ class PostgreBoolean(PostgreNew):
         from ..parsers.postgre import PostgreBooleanAutoJSONParser
         return PostgreBooleanAutoJSONParser

+    def _config_json(self):
+        self.dialect = self._get_json_dialect()(self)
+        self.parser = self._get_json_parser()(self)

 @adapters.register_for('postgres3:psycopg2')
 class PostgrePsycoBoolean(PostgrePsycoNew):
diff --git a/pydal/dialects/postgre.py b/pydal/dialects/postgre.py
index 67c21cc..2861dd7 100644
--- a/pydal/dialects/postgre.py
+++ b/pydal/dialects/postgre.py
@@ -276,6 +276,7 @@ class PostgreDialectBoolean(PostgreDialectArrays):
         return 'BOOLEAN'

+@dialects.register_for(PostgreBoolean)
 class PostgreDialectBooleanJSON(PostgreDialectBoolean):
     @sqltype_for('json')
     def type_json(self):
diff --git a/pydal/parsers/postgre.py b/pydal/parsers/postgre.py
index 8e238ad..4dc5214 100644
--- a/pydal/parsers/postgre.py
+++ b/pydal/parsers/postgre.py
@@ -28,6 +28,7 @@ class PostgreBooleanParser(JSONParser):
         return value

+@parsers.register_for(PostgreBoolean)
 class PostgreBooleanAutoJSONParser(BasicParser):
     @for_type('boolean')
     def _boolean(self, value):
gi0baro commented 8 years ago

@RekGRpth thanks for the bug spot, but will probably fix this in a different manner.