@@ -145,10 +145,10 @@ def main():
145
145
# Handle requests with simple template handler
146
146
simple_dir = {"welcome.template" : "<p>Hello world</p>" ,
147
147
"about.template" : "<p>About me</p>" }
148
+ simple_handler = TemplateFolderHandler (simple_dir )
148
149
welcome_from_nobody = Request ("/welcome.template" , "nobody" )
149
150
about_from_nobody = Request ("/about.template" , "nobody" )
150
151
foo_from_nobody = Request ("/foo.bar" , "nobody" )
151
- simple_handler = TemplateFolderHandler (simple_dir )
152
152
assert simple_handler .handle (welcome_from_nobody ) == "<p>Hello world</p>"
153
153
assert simple_handler .handle (about_from_nobody ) == "<p>About me</p>"
154
154
assert simple_handler .handle (foo_from_nobody ) == "<p>Invalid entry for /foo.bar</p>"
@@ -157,11 +157,11 @@ def main():
157
157
admin_users = {"john" , "jane" }
158
158
admin_dir = {"fqdn.template" : "<p>server.example.com</p>" ,
159
159
"salary.template" : "<p>123456789.00</p>" }
160
+ admin_handler = AdminTemplateHandler (admin_users , admin_dir )
160
161
fqdn_from_john = Request ("/fqdn.template" , "john" )
161
162
salary_from_jane = Request ("/salary.template" , "jane" )
162
163
salary_from_nobody = Request ("/salary.template" , "nobody" )
163
164
foo_from_john = Request ("/foo.bar" , "john" )
164
- admin_handler = AdminTemplateHandler (admin_users , admin_dir )
165
165
assert admin_handler .handle (fqdn_from_john ) == "<p>server.example.com</p>"
166
166
assert admin_handler .handle (salary_from_jane ) == "<p>123456789.00</p>"
167
167
assert admin_handler .handle (salary_from_nobody ) == "<p>Access denied for /salary.template</p>"
0 commit comments