[Kimchi-devel] [PATCH 2/3] Fix pep8 in src/kimchi/template.py
Aline Manera
alinefm at linux.vnet.ibm.com
Tue Apr 1 18:56:23 UTC 2014
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 03/28/2014 06:34 PM, Rodrigo Trujillo wrote:
> Fix minor pep8 issues.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> src/kimchi/template.py | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/src/kimchi/template.py b/src/kimchi/template.py
> index 9bb2da5..60cd818 100644
> --- a/src/kimchi/template.py
> +++ b/src/kimchi/template.py
> @@ -15,7 +15,7 @@
> #
> # You should have received a copy of the GNU Lesser General Public
> # License along with this library; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>
> import cherrypy
> import errno
> @@ -62,7 +62,7 @@ def validate_language(langs):
>
>
> def can_accept(mime):
> - if not cherrypy.request.headers.has_key('Accept'):
> + if not 'Accept' in cherrypy.request.headers:
> accepts = 'text/html'
> else:
> accepts = cherrypy.request.headers['Accept']
> @@ -75,14 +75,17 @@ def can_accept(mime):
>
> return False
>
> +
> def can_accept_html():
> return can_accept('text/html') or \
> - can_accept('application/xaml+xml') or \
> - can_accept('*/*')
> + can_accept('application/xaml+xml') or \
> + can_accept('*/*')
> +
>
> def render(resource, data):
> if can_accept('application/json'):
> - cherrypy.response.headers['Content-Type'] = 'application/json;charset=utf-8'
> + cherrypy.response.headers['Content-Type'] = \
> + 'application/json;charset=utf-8'
> return json.dumps(data, indent=2, separators=(',', ':'))
> elif can_accept_html():
> paths = cherrypy.request.app.root.paths
More information about the Kimchi-devel
mailing list