Advertisement
Guest User

GSoCConnection model v2

a guest
Jun 1st, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.96 KB | None | 0 0
  1. #!/usr/bin/env python2.5
  2. #
  3. # Copyright 2009 the Melange authors.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. #   http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16.  
  17. ''' This module contains the object used to represent invitations and
  18. requests between a user and an organization
  19. '''
  20. from google.appengine.ext import db
  21. import soc.modules.gsoc.models.organization
  22. import soc.modules.gsoc.models.profile
  23.  
  24. class GSoCConnection(db.Model):
  25.   """ GSoCConnection model.
  26.  This model is intended to be used to represent either an invitation or
  27.  request between a User and an Organization. The various states of this
  28.  connection (see choices field below) represent the actions taken by each
  29.  party in response to a request or invitation. A request/invite will result
  30.  in the promotion of a User if and only if the state of the connection
  31.  (the user_action or org_action) is 'accepted', or both actions are of the
  32.  same type of acceptance.
  33.  """
  34.   # 'Supported' states for mentor invitations/requests and org admin invites
  35.   choices = ['mentor_accepted', 'mentor_rejected', 'mentor_withdrawn',
  36.             'mentor_pending', 'org_admin_accepted', 'org_admin_rejected',
  37.             'org_admin_withdrawn', 'org_admin_pending', 'needs_info']
  38.   organization = db.ReferenceProperty(organization.GSoCOrganization)
  39.   user = db.ReferenceProperty(profile.GSoCProfile)
  40.   user_action = db.StringProperty(choices=choices)
  41.   org_action = db.StringProperty(choices=choices)
  42.  
  43.   def isMutualAction():
  44.     return self.user_action == self.org_action
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement