• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python misc.kwargs_from_params函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中misc.kwargs_from_params函数的典型用法代码示例。如果您正苦于以下问题:Python kwargs_from_params函数的具体用法?Python kwargs_from_params怎么用?Python kwargs_from_params使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: task_post

def task_post(environ, start_response):
    request = environ['werkzeug.request']
    board = environ['waka.board']

    params = {'form':     ['parent', 'field1', 'email', 'subject', 'comment',
                           'password', 'nofile', 'captcha', 'no_captcha',
                           'no_format', 'sticky', 'lock', 'adminpost'],
              'cookies':  ['wakaadmin'],
              'file':     ['file']}
   
    kwargs = kwargs_from_params(request, params)
 
    kwargs['name'] = kwargs.pop('field1')
    kwargs['oekaki_post'] = kwargs['srcinfo'] = kwargs['pch'] = None
    kwargs['admin_post_mode'] = kwargs.pop('adminpost')
    if kwargs['no_format'] == '0':
        kwargs['no_format'] = False

    if kwargs['admin_post_mode']:
        kwargs['action'] = 'admin_post'
        kwargs['board'] = board
        return StaffAction(**kwargs).execute()
    
    del kwargs['admin']
    return board.post_stuff(**kwargs)
开发者ID:mouhtasi,项目名称:wakarimasen,代码行数:25,代码来源:app.py


示例2: task_addipfrompopup

def task_addipfrompopup(environ, start_response):
    request = environ['werkzeug.request']
    board = environ['waka.board']

    params = {'form': ['ip', 'mask', 'total', 'expiration', 'comment', 'delete',
                       'deleteall_confirm', 'globaldeleteall_confirm'],
              'cookies': ['wakaadmin']}

    kwargs = kwargs_from_params(request, params)
    kwargs['action'] = 'admin_entry'
    kwargs['option'] = 'ipban'
    kwargs['caller'] = 'window'
    delete = kwargs.pop('delete')
    delete_all = kwargs.pop('deleteall_confirm')
    globaldelete_all = kwargs.pop('globaldeleteall_confirm')

    try:
        if globaldelete_all:
            StaffAction(kwargs['admin'], 'delete_by_ip_global',
                        ip=kwargs['ip']).execute()
        elif delete_all:
            StaffAction(kwargs['admin'], 'delete_by_ip',
                        ip=kwargs['ip'], board=board).execute()
        elif delete:
            StaffAction(kwargs['admin'], 'admin_delete', board=board,
                        posts=[delete], from_window=True, password='',
                        file_only=False, archiving=False, caller='internal')\
                .execute()
    except WakaError:
        pass

    make_cookies(ban_mask=kwargs['mask'], ban_expiration=kwargs['expiration'],
        ban_comment=kwargs['comment'])

    return StaffAction(**kwargs).execute()
开发者ID:k-anon,项目名称:wakarimasen,代码行数:35,代码来源:app.py


示例3: task_setup

def task_setup(environ, start_response):
    request = environ['werkzeug.request']

    params = {'form': ['admin', 'username', 'password']}
    kwargs = kwargs_from_params(request, params)

    return staff_interface.do_first_time_setup(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:7,代码来源:app.py


示例4: task_delete

def task_delete(environ, start_response, archiving=False):
    # TODO review compatibility with wakaba or refactor
    request = environ['werkzeug.request']
    board = environ['waka.board']

    singledelete = (request.values.get("singledelete", '') == 'OK')

    params = {'form': ['password', 'file_only', 'from_window', 'admindelete'],
              'cookies': ['wakaadmin']}

    kwargs = kwargs_from_params(request, params)

    if singledelete:
        # NOTE: from_window parameter originates from pop-up windows
        #       brought up by clicking "Delete" without JS enabled.
        params_single = ['postpassword', 'postfileonly', 'from_window']
        for param, single in map(None, params['form'][:3], params_single):
            kwargs[param] = request.form.get(single, '')

        kwargs['posts'] = [request.values.get('deletepost', '')]
    else:
        kwargs['posts'] = request.form.getlist('num')
    kwargs['archiving'] = archiving

    if kwargs['admindelete']:
        kwargs['board'] = board
        kwargs['action'] = 'admin_delete'
        return StaffAction(**kwargs).execute()

    del kwargs['admin']
    return board.delete_stuff(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:31,代码来源:app.py


示例5: task_deleteuser

def task_deleteuser(environ, start_response):
    request = environ['werkzeug.request']

    params = {'cookies': ['wakaadmin'], 'form': ['mpass', 'username']}

    kwargs = kwargs_from_params(request, params)

    return staff_interface.del_staff_proxy(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:8,代码来源:app.py


示例6: task

 def task(environ, start_response):
     request = environ['werkzeug.request']
     kwargs = kwargs_from_params(request,
         form=form,
         admin=True,
     )
     kwargs['dest'] = getattr(staff_interface, dest)
     return StaffInterface(**kwargs)
开发者ID:dequis,项目名称:wakarimasen,代码行数:8,代码来源:app.py


示例7: task_rebuildglobal

def task_rebuildglobal(environ, start_response):
    request = environ['werkzeug.request']
    params = {'cookies': ['wakaadmin']}
    
    kwargs = kwargs_from_params(request, params)
    kwargs['action'] = 'rebuild_global'

    return StaffAction(**kwargs).execute()
开发者ID:k-anon,项目名称:wakarimasen,代码行数:8,代码来源:app.py


示例8: task_enableuser

def task_enableuser(environ, start_response):
    request = environ['werkzeug.request']

    params = {'cookies': ['wakaadmin'], 'form': ['mpass', 'username']}

    kwargs = kwargs_from_params(request, params)
    kwargs['disable'] = False

    return staff_interface.edit_staff_proxy(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:9,代码来源:app.py


示例9: task_removeban

def task_removeban(environ, start_response):
    request = environ['werkzeug.request']

    params = {'form': ['num'], 'cookies': ['wakaadmin']}

    kwargs = kwargs_from_params(request, params)
    kwargs['action'] = 'remove_admin_entry'

    return StaffAction(**kwargs).execute()
开发者ID:k-anon,项目名称:wakarimasen,代码行数:9,代码来源:app.py


示例10: task_rebuildglobal

def task_rebuildglobal(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        admin=True,
    )
    kwargs['action'] = 'rebuild_global'

    return StaffAction(**kwargs).execute()
开发者ID:dequis,项目名称:wakarimasen,代码行数:9,代码来源:app.py


示例11: task_updatespam

def task_updatespam(environ, start_response):
    request = environ['werkzeug.request']

    params = {'form': ['spam'], 'cookies': ['wakaadmin']}

    kwargs = kwargs_from_params(request, params)
    kwargs['action'] = 'update_spam'

    return StaffAction(**kwargs).execute()
开发者ID:k-anon,项目名称:wakarimasen,代码行数:9,代码来源:app.py


示例12: task_deleteuser

def task_deleteuser(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        form=['mpass', 'username'],
        admin=True,
    )

    return staff_interface.del_staff_proxy(**kwargs)
开发者ID:dequis,项目名称:wakarimasen,代码行数:9,代码来源:app.py


示例13: task_enableuser

def task_enableuser(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        form=['mpass', 'username'],
        admin=True,
    )
    kwargs['disable'] = False

    return staff_interface.edit_staff_proxy(**kwargs)
开发者ID:dequis,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例14: task_edit

def task_edit(environ, start_response):
    request = environ['werkzeug.request']
    board = environ['waka.board']

    params = {'form': ['num']}
   
    kwargs = kwargs_from_params(request, params)
    kwargs['post_num'] = kwargs.pop('num')

    return board.edit_gateway_window(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例15: task_deleteall_confirm

def task_deleteall_confirm(environ, start_response):
    request = environ['werkzeug.request']

    params = {'form':    ['ip', 'mask', 'global'],
              'cookies': ['wakaadmin']}

    kwargs = kwargs_from_params(request, params)
    kwargs['dest'] = staff_interface.DELETE_ALL_CONFIRM

    return StaffInterface(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例16: task_removeban

def task_removeban(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        form=['num'],
        admin=True,
    )
    kwargs['action'] = 'remove_admin_entry'

    return StaffAction(**kwargs).execute()
开发者ID:dequis,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例17: task_updatespam

def task_updatespam(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        form=['spam'],
        admin=True,
    )
    kwargs['action'] = 'update_spam'

    return StaffAction(**kwargs).execute()
开发者ID:dequis,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例18: task_createuser

def task_createuser(environ, start_response):
    request = environ['werkzeug.request']

    kwargs = kwargs_from_params(request,
        form=['mpass', 'usertocreate', 'passtocreate', 'account', 'reign'],
        admin=True,
    )
    kwargs['reign'] = kwargs.pop('reign').split(',')

    return staff_interface.add_staff_proxy(**kwargs)
开发者ID:dequis,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例19: task_confirmreport

def task_confirmreport(environ, start_response):
    request = environ['werkzeug.request']
    board = environ['waka.board']

    params = {'form': ['num', 'comment', 'referer']}

    kwargs = kwargs_from_params(request, params)
    kwargs['posts'] = kwargs.pop('num').split(', ')
    
    return board.report_posts(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:10,代码来源:app.py


示例20: task_createuser

def task_createuser(environ, start_response):
    request = environ['werkzeug.request']

    params = {'cookies': ['wakaadmin'],
              'form':    ['mpass', 'usertocreate', 'passtocreate', 'account',
                          'reign']}

    kwargs = kwargs_from_params(request, params)
    kwargs['reign'] = kwargs.pop('reign').split(',')

    return staff_interface.add_staff_proxy(**kwargs)
开发者ID:k-anon,项目名称:wakarimasen,代码行数:11,代码来源:app.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python misc.option函数代码示例发布时间:2022-05-27
下一篇:
Python misc.is_app_name_valid函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap