list:strings not working as described or am I missing something?

40 views
Skip to first unread message

Cliff Kachinske

unread,
Jun 27, 2014, 12:12:00 PM6/27/14
to web...@googlegroups.com

Web2py 2.8.2, if that matters.

The manual at web2py.com says, "On relational databases they [list:string fields] are mapped into text fields which contain the list of items separated by |. For example [1,2,3] is mapped into |1|2|3|.

I am getting something different.

The field shown at the top of this post Inserts the following into the Postgresql database.

pandi3=> select distinct lots_used from job_materials where lots_used is not null and is_active = 'T';
        lots_used        
--------------------------
 
|foo, bar, fubar, fubub|
(1 row)

From the manual's description I expect something like

foo|bar|fubar|fubub


I am using a custom validator that returns a list from the field.  Use it or not, I get the same results.

How do I fix this?  IS_IN_SET will not work here.

Anthony

unread,
Jun 27, 2014, 1:07:33 PM6/27/14
to web...@googlegroups.com
Hard to say without seeing any code, but clearly the database insert is not getting a list.

Cliff Kachinske

unread,
Jun 27, 2014, 4:48:18 PM6/27/14
to web...@googlegroups.com
Anthony,

Thanks for the shove in the right direction.

An ajax callback processes that field and I had forgotten to run it through the validator.

So the db was inserting the entire string instead of list members.
Reply all
Reply to author
Forward
0 new messages