Added first tests
This commit is contained in:
parent
0d57d44037
commit
4a67d7b189
4 changed files with 391 additions and 4 deletions
|
|
@ -18,6 +18,8 @@ def make_url(path, query_args={}):
|
|||
|
||||
get_query='?'+urllib.parse.urlencode(query_args)
|
||||
|
||||
path=urllib.parse.quote_plus(path, safe='/')
|
||||
|
||||
return config.application_root+path+get_query
|
||||
|
||||
def make_url_domain(path, query_args={}):
|
||||
|
|
@ -48,7 +50,6 @@ def make_external_url(path, query_args={}):
|
|||
|
||||
if len(query_args)>0:
|
||||
|
||||
#get_query='?'+"&".join( [x+'='+y for x,y in query_args.items()] )
|
||||
get_query='?'+urllib.parse.urlencode(query_args)
|
||||
|
||||
return path+get_query
|
||||
|
|
@ -65,13 +66,14 @@ if config.yes_static==True:
|
|||
module -- the module where you can find the resource
|
||||
"""
|
||||
|
||||
return config.media_url+'mediafrom/'+module+'/'+file_path
|
||||
return make_url('mediafrom/'+urllib.parse.quote_plus(module)+'/'+urllib.parse.quote_plus(file_path, safe='/'))
|
||||
#config.media_url+'mediafrom/'+module+'/'+file_path
|
||||
else:
|
||||
|
||||
def make_media_url(file_path, module):
|
||||
|
||||
"""
|
||||
This is a method for create urls for media resources.
|
||||
This is a method for create urls for media resources if config.yes_static is disabled..
|
||||
|
||||
Keyword arguments:
|
||||
file_path -- The relative path of module
|
||||
|
|
@ -79,4 +81,4 @@ else:
|
|||
|
||||
"""
|
||||
|
||||
return config.media_url+'media/'+module+'/'+file_path
|
||||
return config.media_url+'media/'+urllib.parse.quote_plus(module)+'/'+urllib.parse.quote_plus(file_path, safe='/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue