当前位置: 首页>>代码示例>>Python>>正文


Python Page.update方法代码示例

本文整理汇总了Python中models.Page.update方法的典型用法代码示例。如果您正苦于以下问题:Python Page.update方法的具体用法?Python Page.update怎么用?Python Page.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Page的用法示例。


在下文中一共展示了Page.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_page_post

# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def create_page_post(context, request):
    data = request.POST
    page = Page(data['title'])
    page.layout_template = u'master.html'
    for behaviour in data.getall('behaviour'):
        page.update(behaviour, data, behaviour + '.')
    context[data['uid']] = page
    location = model_url(page, request)
    return HTTPFound(location = location)
开发者ID:junkafarian,项目名称:jingle,代码行数:11,代码来源:views.py

示例2: rebuild

# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def rebuild(wipe_sysgen=False):
    '''
    Designed to be run from shell. 
    Will wipe DB and load data from file system.
    '''
    url_list = []
    for root, dirs, files in os.walk(PAGE_PATH):
        head = root.replace(PAGE_PATH, '')
        path = head.split(os.sep)
        for file in files:
            url = '/'.join(path + [file])
            if url[-1:] == '_':
                url = url[:-1]
            else:
                url = url + '/'
            print url
            url_list.append(url)

    confirm = raw_input('About to create {} pages. Ready to wipe DB ([y]/n)? '.format(len(url_list)))
    if confirm and confirm.upper() != 'Y':
        print 'Aborting...'
        sys.exit()
        
    print 'Deleting all Page data'
    Page.objects.all().delete()

    if wipe_sysgen:
        print 'Wiping sysgen'
        for file in os.listdir(SYSGEN_PATH):
            file_path = os.path.join(SYSGEN_PATH, file)
            if os.isdir(file_path):
                shutil.rmtree(file_path)
            else:
                os.unlink(file_path)

    for url in sorted(url_list):
        print 'Creating: ', url
        page = Page(url=url)
        page.update()
开发者ID:dulrich15,项目名称:spot,代码行数:41,代码来源:rebuild.py

示例3: rebuild

# 需要导入模块: from models import Page [as 别名]
# 或者: from models.Page import update [as 别名]
def rebuild(pull_docinfo=True, wipe_sysgen=False):
    '''
    Designed to be run from shell. 
    Will wipe DB and load data from file system.
    '''
    pg_list = []
    for root, dirs, files in os.walk(wiki_pages_path):
        head = root.replace(wiki_pages_path, '')
        path = head.split(os.sep)
        for file in files:
            pg = '/'.join(path + [file])
            if pg[-1:] == '_':
                pg = pg[:-1]
            else:
                pg = pg + '/'
            print pg
            pg_list.append(pg)

    confirm = raw_input('About to create {} pages. Ready to wipe DB ([y]/n)? '.format(len(pg_list)))
    if confirm and confirm.upper() != 'Y':
        print 'Aborting...'
        sys.exit()
        
    print 'Deleting all Page data'
    Page.objects.all().delete()

    if wipe_sysgen:
        print 'Wiping sysgen'
        for file in os.listdir(SYSGEN_FOLDER):
            file_path = os.path.join(SYSGEN_FOLDER, file)
            if os.isdir(file_path):
                shutil.rmtree(file_path)
            else:
                os.unlink(file_path)

    for pg in sorted(pg_list):
        print 'Creating: ', pg
        page = Page(pg=pg)
        page.update(pull_docinfo=pull_docinfo)
开发者ID:dulrich15,项目名称:lil-wiki,代码行数:41,代码来源:utils.py


注:本文中的models.Page.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。