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

Python util.param函数代码示例

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

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



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

示例1: gh_admin_top

def gh_admin_top():
  if config.PRODUCTION and 'X-Appengine-Cron' not in flask.request.headers:
    flask.abort(403)
  stars = util.param('stars', int) or 10000
  page = util.param('page', int) or 1
  per_page = util.param('per_page', int) or 100
  # TODO: fix formatting
  result = urlfetch.fetch('https://api.github.com/search/repositories?q=stars:>=%s&sort=stars&order=asc&page=%d&per_page=%d' % (stars, page, per_page))
  if result.status_code == 200:
    repos = json.loads(result.content)
  else:
    flask.abort(result.status_code)

  for repo in repos['items']:
    account = repo['owner']
    account_db = model.Account.get_or_insert(
        account['login'],
        avatar_url=account['avatar_url'].split('?')[0],
        email=account['email'] if 'email' in account else '',
        name=account['login'],
        followers=account['followers'] if 'followers' in account else 0,
        organization=account['type'] == 'Organization',
        username=account['login'],
      )

  return 'OK %d of %d' % (len(repos['items']), repos['total_count'])
开发者ID:flyeven,项目名称:github-stats,代码行数:26,代码来源:gh.py


示例2: get_dbs

 def get_dbs(cls, **kwgs):
   return super(User, cls).get_dbs(
       admin=util.param('admin', bool),
       active=util.param('active', bool),
       permissions=util.param('permissions', list),
       **kwgs
     )
开发者ID:georstef,项目名称:GoogleAppEngine,代码行数:7,代码来源:modelq.py


示例3: get_dbs

 def get_dbs(cls, admin=None, active=None, permissions=None, **kwargs):
   return super(User, cls).get_dbs(
       admin=admin or util.param('admin', bool),
       active=active or util.param('active', bool),
       permissions=permissions or util.param('permissions', list),
       **kwargs
     )
开发者ID:Xxpansion,项目名称:gae-init-babel,代码行数:7,代码来源:user.py


示例4: post

 def post(self, track_key):
   """Updates a specific Track"""
   b_track = ndb.Key(urlsafe=track_key).get()
   if b_track and util.param('name') and util.param('courses'):
     b_name = util.param('name')
     b_description = util.param('description')
     b_topics = [ ndb.Key(urlsafe=topic_key_url) for topic_key_url in util.param('topics', list)]
     b_courses = helpers.connected_entities_constructor([ ndb.Key(urlsafe=course_key_url) for course_key_url in util.param('courses', list)])
     b_contributors = b_track.contributors
     #add new contributors to the list of track contributors.
     if auth.current_user_key() not in b_contributors:
       b_contributors += [auth.current_user_key()]
     b_track.name=b_name
     b_track.description=b_description
     b_track.topics=b_topics
     b_track.contributors=b_contributors
     b_track.courses=b_courses
     b_track = b_track.put()
     response = {
       'status': 'success',
       'count': 1,
       'now': helpers.time_now(),
       'result': {'message': 'track was successfuly created!!',
                  'view_url': flask.url_for('track', track_key=b_track.urlsafe())
                 },
     }
     return response
   return helpers.make_bad_request_exception("Unsifificient parameters")
开发者ID:ColdSauce,项目名称:FIRSTMastery,代码行数:28,代码来源:track.py


示例5: welcome

def welcome():
  if util.param('username'):
    return flask.redirect(flask.url_for('gh_account', username=util.param('username')))
  person_dbs, person_cursor = model.Account.get_dbs(
      order='-stars',
      organization=False,
    )

  organization_dbs, organization_cursor = model.Account.get_dbs(
      order='-stars',
      organization=True,
    )

  repo_dbs, repo_cursor = model.Repo.get_dbs(
      order='-stars',
    )

  return flask.render_template(
      'welcome.html',
      html_class='welcome',
      title='Top People, Organizations and Repositories',
      person_dbs=person_dbs,
      organization_dbs=organization_dbs,
      repo_dbs=repo_dbs,
    )
开发者ID:flyeven,项目名称:github-stats,代码行数:25,代码来源:welcome.py


示例6: user_merge

def user_merge():
  user_keys = util.param('user_keys', list)
  if not user_keys:
    flask.abort(400)

  user_db_keys = [ndb.Key(urlsafe=k) for k in user_keys]
  user_dbs = ndb.get_multi(user_db_keys)
  if len(user_dbs) < 2:
    flask.abort(400)

  if flask.request.path.startswith('/_s/'):
    return util.jsonify_model_dbs(user_dbs)

  user_dbs.sort(key=lambda user_db: user_db.created)
  merged_user_db = user_dbs[0]
  auth_ids = []
  permissions = []
  is_admin = False
  is_active = False
  for user_db in user_dbs:
    auth_ids.extend(user_db.auth_ids)
    permissions.extend(user_db.permissions)
    is_admin = is_admin or user_db.admin
    is_active = is_active or user_db.active
    if user_db.key.urlsafe() == util.param('user_key'):
      merged_user_db = user_db

  auth_ids = sorted(list(set(auth_ids)))
  permissions = sorted(list(set(permissions)))
  merged_user_db.permissions = permissions
  merged_user_db.admin = is_admin
  merged_user_db.active = is_active
  merged_user_db.verified = False

  form_obj = copy.deepcopy(merged_user_db)
  form_obj.user_key = merged_user_db.key.urlsafe()
  form_obj.user_keys = ','.join(user_keys)

  form = UserMergeForm(obj=form_obj)
  if form.validate_on_submit():
    form.populate_obj(merged_user_db)
    merged_user_db.auth_ids = auth_ids
    merged_user_db.put()

    deprecated_keys = [k for k in user_db_keys if k != merged_user_db.key]
    merge_user_dbs(merged_user_db, deprecated_keys)
    return flask.redirect(
        flask.url_for('user_update', user_id=merged_user_db.key.id()),
      )

  return flask.render_template(
      'user/user_merge.html',
      title='Merge Users',
      html_class='user-merge',
      user_dbs=user_dbs,
      merged_user_db=merged_user_db,
      form=form,
      auth_ids=auth_ids,
    )
开发者ID:gae-init,项目名称:phonebook,代码行数:59,代码来源:user.py


示例7: teams

 def teams(self):
     teams_dbs, more_cursor = util.retrieve_dbs(
         Team.query(Team.league == self.key),
         limit=util.param('limit', int),
         cursor=util.param('cursor'),
         order=util.param('order'),
     )
     return teams_dbs
开发者ID:gbozee,项目名称:Green-Football-Zone,代码行数:8,代码来源:model.py


示例8: get_dbs

 def get_dbs(cls, query=None, ancestor=None, order=None, limit=None, cursor=None, **kwargs):
   return util.get_dbs(
       query or cls.query(ancestor=ancestor),
       limit=limit or util.param('limit', int),
       cursor=cursor or util.param('cursor'),
       order=order or util.param('order'),
       **kwargs
     )
开发者ID:Adhecious,项目名称:gae-init-auth,代码行数:8,代码来源:base.py


示例9: post

    def post(self, module_id):
        module_config_obj = util.param(MODULE_CONFIG)

        if not module_config_obj:
            helpers.make_bad_request_exception("`module_config` parameter is expected to be found in the request")
        meta = {META_KEYWORDS: util.param(META_KEYWORDS), META_DESCRIPTION: util.param(META_DESCRIPTION)}
        module_config_db = store_module_config(module_config_obj, meta, module_id)

        return helpers.make_response(module_config_db, model.ModuleConfig.FIELDS)
开发者ID:tiberiucorbu,项目名称:av-website,代码行数:9,代码来源:module_config.py


示例10: admin_pay_upgrade_service

def admin_pay_upgrade_service():
  pay_dbs, pay_cursor = util.get_dbs(
      model.Pay.query(),
      limit=util.param('limit', int),
      cursor=util.param('cursor'),
      order=util.param('order'),
    )
  ndb.put_multi(pay_dbs)
  return util.jsonify_model_dbs(pay_dbs, pay_cursor)
开发者ID:georgekis,项目名称:salary,代码行数:9,代码来源:admin.py


示例11: team_topics

 def team_topics(self):
     #return Topic.query(Topic.team == self.key).fetch()
     topics, more_cursor = util.retrieve_dbs(
         Topic.query(Topic.team == self.key),
         limit=util.param('limit', int),
         cursor=util.param('cursor'),
         order=util.param('order'),
     )
     return topics
开发者ID:gbozee,项目名称:Green-Football-Zone,代码行数:9,代码来源:model.py


示例12: get_dbs

 def get_dbs(
     cls, tag_name=None, related_to=None,**kwargs
   ):
   kwargs = cls.get_col_dbs(**kwargs)
   kwargs = cls.get_counter_dbs(**kwargs)
   return super(TagRelation, cls).get_dbs(
       tag_name=tag_name or util.param('tag_name', str),
       related_to=related_to or util.param('related_to', bool),
       **kwargs
     )
开发者ID:wodore,项目名称:wodore-gae,代码行数:10,代码来源:tag.py


示例13: lesson_viewport

def lesson_viewport(content_type): 
  data = flask.json.loads(util.param("data"))
  name = util.param("name")
  return flask.render_template(
      'shared/viewport.html',
      content_type=content_type,
      data=data,
      name=name,
      html_class='lesson-viewport',
    )
开发者ID:ColdSauce,项目名称:FIRSTMastery,代码行数:10,代码来源:shared.py


示例14: admin_tournament_update

def admin_tournament_update():
  tournament_dbs, tournament_cursor = util.get_dbs(
      model.Tournament.query(),
      limit=util.param('limit', int) or config.DEFAULT_DB_LIMIT,
      order=util.param('order'),
      cursor=util.param('cursor'),
    )

  ndb.put_multi(tournament_dbs)
  return util.jsonify_model_dbs(tournament_dbs, tournament_cursor)
开发者ID:georstef,项目名称:GoogleAppEngine,代码行数:10,代码来源:admin.py


示例15: get_dbs

 def get_dbs(
     cls, name=None,geo=None, creator=None, **kwargs
   ):
   kwargs = cls.get_col_dbs(**kwargs)
   kwargs = cls.get_tags_dbs(**kwargs)
   return super(User, cls).get_dbs(
       name=name or util.param('name', None),
       geo=geo or util.param('geo', None),
       creater=creater or util.param('creater', ndb.Key),
       **kwargs
     )
开发者ID:wodore,项目名称:wodore-gae,代码行数:11,代码来源:route.py


示例16: admin_cron

def admin_cron():
  if config.PRODUCTION and 'X-Appengine-Cron' not in flask.request.headers:
    flask.abort(403)
  account_dbs, account_cursor = model.Account.get_dbs(
      order=util.param('order') or 'modified',
      status=util.param('status'),
    )

  for account_db in account_dbs:
    task.queue_account(account_db)

  return 'OK'
开发者ID:flyeven,项目名称:github-stats,代码行数:12,代码来源:gh.py


示例17: get_dbs

 def get_dbs(
     cls, name=None,
     tags=None, creator=None, geo=None, **kwargs
   ):
   kwargs = cls.get_col_dbs(**kwargs)
   kwargs = cls.get_tag_dbs(**kwargs)
   return super(WayPoint, cls).get_dbs(
       name=name or util.param('name', str),
       creator=creator or util.param('creator', ndb.Key),
       geo=geo or util.param('geo', str),
       **kwargs
     )
开发者ID:wodore,项目名称:wodore-gae,代码行数:12,代码来源:waypoint.py


示例18: get_dbs

 def get_dbs(
     cls, name=None, private=None, \
         replaced_by=None, **kwargs
   ):
   kwargs = cls.get_col_dbs(**kwargs)
   kwargs = cls.get_counter_dbs(**kwargs)
   return super(Icon, cls).get_dbs(
       name=name or util.param('name', None),
       private=private or util.param('private', bool),
       replaced_by=replaced_by or util.param('replaced_by', ndb.Key),
       **kwargs
     )
开发者ID:wodore,项目名称:wodore-gae,代码行数:12,代码来源:icon.py


示例19: get_dbs

 def get_dbs(
     cls, name=None, active=None, creator=None,\
       public=None, private=None, **kwargs
   ):
   return super(Collection, cls).get_dbs(
       name=name or util.param('name', None),
       active=active or util.param('active', bool),
       private=private or util.param('private', bool),
       public=public or util.param('public', bool),
       creator=creator or util.param('creator', ndb.Key),
       **kwargs
     )
开发者ID:wodore,项目名称:wodore-gae,代码行数:12,代码来源:collection.py


示例20: post

 def post(self, vote_key):
   """Update a specific vote"""
   vote_db = ndb.Key(urlsafe=vote_key).get()
   vote = 0
   if util.param('data', str) == 'upvote':
     vote = ct.UP_VOTE
   elif util.param('data', str) == 'downvote':
     vote = ct.DOWN_VOTE
   else:
     flask.abort(505)
   vote_db.vote(auth.current_user_key().urlsafe(), vote)
   return "Success"
开发者ID:FOSSRIT,项目名称:FIRSTMastery,代码行数:12,代码来源:vote.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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