Mercurial > hg > bitsyblog
comparison bitsyblog/factory.py @ 71:0c98d1c2c6df
fix syntax errors
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 08 Jul 2010 10:40:43 -0700 |
parents | f6a6a4b072e7 |
children | e6055bf127eb |
comparison
equal
deleted
inserted
replaced
70:f6a6a4b072e7 | 71:0c98d1c2c6df |
---|---|
21 handler_args = {} | 21 handler_args = {} |
22 for key, value in app_conf.items(): | 22 for key, value in app_conf.items(): |
23 if key.startswith(key_str): | 23 if key.startswith(key_str): |
24 key = key.split(key_str, 1)[-1] | 24 key = key.split(key_str, 1)[-1] |
25 if key in config: | 25 if key in config: |
26 bitysblog_args[key] = value | 26 bitsyblog_args[key] = value |
27 else: | 27 else: |
28 if '.' in key: | 28 if '.' in key: |
29 section, key = key.split('.', 1) | 29 section, key = key.split('.', 1) |
30 handler_args.setdefault(section, {})[key] = value | 30 handler_args.setdefault(section, {})[key] = value |
31 return bitsyblog_args, handler_args | 31 return bitsyblog_args, handler_args |
32 | 32 |
33 def factory(global_conf, **app_conf): | 33 def factory(global_conf, **app_conf): |
34 """make bitsyauth app and wrap it in middleware""" | 34 """make bitsyauth app and wrap it in middleware""" |
35 bitsyblog_args, handler_args = get_args(app_conf) | 35 bitsyblog_args, handler_args = get_args(app_conf) |
36 app = BitsyBlog(**args) | 36 app = BitsyBlog(bitsyblog_args, handler_args) |
37 secret = app_conf.get('secret', 'secret') | 37 secret = app_conf.get('secret', 'secret') |
38 return BitsyAuth(HTTPExceptionHandler(app), | 38 return BitsyAuth(HTTPExceptionHandler(app), |
39 global_conf, | 39 global_conf, |
40 app.passwords, | 40 app.passwords, |
41 app.newuser, | 41 app.newuser, |
45 | 45 |
46 def bitsierfactory(global_conf, **app_conf): | 46 def bitsierfactory(global_conf, **app_conf): |
47 """make single-user bitsyblog""" | 47 """make single-user bitsyblog""" |
48 bitsyblog_args, handler_args = get_args(app_conf) | 48 bitsyblog_args, handler_args = get_args(app_conf) |
49 user = app_conf['bitsyblog.user'] # ensure this exist | 49 user = app_conf['bitsyblog.user'] # ensure this exist |
50 app = BitsierBlog(**args) | 50 app = BitsierBlog(bitsyblog_args, handler_args) |
51 app.user = user | 51 app.user = user |
52 secret = app_conf.get('secret', 'secret') | 52 secret = app_conf.get('secret', 'secret') |
53 auth = BitsyAuth(HTTPExceptionHandler(app), | 53 auth = BitsyAuth(HTTPExceptionHandler(app), |
54 global_conf, | 54 global_conf, |
55 app.passwords, | 55 app.passwords, |