Permalink
Browse files

encrypted the html page sources, but pages are not displayed properly

  • Loading branch information...
1 parent 9848664 commit 7bc3dd02a5f8fb9c515d0229f44d10311e1b32fd unknown committed May 8, 2012
Showing with 19 additions and 18 deletions.
  1. +12 −10 main.py
  2. +2 −3 models.py
  3. BIN models.pyc
  4. +1 −1 templates/issue.html
  5. +4 −4 templates/overview.html
View
22 main.py
@@ -29,8 +29,7 @@ def get(self):
recent_voted = [issue for issue in voted_on if issue.is_active()]
recent_results = Issue.recent_results(limit=20)
self.response.out.write(template.render('templates/overview.html', locals()))
-
-
+
class NewHandler(webapp.RequestHandler):
def get(self):
@@ -57,7 +56,7 @@ def post(self):
title = cgi.escape(self.request.get('title')),
description = cgi.escape(self.request.get('description')),
duration = duration_amount * multiplier,
- )
+ urlcode = hashcode)
issue.put()
if self.request.get('option1'):
issue.add_choice(cgi.escape(self.request.get('option1')))
@@ -71,7 +70,7 @@ def post(self):
issue.add_choice(cgi.escape(self.request.get('option5')))
#self.redirect('/issue/%s' % (issue.key().id()))
- self.redirect('/issue/%s' % hashcode)
+ self.redirect('/issue/%s' % issue.urlcode)
class EditHandler(webapp.RequestHandler):
def get(self,id):
@@ -81,7 +80,8 @@ def get(self,id):
else:
self.redirect(users.create_login_url(self.request.uri))
return
- issue = Issue.get_by_id(int(id))
+ #issue = Issue.get_by_id(int(id))
+ issue = Issue.get_by_urlcode(urlcode)
choices = issue.choices
self.response.out.write(template.render('templates/edit.html', locals()))
@@ -92,8 +92,8 @@ def post(self,id):
else:
self.redirect(users.create_login_url(self.request.uri))
return
- issue = Issue.get_by_id(int(id))
-
+ #issue = Issue.get_by_id(int(id))
+ issue = Issue.get_by_urlcode(urlcode)
if self.request.get('extend'):#if extending vote
choices = issue.choices
@@ -122,7 +122,7 @@ def post(self,id):
issue.add_choice(cgi.escape(self.request.get('option5')))
issue.put()
#choices = issue.choices
- self.redirect('/issue/%s' % (id))
+ self.redirect('/issue/%s' % issue.urlcode)
#self.response.out.write(template.render('templates/edit.html', locals()))
@@ -136,7 +136,8 @@ def get(self,id):
self.redirect(users.create_login_url(self.request.uri))
return
- issue = Issue.get_by_id(int(id))
+ #issue = Issue.get_by_id(int(id))
+ issue = Issue.get_by_urlcode(urlcode)
issue.update_status()
vote = issue.vote_for_member(user)
@@ -151,7 +152,8 @@ def post(self,id):
self.redirect(users.create_login_url(self.request.uri))
return
- issue = Issue.get_by_id(int(id))
+ #issue = Issue.get_by_id(int(id))
+ issue = Issue.get_by_url(urlcode)
#vote = issue.vote_for_member()
new_choice = Choice.get_by_id(int(self.request.get('choice')))
View
@@ -17,6 +17,7 @@ class Issue(db.Model):
creation_date = db.DateTimeProperty(auto_now_add=True)
start_time = db.DateTimeProperty() #time when first vote is cast
end_time = db.DateTimeProperty() #time when vote will end
+ urlcode = db.StringProperty(required=True)
#Implicit Properties:
#choices = Implicitly created list of choice objects
@@ -130,9 +131,7 @@ def recent_results(cls, member=None,limit=20):#*** Need to fix, limit will be in
return [issue for issue in recent if issue.vote_for_member()] #***this is probably slow
#member_votes = Vote.all().filter('member =',member).fetch(limit)
#return [vote.issue for vote in member_votes if vote.issue.has_results()]
-
-
-
+
class Choice(db.Model):
"""Represents a possible response to an issue (e.g. Yes)"""
name = db.StringProperty(required=True)
View
Binary file not shown.
View
@@ -6,7 +6,7 @@
{% if issue.member_is_creator %}
This issue is currently private. You may share it by copy and pasting the following url into an email: <b>{{issueUrl}}</b>
{% if issue.is_active %}
- <form method="get" action="/edit/{{issue.key.id}}"><input type = "submit" value="edit"/></form>
+ <form method="get" action="/edit/{{issue.urlcode}}"><input type = "submit" value="edit"/></form>
<!--
<form method="post">
<input type = "submit" value="stop voting early"/>(coming soon)
View
@@ -12,27 +12,27 @@
<h3>Current Issues</h3>
{% if user %}
{% for issue in issues %}
- <a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
+ <a href="/issue/{{issue.urlcode}}">{{issue.title}}</a></br>
{% endfor %}
{% else %}
<b>You must log in to vote</b>
{% endif %}
<h3>Recent Results</h3>
{% for issue in recent_results %}
- <a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
+ <a href="/issue/{{issue.urlcode}}">{{issue.title}}</a></br>
{% endfor %}
<h3>Recent Votes</h3>
{% for issue in recent_voted %}
- <a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
+ <a href="/issue/{{issue.urlcode}}">{{issue.title}}</a></br>
{% endfor %}
{% if user %}
<h3>My Issues</h3>
{% if created_by %}
{% for issue in created_by %}
- <a href="/issue/{{issue.key.id}}">{{issue.title}}</a></br>
+ <a href="/issue/{{issue.urlcode}}">{{issue.title}}</a></br>
{% endfor %}
{% else %}
You have not created any issues yet

0 comments on commit 7bc3dd0

Please sign in to comment.