@@ -35,12 +35,21 @@ def _disp_images(request):
35
35
username = params ['username' ]
36
36
userpass = params ['userpass' ]
37
37
is_login = __can_login (username , userpass )
38
+ print ('hoge' )
38
39
if 'sid' in request .cookies :
39
40
sid = request .cookies ['sid' ]
40
41
is_login = __has_valid_cookie (sid )
42
+ print ('hogew' )
41
43
if not is_login :
42
44
return _disp_login (request , u'Failur in login!!!' )
43
45
image_paths = []
46
+ for r , d , fs in os .walk (PUBLIC_DIR ):
47
+ for f in fs :
48
+ _p = os .path .join (r , f )
49
+
50
+ print (_p )
51
+ print (os .path .join ('static' , _p .lstrip (PUBLIC_DIR )))
52
+ image_paths .append (os .path .join ('static' , _p .lstrip (PUBLIC_DIR )))
44
53
params = {}
45
54
params ['images' ] = image_paths
46
55
response = render_to_response (
@@ -71,7 +80,8 @@ def __add_routes(config):
71
80
config .add_view (_disp_images , route_name = 'images' )
72
81
config .add_route ('logout' , '/logout' )
73
82
config .add_view (_logout , route_name = 'logout' )
74
- config .add_static_view ('static' , 'static' )
83
+ config .add_static_view ('static' , PUBLIC_DIR )
84
+ #config.add_static_view('static', 'static')
75
85
76
86
77
87
def execute ():
@@ -94,6 +104,7 @@ def execute():
94
104
p .add_argument ('public_dir' , help = p_h )
95
105
args = p .parse_args ()
96
106
PUBLIC_DIR = os .path .abspath (args .public_dir )
107
+ print (PUBLIC_DIR )
97
108
if not os .path .isdir (PUBLIC_DIR ):
98
109
print ('public_dir doesn\' t exist!' )
99
110
quit ()
0 commit comments