Skip to content

Commit

Permalink
Merge branch 'master' of github.com:trendrr/whirlwind
Browse files Browse the repository at this point in the history
  • Loading branch information
dustismo committed Mar 8, 2011
2 parents 46fec77 + da106f2 commit 5393958
Show file tree
Hide file tree
Showing 25 changed files with 733 additions and 254 deletions.
55 changes: 55 additions & 0 deletions whirlwind/bin/whirlwind
@@ -0,0 +1,55 @@
#!/bin/bash -e

. /lib/lsb/init-functions

if [[ $1 == -c ]]; then
CONFIG_FILE=$2
else
CONFIG_FILE=/etc/whirlwind.conf
fi

if [[ -f $CONFIG_FILE ]]; then
. $CONFIG_FILE
fi

#DAEMON_DIR=/trendrr/WeatherChannelAdmin
DAEMON=$DAEMON_DIR/main.py
NAME=whirlwind
DESC="whirlwind daemon"

test -f $DAEMON || exit 0

case "$1" in
start)
echo -n "Starting $DESC: "
for PORT in ${PORTS[@]}
do
start-stop-daemon --start --pidfile /var/run/"$NAME-$PORT".pid --chdir $DAEMON_DIR --make-pidfile --background --startas $DAEMON
echo "$NAME $PORT."
done
;;
stop)
echo -n "Stopping $DESC: "
for PORT in ${PORTS[@]}
do
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME-$PORT".pid
rm -f /var/run/"$NAME-$PORT".pid
echo "$NAME $PORT."
done
;;
restart)
echo -n "Restarting $DESC: "
for PORT in ${PORTS[@]}
do
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME-$PORT".pid
rm -f /var/run/"$NAME-$PORT".pid
start-stop-daemon --start --pidfile /var/run/"$NAME-$PORT".pid --chdir $DAEMON_DIR --make-pidfile --background --startas $DAEMON
echo "$NAME $PORT."
done
;;
*)
echo "Usage: "$1" {start|stop|restart}"
exit 1

esac
exit 0
2 changes: 2 additions & 0 deletions whirlwind/bin/whirlwind.conf
@@ -0,0 +1,2 @@
DAEMON_DIR=/trendrr/WeatherChannelAdmin
PORTS=(8000 8001 8002 8003)
@@ -1,10 +1,7 @@
#from tornado import web
from mako.template import Template
from whirlwind.core.request import BaseRequest
from whirlwind.db.mongo import Mongo
import hashlib
from application.models.user import User
import datetime
import datetime, hashlib
from tornado.web import authenticated
from whirlwind.view.decorators import route

Expand All @@ -22,7 +19,7 @@ def get(self):
template_values = {}
template_values['next'] = self.get_argument('next','/')

self.render_template('/site/login.html',**template_values)
self.render_template('/account/login.html',**template_values)

def post(self):
username = self.get_argument("username",None)
Expand Down Expand Up @@ -74,7 +71,7 @@ def get(self):
template_values = {}
template_values['next'] = self.get_argument('next','/')

self.render_template('/site/signup.html',**template_values)
self.render_template('/account/signup.html',**template_values)

def post(self):
username = self.get_argument("username",None)
Expand All @@ -96,12 +93,6 @@ def post(self):
self.flash.info = "Successfully created your account, please log in."
self.redirect("/login")







class PasswordChanger(BaseRequest):
@authenticated
def post(self):
Expand Down
@@ -1,17 +1,12 @@
#from tornado import web
from mako.template import Template
from whirlwind.core.request import BaseRequest

from whirlwind.db.mongo import Mongo
import hashlib
import os, StringIO, pycurl
from tornado.web import authenticated
from whirlwind.view.decorators import route

@route('/')
class IndexHandler(BaseRequest):
def get(self):
template_values = {
'page_id' : 'homepage'
}
self.render_template('/site/welcome.html',**template_values)
#template context variables go in here
template_values = {}

self.render_template('/site/index.html',**template_values)
38 changes: 38 additions & 0 deletions whirlwind/conf/app_template/application/views/account/login.html
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
<%inherit file="/layouts/content.html" />

<%def name="body()">
<div class="form" style="margin:0 auto 0 auto;width: 250px;">
<div class="title">
Please Log-in
</div>
<form action="/login" method="post">
<input type="hidden" name="next" value="${next}" />
<div class="field">
<label for="username" class="label">
Username
</label>
<div class="input">
<input type="text" id="username" name="username"/>
</div>
</div>

<div class="field">
<label for="password" class="label">
Password
</label>
<div class="input">
<input type="password" id="password" name="password"/>
</div>
</div>

<div class="field">
<label for="keep_logged_in"><input type="checkbox" name="keep_logged_in" id="keep_logged_in" /> keep me logged in</label>
</div>

<div class="buttons">
<input type="submit" value="Login" class="button" />
</div>
</form>
</div>
</%def>
43 changes: 43 additions & 0 deletions whirlwind/conf/app_template/application/views/account/signup.html
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
<%inherit file="/layouts/content.html" />

<%def name="body()">
<div class="form" style="margin:0 auto 0 auto;width: 250px;">
<div class="title">
Please Sign-up
</div>
<form action="/signup" method="post">
<input type="hidden" name="next" value="${next}" />
<div class="field">
<label for="username" class="label">
Username
</label>
<div class="input">
<input type="text" id="username" name="username"/>
</div>
</div>

<div class="field">
<label for="password" class="label">
Password
</label>
<div class="input">
<input type="password" id="password" name="password"/>
</div>
</div>

<div class="field">
<label for="password2" class="label">
Confirm Password
</label>
<div class="input">
<input type="password" id="password2" name="password2"/>
</div>
</div>

<div class="buttons">
<input type="submit" value="Signup" class="button" />
</div>
</form>
</div>
</%def>
21 changes: 21 additions & 0 deletions whirlwind/conf/app_template/application/views/layouts/content.html
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
<%inherit file="/layouts/htmlPage.html" />

### Template for content pages
<%def name="body()">
<%include file="/shared/flash_messages.html"/>
<div id="wrap">
<div id="main">
<%include file="/shared/header.html"/>
<div id="content">
<div id="content-inner">
<%def name="body_content()">
${next.body()}
</%def>
${body_content()}
</div>
</div>
</div>
</div>
<%include file="/shared/footer.html"/>
</%def>
Expand Up @@ -5,20 +5,23 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<%def name="page_title()">WELCOME!</%def>
<%def name="page_title()">Welcome to Whirlwind</%def>
<title>
${self.page_title()}
</title>
<meta name="keywords" content="" />
<meta name="description" content="" />


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/css/public.css" />

<script type="text/javascript" src="/static/js/date.js"></script>
<script type="text/javascript" src="/static/js/whirlwind.js"></script>
<link rel="stylesheet" type="text/css" href="/static/css/style.css" />
<!--[if !IE 7]>
<style type="text/css">
#wrap {display:table;height:100%}
</style>
<![endif]-->
${self.head_tags()}
<%def name="head_tags()"></%def>
</head>
<body>
${next.body()}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-

% if flash:
<div id="flash-message" class="flash-message">
<div id="flash-message-list"></div>
</div>
<script>
var message = "<ul id='flash-message-items'>";
% if 'error' in flash:
% for message in flash['error']:
message += "<li class='error'>${message | h}</li>";
% endfor
% endif
% if 'notice' in flash:
% for message in flash['notice']:
message += "<li class='notice'>${message | h}</li>";
% endfor
% endif
% if 'info' in flash:
% for message in flash['info']:
message += "<li class='info'>${message | h}</li>";
% endfor
% endif
% if 'success' in flash:
% for message in flash['success']:
message += "<li class='success'>${message | h}</li>";
% endfor
% endif
message += "</ul>";
showNotification(message, '', function(){});
</script>
% endif
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-

<div id="footer">
<div id="footer-inner">
<div id="copyright">
&copy; <script>document.write(Date.today().toString("yyyy"));</script>. All rights reserved.
</div>
</div>
</div>
20 changes: 20 additions & 0 deletions whirlwind/conf/app_template/application/views/shared/header.html
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
<div id="header">
<div id="header-inner">
<div id="logo">
<h1>
<a href="/">Whirlwind</a>
</h1>
</div>
<div id="user-menu">
% if is_logged_in :
${current_user['_id']} :
<a href="/logout">log-out</a>
% else :
<a href="/login">log-in</a> :
<a href="/signup">sign-up</a>
% endif
</div>
<div class="clear"></div>
</div>
</div>

0 comments on commit 5393958

Please sign in to comment.