Enhance welcome routes.example.py PEP8

This commit is contained in:
Hardirc
2016-04-08 20:13:58 -04:00
parent 704ceec16f
commit 1d2f74440e
+15 -12
View File
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
# This is an app-specific example router # This is an app-specific example router
# #
# This simple router is used for setting languages from app/languages directory # This simple router is used for setting languages from app/languages directory
@@ -8,31 +9,33 @@
# a default_language # a default_language
# #
# See <web2py-root-dir>/examples/routes.parametric.example.py for parameter's detail # See <web2py-root-dir>/examples/routes.parametric.example.py for parameter's detail
#------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
# To enable this route file you must do the steps: # To enable this route file you must do the steps:
#
# 1. rename <web2py-root-dir>/examples/routes.parametric.example.py to routes.py # 1. rename <web2py-root-dir>/examples/routes.parametric.example.py to routes.py
# 2. rename this APP/routes.example.py to APP/routes.py # 2. rename this APP/routes.example.py to APP/routes.py (where APP - is your application directory)
# (where APP - is your application directory) # 3. restart web2py (or reload routes in web2py admin interface)
# 3. restart web2py (or reload routes in web2py admin interfase)
# #
# YOU CAN COPY THIS FILE TO ANY APPLICATION'S ROOT DIRECTORY WITHOUT CHANGES! # YOU CAN COPY THIS FILE TO ANY APPLICATION'S ROOT DIRECTORY WITHOUT CHANGES!
# ----------------------------------------------------------------------------------------------------------------------
from fileutils import abspath from fileutils import abspath
from languages import read_possible_languages from languages import read_possible_languages
possible_languages = read_possible_languages(abspath('applications', app)) possible_languages = read_possible_languages(abspath('applications', app))
#NOTE! app - is an application based router's parameter with name of an # ----------------------------------------------------------------------------------------------------------------------
# application. E.g.'welcome' # NOTE! app - is an application based router's parameter with name of an application. E.g.'welcome'
# ----------------------------------------------------------------------------------------------------------------------
routers = { routers = {
app: dict( app: dict(
default_language = possible_languages['default'][0], default_language=possible_languages['default'][0],
languages = [lang for lang in possible_languages languages=[lang for lang in possible_languages if lang != 'default']
if lang != 'default']
) )
} }
#NOTE! To change language in your application using these rules add this line # ----------------------------------------------------------------------------------------------------------------------
#in one of your models files: # NOTE! To change language in your application using these rules add this line in one of your models files:
# ----------------------------------------------------------------------------------------------------------------------
# if request.uri_language: T.force(request.uri_language) # if request.uri_language: T.force(request.uri_language)