Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _createFromForm(self):
- """Creates a new request based on the data inserted in the form.
- Returns:
- a newly created Request entity or None
- """
- assert isSet(self.data.organization)
- connection_form = ConnectionForm(
- data=self.data.POST)
- if not connection_form.is_valid():
- return None
- # create a new invitation entity
- connection_form.cleaned_data['user'] = self.data.user
- connection_form.cleaned_data['organization'] = self.data.organization
- connection_form.cleaned_data['role'] = 'mentor'
- connection_form.cleaned_data['user_action'] = 'accepted'
- connection_form.cleaned_data['org_action'] = 'pending'
- # alert the org admins that a new request has been submitted
- q = GSoCProfile.all().filter('org_admin_for', self.data.organization)
- q = q.filter('status', 'active').filter('notify_new_requests', True)
- admins = q.fetch(1000)
- admin_emails = [i.email for i in admins]
- def create_connection_txn():
- conn = connection_form.create(commit=True, parent=self.data.user)
- # TODO(dcrodman): Add inviteContext function & fix notifications for conns
- # context = notifications.requestContext(self.data, request, admin_emails)
- # sub_txn = mailer.getSpawnMailTaskTxn(context, parent=request)
- # sub_txn()
- return conn
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement