Please try the version in trunk.

Massimo

On Dec 30, 1:20 am, KMax <mkostri...@gmail.com> wrote:
> This code start to work
> ===========
> from gluon.sql import SQLCustomType
>
> db = DAL('postgres://web2py:gfhj...@db.sibnet.su/test1',
> pool_size=10)
> inet = SQLCustomType ( type='string',native='inet')
>
> db.define_table('firewall',
>     SQLField('network',type=inet))
> ===========
> Look like
> ==from gluon.dal import SQLCustomType
> was not good idea.
> BUT
> Inserting or updating using web2py db admin
> Shows following:
> -------------------
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "/home/web2py/applications/test/controllers/appadmin.py", line
> 304, in <module>
>   File "gluon/globals.py", line 96, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/web2py/applications/test/controllers/appadmin.py", line
> 286, in update
>     if form.accepts(request.vars, session):
>   File "gluon/sqlhtml.py", line 896, in accepts
>     self.table._db(self.table.id == self.record.id).update(**fields)
>   File "gluon/sql.py", line 3151, in update
>     self._db._execute(query)
>   File "gluon/sql.py", line 952, in <lambda>
>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> ProgrammingError: syntax error at or near ".3"
> LINE 1: UPDATE firewall SET network=1.2.3.5 WHERE firewall.id=1;
> ===================
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "/home/web2py/applications/test/controllers/appadmin.py", line
> 304, in <module>
>   File "gluon/globals.py", line 96, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/web2py/applications/test/controllers/appadmin.py", line
> 124, in insert
>     if form.accepts(request.vars, session):
>   File "gluon/sqlhtml.py", line 898, in accepts
>     self.vars.id = self.table.insert(**fields)
>   File "gluon/sql.py", line 1844, in insert
>     self._db._execute(query)
>   File "gluon/sql.py", line 952, in <lambda>
>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> ProgrammingError: syntax error at or near ".1"
> LINE 1: INSERT INTO firewall(network) VALUES (1.1.1.2);
>
> Thank you for your helping
> On Dec 30, 12:31 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > I need your help debugging this... the relevant code in sql.py is
>
> >             if isinstance(field.type,SQLCustomType):
> >                 ftype = field.type.native or field.type.type
> >             elif ...
> >             elif not field.type in self._db._translator:
> >                 raise SyntaxError, 'Field: unknown field type: %s for %s' % 
> > \
> >                     (field.type, field.name)
>
> > You get error on the last line but given the code you show me, it
> > should never get there. The first if should be true because field.type
> > should be cidr which is SQLCustomType.
>
> > Try add some print statements and see what happens.
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to