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.

On Dec 29, 10:35 pm, KMax <mkostri...@gmail.com> wrote:
> Please advise.
> ------------------------------------
> Error traceback
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "/home/web2py/applications/test/models/db.py", line 12, in
> <module>
>     SQLField('network',type=cidr))
>   File "gluon/sql.py", line 1249, in define_table
>     t._create(migrate=migrate, fake_migrate=fake_migrate)
>   File "gluon/sql.py", line 1600, in _create
>     (field.type, field.name)
> SyntaxError: Field: unknown field type: string for network
>
> In file: /home/web2py/applications/test/models/db.py
>
> from gluon.dal import SQLCustomType
>
> inet = SQLCustomType ( type='string', native='inet')
>
> cidr = SQLCustomType ( type='string', native='cidr')
>
> macaddr = SQLCustomType ( type='string', native='macaddr')
>
> db = DAL('postgres://web2py:web...@localhost/test1', pool_size=10)
>
> db.define_table('firewall',
>     SQLField('network',type=cidr))
>
> On Dec 25, 9:15 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > yes this is definitively possible. I would try
>
> >         inet = SQLCustomType
> > (
> >             type
> > ='string',
> >             native
> > ='inet'))
>
> >         db.define_table
> > (
>
> > 'example',
> >             Field('value',
> > type=inet)
> >             )
>
> > Massimo
>
>

--

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