url.py 文件源码

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

项目:health-mosconi 作者: GNUHealth-Mosconi 项目源码 文件源码
def __get__(self, inst, cls):
        from trytond.model import Model
        from trytond.wizard import Wizard
        from trytond.report import Report

        url_part = {}
        if issubclass(cls, Model):
            url_part['type'] = 'model'
        elif issubclass(cls, Wizard):
            url_part['type'] = 'wizard'
        elif issubclass(cls, Report):
            url_part['type'] = 'report'
        else:
            raise NotImplementedError

        url_part['name'] = cls.__name__
        url_part['database'] = Transaction().cursor.database_name

        local_part = urllib.quote('%(database)s/%(type)s/%(name)s' % url_part)
        if isinstance(inst, Model) and inst.id:
            local_part += '/%d' % inst.id
        return 'tryton://%s/%s' % (HOSTNAME, local_part)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号