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


Python GSoCProposal.put方法代码示例

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


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

示例1: _processEntity

# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import put [as 别名]
  def _processEntity(self, entity):
    key_name = entity.key().name()
    parent = entity.scope
    properties = {
        'abstract': entity.abstract,
        'additional_info': entity.additional_info,
        'content': entity.content,
        'created_on': entity.created_on,
        'is_publicly_visible': entity.is_publicly_visible,
        'last_modified_on': entity.last_modified_on,
        'mentor': entity.mentor,
        'org': entity.org,
        'possible_mentors': entity.possible_mentors,
        'program': entity.program,
        'status': entity.status,
        'title': entity.title,
        }

    # check if the proposal has already been processed
    # this is a heristic, but we can assume that one student can't submit two
    # proposals at the very same time
    query = db.Query(GSoCProposal)
    query.ancestor(entity.scope)
    query.filter('created_on = ', entity.created_on)
    if query.get():
      return

    # create a new GSoCProposal entity
    proposal = GSoCProposal(parent=parent, **properties)
    proposal.put()
    
    to_put = []
    # convert all the comments for the old proposal
    query = db.Query(Review)
    query.filter('scope = ', entity)
    for comment in query:
      # get profile instance
      q = db.Query(GSoCProfile)
      q.ancestor(comment.author)
      q.filter('scope =', entity.program)
      author = q.get()

      if not author:
        # if, for some reason, there is no profile, we skip this comment
        import logging
        logging.warning('No profile for user %s.' % (comment.author.link_id))
        continue

      properties = {
          'author': author,
          'content': comment.content,
          'is_private': not comment.is_public,
          'created': comment.created
          }
      new_comment = GSoCComment(parent=proposal, **properties)
      to_put.append(new_comment)

    db.run_in_transaction(db.put, to_put)
开发者ID:adviti,项目名称:melange,代码行数:60,代码来源:proposal_conversion.py

示例2: create_proposal_trx

# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import put [as 别名]
    def create_proposal_trx():
      profile = data.ndb_profile.key.get()
      profile.student_data.number_of_proposals += 1
      profile.put()

      proposal = GSoCProposal(
          parent=data.ndb_profile.key.to_old_key(),
          **proposal_properties)
      proposal.put()

      context = notifications.newProposalContext(data, proposal, to_emails)
      sub_txn = mailer.getSpawnMailTaskTxn(context, parent=proposal)
      sub_txn()

      return proposal
开发者ID:rhyolight,项目名称:nupic.son,代码行数:17,代码来源:proposal.py

示例3: seed

# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import put [as 别名]
def seed(request, *args, **kwargs):
  """Seeds the datastore with some default values.
  """

  site_properties = {
      'key_name': 'site',
      'latest_gsoc': 'google/gsoc2014',
      'latest_gci': 'google/gci2013',
      }
  site = Site(**site_properties)
  site.put()

  account = accounts.getCurrentAccount()

  if not account:
    account = users.User(email='[email protected]')

  user_properties = {
      'id': 'test',
      'account_id': account.user_id(),
      'account': account,
      }
  current_user = user.User(**user_properties)
  current_user.put()

  group_properties = {
       'key_name': 'google',
       'link_id': 'google',
       'name': 'Google Inc.',
       'short_name': 'Google',
       'home_page': 'http://www.google.com',
       'email': '[email protected]',
       'description': 'This is the profile for Google.',
       'contact_street': 'Some Street',
       'contact_city': 'Some City',
       'contact_country': 'United States',
       'contact_postalcode': '12345',
       'phone': '15551110000',
       'status': 'active',
       }
  google = Sponsor(**group_properties)
  google.put()

  now = datetime.datetime.now()
  before = now - datetime.timedelta(365)
  after = now + datetime.timedelta(365)
  past_before = before - datetime.timedelta(2 * 365)
  past_after = after - datetime.timedelta(2 * 365)

  timeline_properties = {
      'key_name': 'google/gsoc2014',
      'link_id': 'gsoc2014',
      'scope': google,
      'program_start': before,
      'program_end': after,
      'accepted_organization_announced_deadline': before,
      'accepted_students_announced_deadline' : after,
      'student_signup_start': before,
      'student_signup_end': after,
      'application_review_deadline': after,
      'student_application_matched_deadline': after,
      'accepted_students_announced_deadline': after,
      'form_submission_start': before,
  }
  gsoc2014_timeline = GSoCTimeline(**timeline_properties)
  gsoc2014_timeline.put()

  program_properties = {
      'key_name': 'google/gsoc2014',
      'link_id': 'gsoc2014',
      'program_id': 'gsoc2014',
      'sponsor': google,
      'scope': google,
      'name': 'Google Summer of Code 2014',
      'short_name': 'GSoC 2014',
      'description': 'This is the program for GSoC 2014.',
      'apps_tasks_limit': 42,
      'slots': 42,
      'timeline': gsoc2014_timeline,
      'status': program_model.STATUS_VISIBLE,
      }
  gsoc2014 = GSoCProgram(**program_properties)
  gsoc2014.put()

  timeline_properties.update({
      'key_name': 'google/gsoc2010',
      'link_id': 'gsoc2010',
      'program_start': past_before,
      'program_end': past_after,
      'accepted_organization_announced_deadline': past_before,
      'accepted_students_announced_deadline' : past_after,
      'student_signup_start': past_before,
      'student_signup_end': past_after,
      'application_review_deadline': past_after,
      'student_application_matched_deadline': past_after,
      'accepted_students_announced_deadline': past_after,
      'form_submission_start': past_before,
  })
  gsoc2010_timeline = GSoCTimeline(**timeline_properties)
  gsoc2010_timeline.put()
#.........这里部分代码省略.........
开发者ID:rhyolight,项目名称:nupic.son,代码行数:103,代码来源:seed_db.py

示例4: seed

# 需要导入模块: from soc.modules.gsoc.models.proposal import GSoCProposal [as 别名]
# 或者: from soc.modules.gsoc.models.proposal.GSoCProposal import put [as 别名]
def seed(request, *args, **kwargs):
  """Seeds the datastore with some default values.
  """

  site_properties = {
      'key_name': 'site',
      'latest_gsoc': 'numenta/son2014',
      # 'latest_gci': 'numenta/gci2013',
      }
  site = Site(**site_properties)
  site.put()

  account = accounts.getCurrentAccount()

  if not account:
    account = users.User(email='[email protected]')

  user_properties = {
      'id': 'matt',
      'account_id': account.user_id(),
      'account': account,
      }
  current_user = user.User(**user_properties)
  current_user.put()

  group_properties = {
       'key_name': 'numenta',
       'link_id': 'numenta',
       'name': 'Numenta Inc.',
       'short_name': 'Numenta',
       'home_page': 'http://numenta.org',
       'email': '[email protected]',
       'description': 'This is the profile for Numenta.',
       'contact_street': '811 Hamilton St',
       'contact_city': 'Redwood City, CA',
       'contact_country': 'United States',
       'contact_postalcode': '94063',
       'phone': '6503698282',
       'status': 'active',
       }
  numenta = Sponsor(**group_properties)
  numenta.put()

  now = datetime.datetime.now()
  # before = now - datetime.timedelta(365)
  # after = now + datetime.timedelta(365)
  # past_before = before - datetime.timedelta(2 * 365)
  # past_after = after - datetime.timedelta(2 * 365)

  # first_day = datetime.datetime(2014, 5, 1)
  # last_day = datetime.datetime(2014, 9, 1)
  # signup_deadline = first_day + datetime.timedelta(30)
  # signup_start = first_day
  # students_announced = signup_deadline + datetime.timedelta(15)
  program_start = datetime.datetime(2014, 3, 5)
  program_end = datetime.datetime(2014, 9, 1)

  timeline_properties = {
      'key_name': 'numenta/son2014',
      'link_id': 'son2014',
      'scope': numenta,

      'program_start': program_start,
      'program_end': program_end,

      'accepted_organization_announced_deadline': datetime.datetime(2014, 3, 1),
      'accepted_students_announced_deadline' : datetime.datetime(2014, 4, 15),

      'student_signup_start': datetime.datetime(2014, 3, 5),
      'student_signup_end': datetime.datetime(2014, 4, 1),

      'application_review_deadline': datetime.datetime(2014, 4, 10),

      'form_submission_start': datetime.datetime(2014, 3, 5),

      'student_application_matched_deadline': datetime.datetime(2014, 4, 12),

      'bonding_start': datetime.datetime(2014, 4, 15),
      'bonding_end': datetime.datetime(2014, 5, 1),

      'coding_start': datetime.datetime(2014, 5, 1),
      'coding_end': datetime.datetime(2014, 8, 1),

  }
  son2014_timeline = GSoCTimeline(**timeline_properties)
  son2014_timeline.put()

  program_properties = {
      'key_name': 'numenta/son2014',
      'link_id': 'son2014',
      'program_id': 'son2014',
      'sponsor': numenta,
      'scope': numenta,
      'name': 'Numenta Season of NuPIC 2014',
      'short_name': 'SoN 2014',
      'description': 'This is the program for SoN 2014.',
      'apps_tasks_limit': 42,
      'slots': 42,
      'timeline': son2014_timeline,
      'status': program_model.STATUS_VISIBLE,
#.........这里部分代码省略.........
开发者ID:sambitgaan,项目名称:nupic.son,代码行数:103,代码来源:seed_db.py


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