Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Fixed the automatic updation bug of updated time on regenerate.
Browse files Browse the repository at this point in the history
Now the updated time is modified on an edit post. Thus correctly
generating atom.xml.
  • Loading branch information
Jai Sharma authored and Arachnid committed Jan 27, 2010
1 parent 6336f24 commit 8e06efc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ def post(self, post):
initial={'draft': post and post.published is None})
if form.is_valid():
post = form.save(commit=False)
if form.clean_data['draft']:
if form.clean_data['draft']:# Draft post
post.published = datetime.datetime.max
post.put()
else:
if not post.path:
post.published = datetime.datetime.now()
if not post.path: # Publish post
post.updated = post.published = datetime.datetime.now()
else:# Edit post
post.updated = datetime.datetime.now()
post.publish()
self.render_to_response("published.html", {
'post': post,
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BlogPost(db.Model):
body = db.TextProperty(required=True)
tags = aetycoon.SetProperty(basestring, indexed=False)
published = db.DateTimeProperty()
updated = db.DateTimeProperty(auto_now=True)
updated = db.DateTimeProperty(auto_now=False)
deps = aetycoon.PickleProperty()

@aetycoon.TransformProperty(tags)
Expand Down

0 comments on commit 8e06efc

Please sign in to comment.