if you want to end up with a tuple (as VCARDID_NAVLIST is), you can convert 
the list:reference string with:

    navlist=VCARDID_NAVLIST + tuple(form.vars.navID[1:-1].split('|'))




On Thursday, August 22, 2013 5:58:51 AM UTC-5, Annet wrote:
>
> I have these constants:
>
> INTERFACENAVID=19
> CRUDINTERFACENAVID=20
> SWITCHBOARDNAVID=21
> INTERFACESETTINGSNAVID=22
> FUNCTIONSETTINGSNAVID=23
> LAYOUTNAVID=24
> STYLENAVID=25
> YOURSTYLENAVID=26
> SMARTLINKSNAVID=27
> DOWNLOADVCARDNAVID=28
> GOOGLEMAPSNAVID=29
> QRCODENAVID=30
> TEXTNAVID=31
> WORDMARKNAVID=32
> HEADLINENAVID=33
> VALUEPROPOSITIONNAVID=34
> HOMEPAGENAVID=35
> PROMONAVID=36
>
>
> FREEVCARDID_NAVLIST=STYLENAVID,SMARTLINKSNAVID,HEADLINENAVID
>
> VCARDID_NAVLIST=LAYOUTNAVID,STYLENAVID,SMARTLINKSNAVID,DOWNLOADVCARDNAVID,QRCODENAVID,HEADLINENAVID,VALUEPROPOSITIONNAVID
>
>
> In a function I have the following code:
>
> if categoryID==FREEVCARDID:
>     navlist=FREEVCARDID_NAVLIST
> elif categoryID==VCARDID:
>     navlist=VCARDID_NAVLIST + form.vars.navID # this is a list:reference
> navs=db(db.nav.id.belongs(navlist)).select(orderby=db.nav.id)
>
> This  works for categoryID=FREEVCARDID but returns the following error for 
> categoryID=VCARDID:
>
> TypeError: can only concatenate tuple (not "list") to tuple
>
>
>  I thought I'd change my code to:
>
>  tmpnavlist=[VCARDID_NAVLIST] + form.vars.navID 
>  navlist=tuple(tmpnavlist)
>
> but that returns the following error:
>
> File "/Users/annet/web2py/applications/mock/controllers/cmsinterface.py" 
> <http://127.0.0.1:8000/admin/default/edit/mock/controllers/cmsinterface.py>, 
> line 135, in crudInterface
> navs=db(db.nav.id.belongs(navlist)).select(orderby=db.nav.id)
>
> ....
>
> ValueError: invalid literal for int() with base 10: 
> '|24|25|27|28|30|33|34|38|39|48|'
>
>
> Is there a way to solve this problem?
>
>
> Kind regards,
>
> Annet
>
>
>

-- 

--- 
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/groups/opt_out.

Reply via email to