Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:svenstaro/flamejam

  • Loading branch information...
commit f12622a77febdb734bec3c13f27adebc5a59b124 2 parents ebdd80f + 1c85b1e
@opatut opatut authored
View
1  README.md
@@ -29,6 +29,7 @@ You will need
- Python 2.7
- flask
+ - flask-mail
- flask-sqlalchemy
- flask-wtf
- flask-login
View
13 flamejam.cfg.example
@@ -1,3 +1,16 @@
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/flamejam.db'
SQLALCHEMY_ECHO = False
SECRET_KEY = 'SUPERSECRET'
+
+# See http://packages.python.org/Flask-Mail/
+#MAIL_SERVER = 'localhost'
+#MAIL_PORT = 25
+#MAIL_USE_TLS = False
+#MAIL_USE_SSL = False
+#MAIL_DEBUG = app.debug
+#MAIL_USERNAME = None
+#MAIL_PASSWORD = None
+#DEFAULT_MAIL_SENDER = None
+#DEFAULT_MAX_EMAILS = None
+#MAIL_FAIL_SILENTLY = True
+#MAIL_SUPPRESS_SEND = False
View
2  flamejam/__init__.py
@@ -1,9 +1,11 @@
from flask import Flask
from datetime import *
+from flaskext.mail import Mail
from flaskext.sqlalchemy import SQLAlchemy
from flaskext.markdown import Markdown
app = Flask(__name__)
+mail = Mail(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///flamejam.db'
app.config['SQLALCHEMY_ECHO'] = False
app.config['SECRET_KEY'] = 'lolsecret'
View
12 flamejam/views.py
@@ -5,6 +5,7 @@
from flask import session, redirect, url_for, escape, request, \
render_template, flash, abort
+from flaskext.mail import Message
from flamejam import app
from flamejam.models import *
@@ -132,6 +133,17 @@ def new_jam():
db.session.add(new_jam)
db.session.commit()
flash('New jam added')
+
+ # Send out mails to all interesed users.
+ participants = Participant.query.filter_by(receive_emails=True).all()
+ with mail.connect() as conn:
+ for participant in participants:
+ msg = Message("BaconGameJam")
+ msg.body = "lol"
+ msg.html = "<b>lol</b>"
+ msg.recipients = [participant.email]
+ conn.send(msg)
+
return redirect(new_jam.url())
return render_template('new_jam.html', form = form, error = error)
View
10 kill-database.py
@@ -12,12 +12,12 @@
db.create_all()
# Make users
-peter = Participant("peter", "omgdlaad21", "peter@rofl.com")
-paul = Participant("paul", "lol", "paul@rofl.com", is_admin=True,
+peter = Participant("peter", "omgdlaad21", "M8R-jejnbk@mailinator.com")
+paul = Participant("paul", "lol", "M8R-jejnbk@mailinator.com", is_admin=True,
is_verified=True)
-per = Participant("per", "lpdla", "per@rofl.com", is_verified = True)
-pablo = Participant("pablo", "lad112", "pablo@rofl.com")
-paddy = Participant("paddy", "rqtjio4j1", "paddy@rofl.com")
+per = Participant("per", "lpdla", "M8R-jejnbk@mailinator.com", is_verified = True)
+pablo = Participant("pablo", "lad112", "M8R-jejnbk@mailinator.com")
+paddy = Participant("paddy", "rqtjio4j1", "M8R-jejnbk@mailinator.com")
# Add users
db.session.add(peter)
View
3  setup.sh
@@ -1,6 +1,9 @@
+#!/bin/bash
+
virtualenv -p python2 env
. env/bin/activate
pip install flask
+pip install flask-mail
pip install flask-sqlalchemy
pip install flask-wtf
pip install flask-login

0 comments on commit f12622a

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