AppConfig and % interpolation

39 views
Skip to first unread message

Ivan

unread,
Sep 27, 2016, 9:43:24 AM9/27/16
to web2py-users
If the .ini file contains an option with a % (eg a password), the AppConfig class raise an InterpolationSyntaxError exception.

Niphlod

unread,
Sep 27, 2016, 9:52:40 AM9/27/16
to web2py-users
and it's correct that it does, as it can work with json with doesn't have any interpolation facilities. if you want to interpolate, for the moment, use your app's code.

Ivan

unread,
Sep 27, 2016, 10:15:45 AM9/27/16
to web2py-users
I don't want to interpolate.
I have an option with a % inside and the AppConfig raises an exception.

Niphlod

unread,
Sep 27, 2016, 11:30:21 AM9/27/16
to web2py-users
hum. did you try excaping the % with % , which means basically having %% instead of % ?

Ivan

unread,
Sep 27, 2016, 12:56:10 PM9/27/16
to web2py-users
escaping % with % solves the problem
however I think it would be better to not force the user to escape each % in a .ini file

the exception comes from the ConfigParser python module (more precisely SafeConfigParser) used in AppConfig
maybe a better solution is to use RawConfigParser that doesn't interpolate at all

Niphlod

unread,
Sep 27, 2016, 3:10:16 PM9/27/16
to web2py-users
yep, ATM I'd go for rawconfigparser but someone asked for interpolation .... so we have two distinct "paths" . Just need to rule out one ^_^
Reply all
Reply to author
Forward
0 new messages