diff --git a/CHANGELOG b/CHANGELOG index 6ea5fed..8c1566d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +2013-6-10 Freedom Dumlao + + Version 0.6.1 + + - Bugfixes + * Fixed a bug when raising the DecoratorCompatibilityError. + + - Thanks: + * Thanks to Ivan Kleshnin, who found and fixed the bug. + + 2013-6-5 Freedom Dumlao Version 0.6 diff --git a/docs/conf.py b/docs/conf.py index 1d48bd6..0b59f27 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ # built documents. # # The short X.Y version. -version = '0.6' +version = '0.6.1' # The full version, including alpha/beta/rc tags. -release = '0.6' +release = '0.6.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/flask_classy.py b/flask_classy.py index 1d18994..46f04f5 100644 --- a/flask_classy.py +++ b/flask_classy.py @@ -94,37 +94,39 @@ def register(cls, app, route_base=None, subdomain=None): proxy = cls.make_proxy_method(name) route_name = cls.build_route_name(name) try: - if hasattr(cls, "_rule_cache") and name in cls._rule_cache: - for idx, cached_rule in enumerate(cls._rule_cache[name]): - rule, options = cached_rule - rule = cls.build_rule(rule) - sub, ep, options = cls.parse_options(options) - - if not subdomain and sub: - subdomain = sub - - if ep: - endpoint = ep - elif len(cls._rule_cache[name]) == 1: - endpoint = route_name + for _cls in cls.mro()[:-1]: + if hasattr(_cls, "_rule_cache") and name in _cls._rule_cache: + for idx, cached_rule in enumerate(_cls._rule_cache[name]): + rule, options = cached_rule + rule = _cls.build_rule(rule) + sub, ep, options = _cls.parse_options(options) + + if not subdomain and sub: + subdomain = sub + + if ep: + endpoint = ep + elif len(_cls._rule_cache[name]) == 1: + endpoint = route_name + else: + endpoint = "%s_%d" % (route_name, idx,) + + app.add_url_rule(rule, endpoint, proxy, subdomain=subdomain, **options) + break + else: + if name in special_methods: + if name in ["get", "index"]: + methods = ["GET"] else: - endpoint = "%s_%d" % (route_name, idx,) - - app.add_url_rule(rule, endpoint, proxy, subdomain=subdomain, **options) - - elif name in special_methods: - if name in ["get", "index"]: - methods = ["GET"] - else: - methods = [name.upper()] + methods = [name.upper()] - rule = cls.build_rule("/", value) + rule = cls.build_rule("/", value) - app.add_url_rule(rule, route_name, proxy, methods=methods, subdomain=subdomain) + app.add_url_rule(rule, route_name, proxy, methods=methods, subdomain=subdomain) - else: - rule = cls.build_rule('/%s/' % name, value,) - app.add_url_rule(rule, route_name, proxy, subdomain=subdomain) + else: + rule = cls.build_rule('/%s/' % name, value,) + app.add_url_rule(rule, route_name, proxy, subdomain=subdomain) except DecoratorCompatibilityError: raise DecoratorCompatibilityError("Incompatible decorator detected on %s in class %s" % (name, cls.__name__)) diff --git a/setup.py b/setup.py index be8a5b7..f258966 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='Flask-Classy', - version='0.6', + version='0.6.1', url='https://github.com/apiguy/flask-classy', license='BSD', author='Freedom Dumlao',