Permalink
Browse files

defaults meiyong

  • Loading branch information...
1 parent 7186b7c commit d3c211fb8e2a4316d944e6816d7eb91621c887b3 @dantezhu committed Dec 4, 2012
Showing with 5 additions and 12 deletions.
  1. +1 −1 example/templates/index.html
  2. +3 −10 flask_util_js.py
  3. +1 −1 setup.py
@@ -12,7 +12,7 @@
var url = flask_util.url_for('sub.bpt_index', {y:2, x:'/sdf'});
alert(url);
- url = flask_util.url_for('show_id', {myname:'dante'});
+ url = flask_util.url_for('show_id', {myid:'dante'});
alert(url);
</script>
</head>
View
@@ -21,11 +21,12 @@
# 0.2.0 | dantezhu | 2012-10-22 21:53:14 | 优化为实例的方式
# 0.2.3 | dantezhu | 2012-11-20 11:13:22 | 增加no cache
# 0.2.4 | dantezhu | 2012-11-30 10:58:13 | content-type
+# 0.2.5 | dantezhu | 2012-12-04 11:41:15 | defaults不需要,缺少params报异常
#
#=============================================================================
'''
-__version__ = (0, 2, 4)
+__version__ = (0, 2, 5)
from flask import Response
from flask import render_template_string, json
@@ -71,13 +72,6 @@
return '';
}
var rule = url_map[endpoint]['rule'];
- var defaults = url_map[endpoint]['defaults'];
-
- for(var k in defaults) {
- if (!(k in params)) {
- params[k] = defaults[k];
- }
- }
var used_params = {};
@@ -89,7 +83,7 @@
used_params[_1] = params[_1];
return url_encode(params[_1]);
} else {
- return '';
+ throw(_1 + ' does not exist in params');
}
});
@@ -159,7 +153,6 @@ def flask_util_js():
for k,v in org_url_map.items():
url_map[k] = dict(
rule=v[0].rule,
- defaults=v[0].defaults or {},
)
json_url_map = json.dumps(url_map, indent=4, ensure_ascii=False)
View
@@ -2,7 +2,7 @@
setup(
name="flask_util_js",
- version="0.2.4",
+ version="0.2.5",
zip_safe=False,
platforms='any',
py_modules=['flask_util_js'],

0 comments on commit d3c211f

Please sign in to comment.