[papert commit] r128 - in trunk: . static

0 views
Skip to first unread message

codesite...@google.com

unread,
Feb 14, 2009, 5:48:17 PM2/14/09
to paper...@googlegroups.com
Author: thomas.figg
Date: Sat Feb 14 14:47:20 2009
New Revision: 128

Modified:
trunk/index.html.tmpl
trunk/index.py
trunk/index.yaml
trunk/static/papert.css

Log:
adding browse

Modified: trunk/index.html.tmpl
==============================================================================
--- trunk/index.html.tmpl (original)
+++ trunk/index.html.tmpl Sat Feb 14 14:47:20 2009
@@ -150,12 +150,16 @@
 
</div>
<div id="recent">
+<a name="recent"></a>
<ul>
+{% if next_date %}
+<li><a href="?newer={{next_date|escape}}#recent">&lt;</li>
+{% endif %}
{% for item in recent %}
<li><a href="/{{item|escape}}"><img src="/{{item|escape}}.png" alt=""
/></a></li>
{% endfor %}
{% if last_date %}
-<li><a href="?older={{last_date|escape}}">older</li>
+<li><a href="?older={{last_date|escape}}#recent">&gt;</li>
{% endif %}
</ul>
</div>

Modified: trunk/index.py
==============================================================================
--- trunk/index.py (original)
+++ trunk/index.py Sat Feb 14 14:47:20 2009
@@ -30,7 +30,8 @@
self.redirect('/')
return

- browse_date = self.request.get("older")
+ older = self.request.get("older")
+ newer = self.request.get("newer")

program = None

@@ -62,30 +63,31 @@
values['hash'] = hash


- if browse_date:
- browse_date =
datetime.datetime.strptime(browse_date,"%Y-%m-%dT%H:%M:%S")
- recent = LogoProgram.all().filter('date <',
browse_date).order('-date').fetch(5)
- if recent:
- last_date = recent[-1].date
+ if older or newer:
+ if older:
+ browse_date =
datetime.datetime.strptime(older,"%Y-%m-%dT%H:%M:%S")
+ recent = LogoProgram.all().filter('date <',
browse_date).order('-date').fetch(5)
else:
- last_date = None
- recent = [program.hash for program in recent]
+ browse_date =
datetime.datetime.strptime(newer,"%Y-%m-%dT%H:%M:%S")
+ recent = LogoProgram.all().filter('date >',
browse_date).order('date').fetch(5)
+ if recent:
+ recent.reverse()
+ if recent:
+ values['recent'] = [program.hash for program in
recent]
+ values['last_date'] =
recent[-1].date.strftime("%Y-%m-%dT%H:%M:%S")
+ values['next_date'] =
recent[0].date.strftime("%Y-%m-%dT%H:%M:%S")
else:
recent = memcache.get("recent")
last_date = memcache.get("last_date")
if recent is None or last_date is None:
recent = LogoProgram.all().order('-date').fetch(5)
if recent:
- last_date = recent[-1].date
- else:
- last_date = None
- recent = [program.hash for program in recent]
- memcache.set("recent", recent)
- memcache.set("last_date", last_date)
- if recent:
- values['recent'] = recent
- if last_date:
- values['last_date'] =
last_date.strftime("%Y-%m-%dT%H:%M:%S")
+ last_date =
recent[-1].date.strftime("%Y-%m-%dT%H:%M:%S")
+ recent = [program.hash for program in recent]
+ memcache.set("recent", recent)
+ memcache.set("last_date", last_date)
+ values['recent'] = recent
+ values['last_date'] = last_date

page =
os.path.join(os.path.dirname(__file__), 'index.html.tmpl')
self.response.out.write(template.render(page, values))

Modified: trunk/index.yaml
==============================================================================
--- trunk/index.yaml (original)
+++ trunk/index.yaml Sat Feb 14 14:47:20 2009
@@ -10,7 +10,7 @@
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.

-# Used 17 times in query history.
+# Used 12 times in query history.
- kind: LogoProgram
properties:
- name: date

Modified: trunk/static/papert.css
==============================================================================
--- trunk/static/papert.css (original)
+++ trunk/static/papert.css Sat Feb 14 14:47:20 2009
@@ -99,8 +99,9 @@
}

#recent ul li {
- padding: 20px;
+ padding: 10px;
display: inline;
+ vertical-align: middle;
}

#recent ul li a { text-decoration: none; }

Reply all
Reply to author
Forward
0 new messages