Thank you!!!! It work!


On Tue, Jan 20, 2015 at 10:23 AM, Paolo Valleri <[email protected]>
wrote:

> Hi Massimiliano,
> Try:
> from gluon.dal.adapters import ADAPTERS, PostgreSQLAdapter
>
> Paolo
>
>
> On Tuesday, January 20, 2015 at 10:13:00 AM UTC+1, Massimiliano wrote:
>
>> I found that the problem is inside my custom_adapter.
>>
>> Can you help me to translate that to the new pydal?
>>
>> # -*- coding: utf-8 -*-
>>
>>
>> from gluon.dal import ADAPTERS, PostgreSQLAdapter
>>
>>
>> class BoolAsIntPostgreSQLAdapter(PostgreSQLAdapter):
>>
>>
>>     # specify a diver to use
>>     #drivers = ('psycopg2','pg8000')
>>     drivers = ('psycopg2','pg8000')
>>     TRUE = -1
>>     FALSE = 0
>>
>>
>>     types = {
>>         'boolean': 'smallint',
>>         'string': 'VARCHAR(%(length)s)',
>>         'text': 'TEXT',
>>         'json': 'TEXT',
>>         'password': 'VARCHAR(%(length)s)',
>>         'blob': 'BYTEA',
>>         'upload': 'VARCHAR(%(length)s)',
>>         'integer': 'INTEGER',
>>         'bigint': 'BIGINT',
>>         'float': 'FLOAT',
>>         'double': 'FLOAT8',
>>         'decimal': 'NUMERIC(%(precision)s,%(scale)s)',
>>         'date': 'DATE',
>>         'time': 'TIME',
>>         'datetime': 'TIMESTAMP',
>>         'id': 'SERIAL PRIMARY KEY',
>>         'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE
>> %(on_delete_action)s',
>>         'list:integer': 'TEXT',
>>         'list:string': 'TEXT',
>>         'list:reference': 'TEXT',
>>         'geometry': 'GEOMETRY',
>>         'geography': 'GEOGRAPHY',
>>         'big-id': 'BIGSERIAL PRIMARY KEY',
>>         'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE
>> %(on_delete_action)s',
>>         'reference FK': ', CONSTRAINT  "FK_%(constraint_name)s" FOREIGN
>> KEY (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE
>> %(on_delete_action)s',
>>         'reference TFK': ' CONSTRAINT  "FK_%(foreign_table)s_PK" FOREIGN
>> KEY (%(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON
>> DELETE %(on_delete_action)s',
>>     }
>>     def parse_boolean(self, value, field_type):
>>         return value == self.TRUE or False
>>
>>
>>
>> ADAPTERS.update( {
>>     'pgsql': BoolAsIntPostgreSQLAdapter
>> })
>>
>> thank you
>>
>> On Tue, Jan 20, 2015 at 9:44 AM, Massimiliano <[email protected]> wrote:
>>
>>> It seem that:
>>>
>>> site_packages
>>>
>>> inside the web2py folder is not in the import path anymore.
>>>
>>> When I try to import custom_adapter.py in site_packages with
>>> import custom_adapter
>>> I got:
>>>
>>> ImportError: Cannot import module 
>>> 'applications.cotral_myspace.modules.custom_adapter'
>>>
>>>
>>> Is a known/new behavior or a bug?
>>>
>>> Thank you
>>> --
>>> Massimiliano
>>>
>>
>>
>>
>> --
>> Massimiliano
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Massimiliano

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to