示例#1
0
文件: AF_Base.py 项目: deju/afw_old
    def get_all_lib(self, blog):
        self.picture_lib = []
        self.equation_lib = []
        self.langcode_lib = []
        self.tableform_lib = []
        self.reference_lib = []
        
        img_lib = blog.picture_lib
        math_lib = blog.equation_lib
        code_lib = blog.langcode_lib
        table_lib = blog.tableform_lib
        ref_lib = blog.reference_lib

        pic_con = Picture.get_instances('_id', img_lib.load_all().values())
        ref_con = Reference.get_instances('_id', ref_lib.load_all().values())
        code_con = Langcode.get_instances('_id', code_lib.load_all().values())
        math_con = Equation.get_instances('_id', math_lib.load_all().values())
        table_con = Tableform.get_instances('_id', table_lib.load_all().values())

        for iii in pic_con:
            self.picture_lib.append({'alias':iii.alias, 'name':iii.name, 'thumb_name':iii.thumb_name})
        for iii in ref_con:
            self.reference_lib.append({'alias':iii.alias, 'name':iii.name, 'url':iii.url, 'body':iii.body})
        for iii in code_con:
            self.langcode_lib.append({'alias':iii.alias, 'name':iii.name, 'lang':iii.lang, 'body':iii.code})
        for iii in math_con:
            self.equation_lib.append({'alias':iii.alias, 'name':iii.name, 'mode':iii.mode, 'body':iii.equation})
        for iii in table_con:
            self.tableform_lib.append({'alias':iii.alias, 'name':iii.name, 'body':iii.tableform})   
示例#2
0
    def get_all_lib(self, blog):
        self.picture_lib = []
        self.equation_lib = []
        self.langcode_lib = []
        self.tableform_lib = []
        self.reference_lib = []

        img_lib = blog.picture_lib
        math_lib = blog.equation_lib
        code_lib = blog.langcode_lib
        table_lib = blog.tableform_lib
        ref_lib = blog.reference_lib

        pic_con = Picture.get_instances('_id', img_lib.load_all().values())
        ref_con = Reference.get_instances('_id', ref_lib.load_all().values())
        code_con = Langcode.get_instances('_id', code_lib.load_all().values())
        math_con = Equation.get_instances('_id', math_lib.load_all().values())
        table_con = Tableform.get_instances('_id',
                                            table_lib.load_all().values())

        for iii in pic_con:
            self.picture_lib.append({
                'alias': iii.alias,
                'name': iii.name,
                'thumb_name': iii.thumb_name
            })
        for iii in ref_con:
            self.reference_lib.append({
                'alias': iii.alias,
                'name': iii.name,
                'url': iii.url,
                'body': iii.body
            })
        for iii in code_con:
            self.langcode_lib.append({
                'alias': iii.alias,
                'name': iii.name,
                'lang': iii.lang,
                'body': iii.code
            })
        for iii in math_con:
            self.equation_lib.append({
                'alias': iii.alias,
                'name': iii.name,
                'mode': iii.mode,
                'body': iii.equation
            })
        for iii in table_con:
            self.tableform_lib.append({
                'alias': iii.alias,
                'name': iii.name,
                'body': iii.tableform
            })
示例#3
0
def fun_get_article_src(target):
    # target is blog or about 
    pic_lib_result = []
    math_lib_result = []
    code_lib_result = []
    table_lib_result = []
    ref_lib_result = []

    img_lib = target.picture_lib
    math_lib = target.equation_lib
    code_lib = target.langcode_lib
    table_lib = target.tableform_lib
    ref_lib = target.reference_lib

    pic_con = Picture.get_instances('_id', img_lib.load_all().values())
    ref_con = Reference.get_instances('_id', ref_lib.load_all().values())
    code_con = Langcode.get_instances('_id', code_lib.load_all().values())
    math_con = Equation.get_instances('_id', math_lib.load_all().values())
    table_con = Tableform.get_instances('_id', table_lib.load_all().values())

    #tmp = {'alias':}
    for iii in pic_con:
        pic_lib_result.append({'alias':iii.alias, 'name':iii.name, 'thumb_name':iii.thumb_name})
    #print pic_lib_result

    for iii in ref_con:
        ref_lib_result.append({'alias':iii.alias, 'name':iii.name, 'url':iii.url, 'body':iii.body})
    #print ref_lib_result

    for iii in code_con:
        code_lib_result.append({'alias':iii.alias, 'name':iii.name, 'lang':iii.lang, 'body':iii.code})
    #print code_lib_result

    for iii in math_con:
        math_lib_result.append({'alias':iii.alias, 'name':iii.name, 'mode':iii.mode, 'body':iii.equation})
    #print math_lib_result

    for iii in table_con:
        table_lib_result.append({'alias':iii.alias, 'name':iii.name, 'body':iii.tableform})
    #print table_lib_result

    return [pic_lib_result, ref_lib_result, code_lib_result, math_lib_result, table_lib_result]
示例#4
0
def fun_get_article_src(target):
    # target is blog or about
    pic_lib_result = []
    math_lib_result = []
    code_lib_result = []
    table_lib_result = []
    ref_lib_result = []

    img_lib = target.picture_lib
    math_lib = target.equation_lib
    code_lib = target.langcode_lib
    table_lib = target.tableform_lib
    ref_lib = target.reference_lib

    pic_con = Picture.get_instances('_id', img_lib.load_all().values())
    ref_con = Reference.get_instances('_id', ref_lib.load_all().values())
    code_con = Langcode.get_instances('_id', code_lib.load_all().values())
    math_con = Equation.get_instances('_id', math_lib.load_all().values())
    table_con = Tableform.get_instances('_id', table_lib.load_all().values())

    #tmp = {'alias':}
    for iii in pic_con:
        pic_lib_result.append({
            'alias': iii.alias,
            'name': iii.name,
            'thumb_name': iii.thumb_name
        })
    #print pic_lib_result

    for iii in ref_con:
        ref_lib_result.append({
            'alias': iii.alias,
            'name': iii.name,
            'url': iii.url,
            'body': iii.body
        })
    #print ref_lib_result

    for iii in code_con:
        code_lib_result.append({
            'alias': iii.alias,
            'name': iii.name,
            'lang': iii.lang,
            'body': iii.code
        })
    #print code_lib_result

    for iii in math_con:
        math_lib_result.append({
            'alias': iii.alias,
            'name': iii.name,
            'mode': iii.mode,
            'body': iii.equation
        })
    #print math_lib_result

    for iii in table_con:
        table_lib_result.append({
            'alias': iii.alias,
            'name': iii.name,
            'body': iii.tableform
        })
    #print table_lib_result

    return [
        pic_lib_result, ref_lib_result, code_lib_result, math_lib_result,
        table_lib_result
    ]