Beispiel #1
0
  def post(self):
    email = self.request.get('email')
    password = self.request.get('password')

    try:
      token = Simplenote.get_token(email, password)
    except Simplenote.AuthError:
      for_template = {
        'autherror': True,
      }
      return self.response.out.write(template.render(self.template_path('index.html'),
                                                     for_template))
    else:
      index = Simplenote.index(token, email)
      note_ids = []

      logging.info("index of all notes: '%s'" % index)

      for note in index:
        if note['deleted'] == False:
          note_ids.append(note['key'])

      logging.info("note_ids minus deleted notes: '%s'" % note_ids)

      for_template = {
        'note_count': len(note_ids),
        'token': token,
        'email': email,
        'note_ids': ','.join(note_ids),
      }

      return self.response.out.write(template.render(self.template_path('auth.html'),
                                                     for_template))
Beispiel #2
0
    def post(self):
        email = self.request.get('email')
        password = self.request.get('password')

        try:
            token = Simplenote.get_token(email, password)
        except Simplenote.AuthError:
            for_template = {
                'autherror': True,
            }
            return self.response.out.write(
                template.render(self.template_path('index.html'),
                                for_template))
        else:
            index = Simplenote.index(token, email)
            note_ids = []

            logging.info("index of all notes: '%s'" % index)

            for note in index:
                if note['deleted'] == False:
                    note_ids.append(note['key'])

            logging.info("note_ids minus deleted notes: '%s'" % note_ids)

            for_template = {
                'note_count': len(note_ids),
                'token': token,
                'email': email,
                'note_ids': ','.join(note_ids),
            }

            return self.response.out.write(
                template.render(self.template_path('auth.html'), for_template))
Beispiel #3
0
  def post(self):
    token = self.request.get('token')
    email = self.request.get('email')
    format = self.request.get('format')
    note_ids = self.request.get('note_ids').split(',')

    notes = []

    for key in note_ids:
      note = Simplenote.get_note(key, token, email)
      notes.append(note)

    for_template = {
      'notes': notes
    }

    logging.info("Found notes: '%s'" % notes)

    if format == 'txt':
      self.txt(notes)
    elif format == 'csv':
      self.csv(notes)
    elif format == 'json':
      self.json(notes)
    elif format == 'xml':
      self.xml(notes)
    elif format == 'yaml':
      self.yaml(notes)
    elif format == 'enex':
      self.enex(notes)
Beispiel #4
0
    def post(self):
        token = self.request.get('token')
        email = self.request.get('email')
        format = self.request.get('format')
        note_ids = self.request.get('note_ids').split(',')

        notes = []

        for key in note_ids:
            note = Simplenote.get_note(key, token, email)
            notes.append(note)

        for_template = {'notes': notes}

        logging.info("Found notes: '%s'" % notes)

        if format == 'txt':
            self.txt(notes)
        elif format == 'csv':
            self.csv(notes)
        elif format == 'json':
            self.json(notes)
        elif format == 'xml':
            self.xml(notes)
        elif format == 'yaml':
            self.yaml(notes)
        elif format == 'enex':
            self.enex(notes)