views.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:statik 作者: thanethomson 项目源码 文件源码
def configure(self):
        # process the parsed view variables
        if 'path' not in self.vars:
            raise MissingParameterError("Missing variable \"path\" in view: %s" % self.name)
        self.path = self.vars['path']

        # if it's a complex view
        if isinstance(self.path, dict):
            self.configure_complex_view(self.path)
        elif isinstance(self.path, basestring):
            self.configure_simple_view(self.path)
        else:
            raise ValueError("Unrecognised structure for \"path\" configuration in view: %s" % self.name)

        # if we don't have a template yet
        if self.template is None:
            # try to load it
            if 'template' not in self.vars:
                raise MissingParameterError("Missing variable \"template\" in view: %s" % self.name)
            self.template = self.template_engine.load_template(self.vars['template'])

        self.configure_context()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号