]> git.ipfire.org Git - ipfire.org.git/commitdiff
planet: Fix saving new posts.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 May 2013 11:20:21 +0000 (13:20 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 8 May 2013 11:20:21 +0000 (13:20 +0200)
webapp/backend/planet.py
webapp/handlers_admin.py

index a1ea61e1b4760611e1b4079770b9044b400fd449..0be571238e3194c32dfeca9b4ede49fbcb82abff 100644 (file)
@@ -204,10 +204,12 @@ class Planet(object):
        def save_entry(self, entry):
                slug = self._generate_slug(entry.title)
 
-               self.db.execute("INSERT INTO planet(author_id, title, slug, markdown, published) "
+               id = self.db.execute("INSERT INTO planet(author_id, title, slug, markdown, published) "
                        "VALUES(%s, %s, %s, %s, UTC_TIMESTAMP())", entry.author.uid, entry.title,
                        slug, entry.markdown)
 
+               return id
+
        def search(self, what):
                # Split tags.
                tags = what.split()
index c5ac79473ec9c36c7855df05ce5e8512d5cfb9d9..7310a43f314eb5a7de47f0757f659cf5239b1f2c 100644 (file)
@@ -96,13 +96,14 @@ class AdminPlanetComposeHandler(AdminBaseHandler):
                entry.set("markdown", self.get_argument("markdown"))
                entry.set("author_id", self.current_user)
 
-               tags = self.get_argument("tags", "")
-               entry.tags = tags.split()
-
                if id:
                        self.planet.update_entry(entry)
                else:
-                       self.planet.save_entry(entry)
+                       id = self.planet.save_entry(entry)
+                       entry.id = id
+
+               tags = self.get_argument("tags", "")
+               entry.tags = tags.split()
 
                self.redirect("/planet")