Пример #1
0
  def post(self):
    user    = users.get_current_user()
    account = get_account_for_user(user)

    # if the user is logged on, but we find no account, provision him first
    if user != None and account == None:
      Home.show( account, self, "A complete account is needed to submit." );
      return

    diagram = {
      'author'      : account,
      'id'          : self.request.get("id"),
      'source'      : self.get_source(),
      'name'        : self.request.get("name"),
      'description' : self.request.get("descr"),
      'width'       : int(self.request.get("width", default_value="300")),
      'height'      : int(self.request.get("height",default_value="200")),
      'notes'       : self.request.get("notes")
    }
    
    if self.request.get('action') == "save":
      self.save( diagram )
    else:
      template_values = { 
        'diagram' : diagram
      }
      render_template( self, "SubmitDiagram", template_values )
Пример #2
0
  def post(self):
    user    = self.get_logged_on_user()
    account = get_account_for_user(user)
    
    name    = self.request.get("name");
    if name:
      if account: 
        self.show( account, "Cannot update name." )
        return

      if get_account_by_name(name):
        # an account is already registered using this name
        self.show( account, "Name is not available" )
        return
      
      # register the user with the new name
      account = create_account( key_name = name, user = user )
      account.put()

    self.render( account );
Пример #3
0
 def get(self):
   user    = self.get_logged_on_user()
   account = get_account_for_user(user)
   self.render( account );