2
class ControllerType(type):
4
def __new__(cls, name, bases, attrs):
6
obj = super(ControllerType, cls).__new__(cls, name, bases, attrs)
7
path = attrs.get("_cp_path")
9
if "path" in attrs and name != "BaseController":
10
raise Exception("Can't override 'path' attribute.")
13
if not path.startswith("/"):
14
raise Exception("Invalid path '%s', should start with '/'." % (path))
18
class BaseController(object):
20
__metaclass__ = ControllerType
25
return super(BaseController, cls).__new__(cls)
30
path = property(_get_path)