fixed a bug in edit_post(), which now correctly ensure that users are logged in before allowing them to see the edit page for a post.
Fixed a bug where an IndexError was thrown when trying to edit a post that does not exist.Added a unit test for this case as well.