[Cubicweb] [PATCH] Syntax error on newly created cube

Nicolas Chauvat nicolas.chauvat at logilab.fr
Thu Nov 20 10:48:58 CET 2014


Hi Victor,

Welcome to this list.

On Sun, Nov 16, 2014 at 07:49:25PM +0100, Victor ADAM wrote:
> When creating a new cube, user input is not properly escaped. This can
> end up generating syntactically invalid Python files. For example, if
> the user-provided description is “corsaire de l'espace”, the generated
> __pkginfo__.py will contain:
> description = 'corsaire de l'espace'
> which is a syntax error because of the stray single quote.
> 
> One solution to this problem would be to use %r instead of '%s' inside
> all .py.tmpl files. Another solution (the one I implemented) is to alter
> fill_templated_file to escape all strings before filling a Python file.
> Note that the .spec and README files do not require this escaping.
> 
> Here is the patch:

Thank you for the patch.

I created a ticket and referenced your email at
https://www.cubicweb.org/ticket/4603880

If you do not see it moving in the next few days, make sure you email
this list to ping the people that merge contributions into the main
repository.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list