changeset 25:62c961bb91e6

* allow changing of privacy on blog entries * bind blog variables in genshi
author k0s <k0scist@gmail.com>
date Sat, 31 Oct 2009 00:30:47 -0400
parents 7505329b3134
children e37d117a9deb
files bitsyblog/bitsyblog.py bitsyblog/templates/blog.html
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/bitsyblog.py	Sat Oct 31 00:22:26 2009 -0400
+++ b/bitsyblog/bitsyblog.py	Sat Oct 31 00:30:47 2009 -0400
@@ -260,11 +260,13 @@
         user, path = self.userpath(request)
 
         # check to make sure the user is authenticated
+        # and is the resource owner
         check = self.check_user(user, request)
         if check is not None:
             return check
 
         if len(path):
+
             if path == [ 'preferences' ]:
             
                 # make the data look like we want
--- a/bitsyblog/templates/blog.html	Sat Oct 31 00:22:26 2009 -0400
+++ b/bitsyblog/templates/blog.html	Sat Oct 31 00:30:47 2009 -0400
@@ -36,11 +36,13 @@
 
     <!-- blog entries -->
     <div py:for="entry in blog"
-         id="${entry.datestamp()}" class="blog-entry">
+         py:with="datestamp=entry.datestamp(); url=user_url(request, request.user.name, datestamp)"
+         id="${entry.datestamp()}" 
+         class="blog-entry">
       <a name="${entry.datestamp()}" />
       
       <div class="subject">
-        <a href="${user_url(request, request.user.name, entry.datestamp())}">${subject % dict(date=entry.date.strftime(date_format))}</a>
+        <a href="${url}">${subject % dict(date=entry.date.strftime(date_format))}</a>
         <em py:if="entry.privacy == 'secret' and role == 'friend'">
           secret
         </em>
@@ -51,7 +53,7 @@
       <div py:if="role == 'author'">
 
         <!-- privacy settings -->
-        <form action="TODO" method="post">
+        <form action="${url}" method="post">
           <span title="viewable to everyone">
             public
             <input type="radio" name="privacy" value="public"