Anonymous avatar Anonymous committed 1d21623

done for now

Comments (0)

Files changed (16)

.settings/org.eclipse.core.resources.prefs

-#Thu Jun 17 09:59:54 CDT 2010
-eclipse.preferences.version=1
-encoding//CS242Registration/cs242registration/websetup.py=utf-8
+#Fri Jun 18 11:06:12 CDT 2010
+eclipse.preferences.version=1
+encoding//CS242Registration/cs242registration/lib/helpers.py=utf-8
+encoding//CS242Registration/cs242registration/websetup.py=utf-8

CS242Registration/cs242registration/config/routing.py

     map.connect('/error/{action}/{id}', controller='error')
 
     # CUSTOM ROUTES HERE
-
+    map.connect('/',controller='registration', action='index')
     map.connect('/{controller}/{action}')
     map.connect('/{controller}/{action}/{id}')
 

CS242Registration/cs242registration/controllers/login.py

-import logging
-
-from pylons import request, response, session, tmpl_context as c
-from pylons.controllers.util import abort, redirect_to
-
-from cs242registration.lib.base import BaseController, render
-
-log = logging.getLogger(__name__)
-
-class LoginController(BaseController):
-
-    def index(self):
-        # Return a rendered template
-        #return render('/login.mako')
-        # or, return a response
-        return 'Hello World'

CS242Registration/cs242registration/controllers/moderator.py

+import logging
+
+from pylons import request, response, session, tmpl_context as c
+from pylons.controllers.util import abort, redirect_to
+
+from cs242registration.lib.base import BaseController, render
+
+log = logging.getLogger(__name__)
+
+class ModeratorController(BaseController):
+
+    def index(self):
+        # Return a rendered template
+        #return render('/moderator.mako')
+        # or, return a response
+        return 'Hello World'

CS242Registration/cs242registration/controllers/registration.py

 from pylons.controllers.util import abort, redirect_to
 
 from cs242registration.lib.base import BaseController, render
+from cs242registration.lib import helpers as h
+from cs242registration.model import Student, Moderator
 
 log = logging.getLogger(__name__)
 
 class RegistrationController(BaseController):
 
     def index(self):
-        # Return a rendered template
-        #return render('/registration.mako')
-        # or, return a response
-        return 'Hello World'
+        user = h.get_user();
+        log.debug(str(user))
+        session['user'] = user;
+        session.save();
+        session.persist();
+        if(isinstance(user, Student)):
+            redirect_to(controller='student', action='index')
+        elif(isinstance(user, Moderator)):
+            redirect_to(controller='moderator', action='index')
+        else:
+            abort(404)            

CS242Registration/cs242registration/controllers/student.py

+import logging
+
+from pylons import request, response, session, tmpl_context as c
+from pylons.controllers.util import abort, redirect_to
+
+from cs242registration.lib.base import BaseController, render
+
+log = logging.getLogger(__name__)
+
+class StudentController(BaseController):
+
+    def index(self):
+        # Return a rendered template
+        #return render('/student.mako')
+        # or, return a response
+        return 'Hello World'

CS242Registration/cs242registration/lib/helpers.py

 from webhelpers.html import literal
 from webhelpers.pylonslib import Flash
 import sqlalchemy.types as types
+from cs242registration.model import Moderator, Student
+from sqlalchemy.orm.exc import NoResultFound
 flash = Flash()
 # End of.
 
         abort(404)
     return obj
 
+def get_user():
+    from pylons import request
+    if not request.environ.has_key('REMOTE_USER'):
+        request.environ['REMOTE_USER'] = "cemeyer2"
+    netid = request.environ['REMOTE_USER']
+    try:
+        moderator = Moderator.query.filter_by(netid=netid).first()
+        if moderator is not None:
+            return moderator
+    except NoResultFound:
+        pass
+    try:
+        student = Student.query.filter_by(netid=netid).first()
+        if not student:
+            student = Student(netid=netid)
+    except NoResultFound:
+        student = Student(netid=netid)
+    return student

CS242Registration/cs242registration/model/model.py

 class User(elixir.Entity):
     netid = elixir.Field(elixir.String(10),unique=True)
     
+    def __repr__(self):
+        return "<user netid=%s>"%(str(self.netid))
+    
 class Moderator(User):
     elixir.using_options(inheritance="multi")
     sections = elixir.OneToMany("Section", cascade="all")
     admin = elixir.Field(elixir.Boolean(), default=False)
     
+    def __repr__(self):
+        return "<moderator netid=%s admin=%s>"%(str(self.netid), str(self.admin))
+    
 class Student(User):
     elixir.using_options(inheritance="multi")
     section = elixir.ManyToOne("Section")
     
+    def __repr__(self):
+        return "<student netid=%s>"%(str(self.netid))
+    
 class Section(elixir.Entity):
     day = elixir.Field(elixir.Integer())
     time = elixir.Field(elixir.Integer())

CS242Registration/cs242registration/public/index.html

-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-    <head>
-        <title>Welcome to Pylons with Shabti!</title>
-        <style type="text/css">
-            body {
-                font-family: arial, helvetica, sans-serif;
-                background-color: #ffc900;
-                background-image: url(bg.png);
-                background-repeat: repeat-x;
-                width:100%;
-                height:100%;
-                margin:0;
-                max-height: 100%;
-                padding:0;
-                border:none;
-                line-height:1.4;
-            }
-            #container {
-                color:white;
-                background-color:#111;
-                position: absolute;
-                left: 50%;
-                width: 500px;
-                margin-left: -300px;
-                padding:50px;
-                height:100%;
-            }
-            #footer {
-                margin: 120px 0 0 0;
-                padding: 3px;
-                text-align:center;
-                font-size:small;
-                background-color:#222;
-                letter-spacing: 1px;
-            }
-            h1 {
-                text-align:center;
-                font-size:xx-large;
-                font-weight:normal;
-                margin: 0 0 20px 0;
-                border:none;
-                padding:0;
-                letter-spacing: 5px;
-            }
-            h2 {
-                font-size:xx-large;
-                font-weight:normal;
-                margin: 0 0 20px 0;
-                border:none;
-                padding:0;
-            }
-            hr {
-                margin-bottom:30px;
-                border: 1px solid #222;
-                background-color: #222;
-                padding: 2px;
-            }
-            #logo {
-                background-image: url(signum8b_spk.png);
-                background-repeat: no-repeat;
-                height: 0;
-                overflow: hidden;
-                padding-top: 99px;
-                width: 239px;
-            }
-            #left {
-                float:left;
-                width:250px;
-                margin:0 50px 0 0;
-                border:none;
-                padding:0 0 0 10px;
-            }
-            #right {
-                margin:0 0 0 330px;
-                border:none;
-                padding:0;
-            }
-            ul {
-                list-style:none;
-                margin:0;
-                border:none;
-                padding:0;
-            }
-            a:visited {
-                color:white;
-                text-decoration:none;
-            }
-            a:link {
-                color:white;
-                text-decoration:none;
-            }</style>
-    </head>
-    <body>
-        <div id="container">
-            <h1>Welcome to <img src="pylons-logo.gif" alt="Logo displaying the word Pylons"
-                    style="vertical-align:-15px; width: 250px;"/>
-            </h1>
-            <hr/>
-            <div style="border:1px solid #ff7700; margin: 1em auto; padding: 0.5em 1em;"><h2>"<span style="color:lime">Elixir DSL</span>" starter kit.</h2>
-                <p><a href="http://bel-epa.com/notes/Pylons/Shabti/" style="text-decoration:underline;color:red">Shabti</a> skeletal web app. A barebones integration of Elixir, a declarative layer for modelling in Pylons.</p>
-</div>
-            <div id="left">
-                <h2>Let's begin!</h2>
-                <p>If you haven't used Pylons before, start with the <a href="http://pylonshq.com/docs/en/0.9.7/gettingstarted/"
-                        style="text-decoration:underline;">beginners' tutorial</a>.</p>
-            </div>
-            <div id="right">
-                <h2>Help</h2>
-                <ul>
-                    <li>
-                        <a href="http://docs.pylonshq.com/">Official documentation</a>
-                    </li>
-                    <li>
-                        <a href="http://wiki.pylonshq.com/display/pylonsfaq/Home">FAQ</a>
-                    </li>
-                    <li>
-                        <a href="http://wiki.pylonshq.com/dashboard.action">Wiki</a>
-                    </li>
-                    <li>
-                        <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-JointheMailingLists">Mailing list</a>
-                    </li>
-                    <li>
-                        <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-IRC">IRC</a>
-                    </li>
-                    <li>
-                        <a href="http://pylonshq.com/project/">Bug tracker</a>
-                    </li>
-                </ul>
-            </div>
-            <div id="footer">
-                <a href="http://www.pylonshq.com" style="color: #ccc; text-decoration:none;"
-                    >www.pylonshq.com</a>
-            </div>
-        </div>
-    </body>
-</html>

CS242Registration/cs242registration/tests/functional/test_moderator.py

+from cs242registration.tests import *
+
+class TestModeratorController(TestController):
+
+    def test_index(self):
+        response = self.app.get(url(controller='moderator', action='index'))
+        # Test response...

CS242Registration/cs242registration/tests/functional/test_student.py

+from cs242registration.tests import *
+
+class TestStudentController(TestController):
+
+    def test_index(self):
+        response = self.app.get(url(controller='student', action='index'))
+        # Test response...

CS242Registration/cs242registration/websetup.py

 def setup_app(command, conf, vars):
     """Place any commands to setup cs242registration here"""
     load_environment(conf.global_conf, conf.local_conf)
-    model.metadata.echo = True;
     model.metadata.create_all()
 
     # Initialisation here ... this sort of stuff:

CS242Registration/data/sessions/container_file/6/66/66ae2d4fbdb8ac148ac4dd67b77f852d.cache

+(dp1
+S'session'
+p2
+(dp3
+S'_accessed_time'
+p4
+F1276878157.9160399
+sS'user'
+p5
+ccopy_reg
+_reconstructor
+p6
+(ccs242registration.model.model
+Student
+p7
+c__builtin__
+object
+p8
+NtRp9
+(dp10
+S'_sa_instance_state'
+p11
+g6
+(csqlalchemy.orm.state
+InstanceState
+p12
+g8
+NtRp13
+(dp14
+S'instance'
+p15
+g9
+sS'modified'
+p16
+I01
+sS'committed_state'
+p17
+(dp18
+S'netid'
+p19
+csqlalchemy.util
+symbol
+p20
+(S'NO_VALUE'
+p21
+tRp22
+ssbsg19
+S'cemeyer2'
+p23
+sbsS'_creation_time'
+p24
+F1276878157.9160399
+ss.

CS242Registration/data/sessions/container_file/9/90/90f1d4f5fce2976097b5edf667c83a01.cache

+(dp1
+S'session'
+p2
+(dp3
+S'_accessed_time'
+p4
+F1276878505.096164
+sS'user'
+p5
+ccopy_reg
+_reconstructor
+p6
+(ccs242registration.model.model
+Student
+p7
+c__builtin__
+object
+p8
+NtRp9
+(dp10
+S'_sa_instance_state'
+p11
+g6
+(csqlalchemy.orm.state
+InstanceState
+p12
+g8
+NtRp13
+(dp14
+S'instance'
+p15
+g9
+sS'modified'
+p16
+I01
+sS'committed_state'
+p17
+(dp18
+S'netid'
+p19
+csqlalchemy.util
+symbol
+p20
+(S'NO_VALUE'
+p21
+tRp22
+ssbsg19
+S'cemeyer2'
+p23
+sbsS'_creation_time'
+p24
+F1276878179.6802521
+ss.
Add a comment to this file

CS242Registration/data/sessions/container_file_lock/c/ca/ca18def4d2ca87372678d187af62d8fd49b95edc.lock

Empty file added.

Add a comment to this file

CS242Registration/data/sessions/container_file_lock/e/e1/e1dbc717e7393a5a5ee9bdaeab82f93b568452f7.lock

Empty file added.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.