original_docstring: Create or update Conference object, returning ConferenceForm/request.
docstring: Create or update Conference object, returning ConferenceForm/request.
docstring_tokens: Create or update Conference object returning ConferenceForm / request .
code: def _createSessionObject(self, request):
          """Create or update Conference object, returning ConferenceForm/request."""
  
          conf = ndb.Key(urlsafe=request.websafeConferenceKey).get()
          if not conf:
              raise endpoints.NotFoundException(
                  'No conference found with key: %s' % request.websafeConferenceKey)
  
          user = endpoints.get_current_user()
          if not user:
              raise endpoints.UnauthorizedException('Authorization required')
          user_id = getUserId(user)
  
          if user_id != conf.organizerUserId:
              raise endpoints.ForbiddenException(
                  'Only the owner of the conference can create session.')
  
          if not request.name:
              raise endpoints.BadRequestException("Session 'name' field required")
          #
          # # copy ConferenceForm/ProtoRPC Message into dict
          data = {field.name: getattr(request, field.name) for field in request.all_fields()}
          del data['websafeConferenceKey']
          # #del data['organizerDisplayName']
          #
          # # add default values for those missing (both data model & outbound Message)
          for df in SESSION_EFAULTS:
              if data[df] in (None, []):
                  data[df] = SESSION_EFAULTS[df]
                  setattr(request, df, SESSION_EFAULTS[df])
  
          data['organizerUserId']= user_id
          data['websafeConferenceKey'] = request.websafeConferenceKey
          data['conferenceName']=conf.name
  
          p_key = ndb.Key(Profile, user_id)
          c_id = Conference.allocate_ids(size=1, parent=p_key)[0]
          c_key = ndb.Key(Conference, c_id, parent=p_key)
          s_id = Session.allocate_ids(size=1, parent=c_key)[0]
          s_key = ndb.Key(Session, s_id, parent=c_key)
          data['key'] = s_key
  
          if data['date']:
              data['startTime'] = datetime.strptime(data['date'], '%Y-%m-%d %H:%M:%S').time()
              data['date'] = datetime.strptime(data['date'][:10], "%Y-%m-%d").date()
  
          # # create Conference, send email to organizer confirming
          # # creation of Conference & return (modified) ConferenceForm
          session = Session(**data)
          session.put()
  
          taskqueue.add(params={'websafeConferenceKey': request.websafeConferenceKey,
                                'speaker': data['speaker']},
                         url='/tasks/set_featured_speaker'
                        )
  
          return self._copySessionToForm(session)
code_tokens: def _createSessionObject ( self , request ) : conf = ndb . Key ( urlsafe = request . websafeConferenceKey ) . get ( ) if not conf : raise endpoints . NotFoundException ( 'No conference found with key: %s' % request . websafeConferenceKey ) user = endpoints . get_current_user ( ) if not user : raise endpoints . UnauthorizedException ( 'Authorization required' ) user_id = getUserId ( user ) if user_id != conf . organizerUserId : raise endpoints . ForbiddenException ( 'Only the owner of the conference can create session.' ) if not request . name : raise endpoints . BadRequestException ( "Session 'name' field required" ) data = { field . name : getattr ( request , field . name ) for field in request . all_fields ( ) } del data [ 'websafeConferenceKey' ] for df in SESSION_EFAULTS : if data [ df ] in ( None , [ ] ) : data [ df ] = SESSION_EFAULTS [ df ] setattr ( request , df , SESSION_EFAULTS [ df ] ) data [ 'organizerUserId' ] = user_id data [ 'websafeConferenceKey' ] = request . websafeConferenceKey data [ 'conferenceName' ] = conf . name p_key = ndb . Key ( Profile , user_id ) c_id = Conference . allocate_ids ( size = 1 , parent = p_key ) [ 0 ] c_key = ndb . Key ( Conference , c_id , parent = p_key ) s_id = Session . allocate_ids ( size = 1 , parent = c_key ) [ 0 ] s_key = ndb . Key ( Session , s_id , parent = c_key ) data [ 'key' ] = s_key if data [ 'date' ] : data [ 'startTime' ] = datetime . strptime ( data [ 'date' ] , '%Y-%m-%d %H:%M:%S' ) . time ( ) data [ 'date' ] = datetime . strptime ( data [ 'date' ] [ : 10 ] , "%Y-%m-%d" ) . date ( ) session = Session ( ** data ) session . put ( ) taskqueue . add ( params = { 'websafeConferenceKey' : request . websafeConferenceKey , 'speaker' : data [ 'speaker' ] } , url = '/tasks/set_featured_speaker' ) return self . _copySessionToForm ( session )
short_docstring: Create or update Conference object, returning ConferenceForm/request.
short_docstring_tokens: Create or update Conference object returning ConferenceForm / request .
comment: """Create or update Conference object, returning ConferenceForm/request."""$SEP$#
  $SEP$# # copy ConferenceForm/ProtoRPC Message into dict
  $SEP$# #del data['organizerDisplayName']
  $SEP$#
  $SEP$# # add default values for those missing (both data model & outbound Message)
  $SEP$# # create Conference, send email to organizer confirming
  $SEP$# # creation of Conference & return (modified) ConferenceForm
  