You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created um method in my application for improve the organization of my views, I don't know if the code it's interesting for be used as internal resource of bottle library.
importbottlefromosimportlistdirfromos.pathimportdirname, realpath, join, isdirdefconfig_views_directory(all_subdirs=False):
""" config the path of views """abs_app_dir_path=dirname(realpath(__file__))
abs_views_path=join(abs_app_dir_path, 'views')
index=0# insert the path of viewsbottle.TEMPLATE_PATH.insert(index, abs_views_path)
# verify the directorydefprocess_directory(index, path):
""" process the directory """forfile_nameinlistdir(path):
next_path=join(path, file_name)
# verify the directoryifisdir(next_path):
index+=1# insert the path of viewsbottle.TEMPLATE_PATH.insert(index, next_path)
# checks to process all subdirectoriesifall_subdirs:
index=process_directory(index, next_path)
returnindexprocess_directory(index, abs_views_path)
The text was updated successfully, but these errors were encountered:
parg-programador
changed the title
Method to use subdirectories for views
Method to use subdirectories for the views
Jun 8, 2019
One thing that I forgot comment it's that when I create new views files I take care to not create files with same names, even if they are in different subdirectories.
I created um method in my application for improve the organization of my views, I don't know if the code it's interesting for be used as internal resource of bottle library.
The text was updated successfully, but these errors were encountered: