Esempio n. 1
0
    def _create_note(self, user, file_name, file_path):

        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        note.put()

        # Retrieve csv representing checklist items
        item_titles = self.request.get('checklist_items').split(',')

        for item_title in item_titles:
            if not item_title:
                continue
            # create a checklist instance
            item = CheckListItem(parent = note.key, title = item_title)
            # store each checklist
            item.put()
            # after storing it, we can access the key to append it to the note
            note.checklist_items.append(item.key)

        if file_name and file_path:
            url, thumbnail_url = self._get_urls_for(file_name)

            f = NoteFile(parent=note.key, name=file_name,
                         url=url, thumbnail_url=thumbnail_url,
                         full_path=file_path)
            f.put()
            note.files.append(f.key)

            # update the note entity with the checklist items
            note.put()  
Esempio n. 2
0
	def _create_note(self, user):
		note=Note(parent=ndb.Key("User", user.nickname()),
			title=self.request.get('title'),
			content=self.request.get('content'))
		note.put()

		item_titles = self.request.get('checklist_items').split(',')
		for item_title in item_titles:
			item = CheckListItem(parent=note.key, title=item_title)
			item.put()
			note.checklist_items.append(item.key)

		note.put()
Esempio n. 3
0
    def _create_note(self, user):
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            item = CheckListItem(parent=note.key, title=item_title)
            item.put()
            note.checklist_items.append(item.key)

        note.put()
Esempio n. 4
0
    def _create_note(self, user):
        #create "note" as an object instance of the class "Note".  Included here must be all parts of the class
        #example = User, title, content
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        #object name "note" will upload the information to something
        note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            item = CheckListItem(parent=note.key, title=item_title)
            item.put()
            note.checklist_items.append(item.key)
        note.put()
Esempio n. 5
0
    def _create_note(self, user, file_name, file_path):
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            if not item_title:
                continue
            item = CheckListItem(title=item_title)
            note.checklist_items.append(item)

        note.put()

        if file_name and file_path:
            url, thumbnail_url = self._get_urls_for(file_name)

            f = NoteFile(parent=note.key,
                         name=file_name,
                         url=url,
                         thumbnail_url=thumbnail_url,
                         full_path=file_path)
            f.put()
            note.files.append(f.key)
            note.put()

        inc_note_counter()
Esempio n. 6
0
    def _create_note(self, user):
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_sales:
            item = CheckListItem(parent=note.key, title=item_title)
            item.put()
            note.checklist_items.append(item.key)

        note.put()

        def get(self):
            user = users.get_current_user()
            if user is not None:
                logout_url = users.create_logout_url(self.request.uri)
                template_context = {
                    'user': user.nickname(),
                    'logout_url': logout_url,
                }
                self.response.out.write(
                    self.render_template('main.html', template_context))
            else:
                login_url = users.create_login_url(self.request.uri)
                self.redirect(login_url)

        def post(self):
            user = users.get_current_user()
            if user is None:
                self.error(401)

            self._create_note(user)

            logout_url = users.create_logout_url(self.request.uri)
            template_context = {
                'user': user.nickname(),
                'logout_url': logout_url,
            }
            self.response.out.write(
                self._render_template('main.html', template_context))
    def _create_note(self, user, file_name, file_path):
        note = Note(parent=ndb.Key("User", user.nickname()),
                    title=self.request.get('title'),
                    content=self.request.get('content'))
        note.put()

        item_titles = self.request.get('checklist_items').split(',')
        for item_title in item_titles:
            if not item_title:
                continue
            item = CheckListItem(parent=note.key, title=item_title)
            item.put()
            note.checklist_items.append(item.key)

        if file_name and file_path:
            url, thumbnail_url = self._get_urls_for(file_name)

            f = NoteFile(parent=note.key, name=file_name,
                         url=url, thumbnail_url=thumbnail_url,
                         full_path=file_path)
            f.put()
            note.files.append(f.key)

            note.put()