ok i updated the plugin, hope it works now
address is still 
http://jaguar.biologie.hu-berlin.de/~fkrause/web2py.plugin.webfolder.w2p


On Jan 30, 10:34 am, selecta <gr...@delarue-berlin.de> wrote:
> Field('parent', 'reference plugin_webfolder_files', default=0,
> requires = IS_IN_DB(db,'plugin_webfolder_files.id','%(name)s'))
> this is what i used
> but leone  said that with postgres he get
> IntegrityError: insert or update on table "plugin_webfolder_files"
> violates foreign key constraint "plugin_webfolder_files_parent_fkey"
> DETAIL:  Key (parent)=(0) is not present in table
> "plugin_webfolder_files".
>
> in my first answer i did not know why but no i realize this is due to
> default=0
> so the default thing should just be removed
>
> On Jan 29, 4:42 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
>
>
> > I do not understand:
>
> > Field('parent', 'integer', default=0, requires = IS_IN_DB
> > (db,'plugin_webfolder_files.id','%(name)s'))
>
> > Why this is interger and not a reference. Why a default value that
> > would not pass validation?
> > Why not this:
>
> > Field('parent', 'reference plugin_webfolder_files', default=None,
> > requires = IS_EMPTY_OR(IS_IN_DB
> > (db,'plugin_webfolder_files.id','%(name)s')))
>
> > On Jan 29, 9:33 am, selecta <gr...@delarue-berlin.de> wrote:
>
> > > maybe it is also a mistake to state default=0
> > > try with default=None or without the default value
>
> > > On Jan 29, 4:19 pm, selecta <gr...@delarue-berlin.de> wrote:
>
> > > > guess this has something to do with how i define the table
> > > > i would guess this line does not work
> > > > Field('parent', 'reference plugin_webfolder_files', default=0,
> > > > requires = IS_IN_DB(db,'plugin_webfolder_files.id','%(name)s'))
> > > > you can exchange it with
> > > > Field('parent', 'integer', default=0, requires = IS_IN_DB
> > > > (db,'plugin_webfolder_files.id','%(name)s'))
>
> > > > a web2py expert should look into this since it should work i guess
>
> > > > On Jan 29, 1:48 pm, leone <handja...@gmail.com> wrote:
>
> > > > > Using postgres i debug
> > > > > IntegrityError: insert or update on table "plugin_webfolder_files"
> > > > > violates foreign key constraint "plugin_webfolder_files_parent_fkey"
> > > > > DETAIL:  Key (parent)=(0) is not present in table
> > > > > "plugin_webfolder_files".
> > > > > Have you a suggest?
>
> > > > > On 29 Gen, 10:38, selecta <gr...@delarue-berlin.de> wrote:
>
> > > > > > Here is a webfolder plug-in. It is still quite 
> > > > > > raw.http://jaguar.biologie.hu-berlin.de/~fkrause/web2py.plugin.webfolder.w2p
> > > > > > Feel free to use and improve it.
>
> > > > > > It depends on an improved IS_IN_SET validator. To use the plug-in 
> > > > > > you
> > > > > > need to replace the constructor of IS_IN_SET (gluon/validators.py)
> > > > > > with
>
> > > > > > def __init__(
> > > > > >         self,
> > > > > >         theset,
> > > > > >         labels=None,
> > > > > >         error_message='value not allowed',
> > > > > >         multiple=False,
> > > > > >         zero='',
> > > > > >         sort=False,
> > > > > >         ):
> > > > > >         self.multiple = multiple
> > > > > >         self.labels = labels
> > > > > >         if theset and (isinstance(theset[0], list) or 
> > > > > > isinstance(theset
> > > > > > [0], tuple)) and len(theset[0])==2:
> > > > > >             self.theset = [str(item) for item,label in theset]
> > > > > >             self.labels = [str(label) for item,label in theset]
> > > > > >         else:
> > > > > >             self.theset = [str(item) for item in theset]
> > > > > >         if isinstance(theset, dict):
> > > > > >             self.labels = theset.values()
> > > > > >         self.error_message = error_message
> > > > > >         self.zero = zero
> > > > > >         self.sort = sort

-- 
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