Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More tweaks.

  • Loading branch information...
commit f50dae79f305ec7baaebb56e077b1c54c7cc7e89 1 parent d1d0abb
@kushal authored
View
2  emails.py
@@ -62,6 +62,6 @@ def post(self):
logging.info(all_snippets)
body = '\n\n\n'.join([self.__snippet_to_text(s) for s in all_snippets if s.user.email in following])
if body:
- self.__send_mail(user.email, body)
+ self.__send_mail(user.email, 'https://fssnippets.appspot.com\n\n' + body)
else:
logging.info(user.email + ' not following anybody.')
View
15 receive_email.py
@@ -1,6 +1,7 @@
import datetime
import email
import logging
+import re
from google.appengine.ext import webapp
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
@@ -14,8 +15,18 @@ class ReceiveEmail(InboundMailHandler):
def receive(self, message):
user = user_from_email(email.utils.parseaddr(message.sender)[1])
- for content_type, body in message.bodies('text/plain'):
- create_or_replace_snippet(user, body.decode(), date_for_new_snippet())
+ for content_type, body in message.bodies('text/plain'):
+ content = body.decode()
+
+ sig_pattern = re.compile(r'^\-\-\s*$', re.MULTILINE)
+ split_email = re.split(sig_pattern, content)
+ content = split_email[0]
+
+ reply_pattern = re.compile(r'^On.*snippets.*wrote:$', re.MULTILINE)
+ split_email = re.split(reply_pattern, content)
+ content = split_email[0]
+
+ create_or_replace_snippet(user, content, date_for_new_snippet())
def main():
View
5 templates/base.html
@@ -2,7 +2,8 @@
<html>
<head>
<style>
- body { font-family: Courier New, monospaced; font-size: 83% }
+ body.x { font-family: Courier New, monospaced; }
+ body {font-family: Helvetica; }
a.light { color: #AAA; text-decoration: none }
a.light:hover { text-decoration: underline }
</style>
@@ -10,7 +11,7 @@
</head>
<body>
- <h1><a class="light" href="/">snippets</a></h2>
+ <h1><a class="light" style="color: #2398C9" href="/">snippets</a></h2>
{% block body %}
{% endblock %}
</body>
View
13 templates/index.html
@@ -1,18 +1,23 @@
{% extends "base.html" %}
{% block body %}
- <h2><a href="/user/{{ current_user.email }}">{{ current_user.email }}</a></h2>
+
+<table><tr><td>
+ <h2><a href="/user/{{ current_user.email }}">{{ current_user.pretty_name }}</a></h2>
+ </td><td><div style="width: 30px"></div></td><td style="font-size: 83%">
currently
{% if current_user.enabled %}
enabled (<a class="light" href="?setenabled=0">disable</a>)
{% else %}
disabled (<a class="light" href="?setenabled=1">enable</a>)
{% endif %}
+ <form action="/" method="get">
+ my tags <input name="tags" type="text" value="{{ current_user.tags|join:"," }}"/></form>
- <br/><br/>
- my tags <form action="/" method="get"><input name="tags" type="text" value="{{ current_user.tags|join:"," }}"/></form>
- <br/><br/>
+ </td></tr></table>
+ <br/>
+
send your snippets to snippets@fssnippets.appspotmail.com by monday afternoon!
<br/><br/>
<table cellspacing=20>
View
2  templates/tag.html
@@ -12,7 +12,7 @@
{% endif %}
</div>
- <div style="float: left; margin-left: 30px">
+ <div style="float: left; margin-left: 30px; max-width: 600px">
{% for snippet in snippets %}
<b>{{ snippet.user.pretty_name }}</b><br/>
<pre>{{ snippet.text }}</pre>
View
2  templates/user.html
@@ -24,7 +24,7 @@
{% endfor %}
</div>
- <div style="float: left; margin-left: 30px">
+ <div style="float: left; margin-left: 30px; max-width: 600px">
{% for snippet in snippets %}
<b>{{ snippet.date }}</b><br/>
<pre>{{ snippet.text }}</pre>

0 comments on commit f50dae7

Please sign in to comment.
Something went wrong with that request. Please try again.