示例#1
0
文件: namespace.py 项目: zoot/cli
    def serialize(self):
        yield Comment('Namespace: {0}'.format(self.name))
        yield CommandCall([Symbol(self.name)])

        yield [i for i in self.serialize_nested()]

        yield CommandCall([Symbol('..')])
示例#2
0
文件: namespace.py 项目: zoot/cli
    def serialize(self):
        self.on_enter()

        def do_prop(prop):
            value = prop.do_get(self.entity)
            return CommandCall([
                Symbol('set'),
                BinaryParameter(prop.name, '=', self.literalize_value(value))
            ])

        yield Comment('Namespace: {0}'.format(self.name))
        yield CommandCall([Symbol(self.name)])
        for j in self.property_mappings:
            if not j.get:
                continue
            if not j.set:
                continue
            yield do_prop(j)
        yield [i for i in self.serialize_nested()]

        yield CommandCall([Symbol('..')])