- Timestamp:
- 10/15/09 10:56:27 (3 years ago)
- Location:
- elixir/trunk/examples/videostore
- Files:
-
- 4 modified
-
start-videostore.py (modified) (1 diff)
-
videostore/controllers/root.py (modified) (6 diffs)
-
videostore/model.py (modified) (3 diffs)
-
videostore/tests/test_controllers.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/examples/videostore/start-videostore.py
r11 r501 14 14 # probably installed 15 15 if len(sys.argv) > 1: 16 update_config(configfile=sys.argv[1], 16 update_config(configfile=sys.argv[1], 17 17 modulename="videostore.config") 18 18 elif exists(join(dirname(__file__), "setup.py")): -
elixir/trunk/examples/videostore/videostore/controllers/root.py
r298 r501 7 7 8 8 class Root(RootController): 9 9 10 10 @expose(template='videostore.templates.index') 11 11 @identity.require(identity.not_anonymous()) 12 12 def index(self): 13 13 return dict(movies=Movie.query.all()) 14 15 14 15 16 16 @expose(template='videostore.templates.movie') 17 17 @identity.require(identity.not_anonymous()) … … 19 19 def movie(self, movieID): 20 20 return dict(movie=Movie.get(movieID)) 21 22 21 22 23 23 @expose(template='videostore.templates.actor') 24 24 @identity.require(identity.not_anonymous()) … … 26 26 def actor(self, actorID): 27 27 return dict(actor=Actor.get(actorID)) 28 29 28 29 30 30 @expose(template='videostore.templates.director') 31 31 @identity.require(identity.not_anonymous()) … … 33 33 def director(self, directorID): 34 34 return dict(director=Director.get(directorID)) 35 36 35 36 37 37 @expose(template='videostore.templates.login') 38 38 def login(self, forward_url=None, previous_url=None, *args, **kw): … … 41 41 identity.get_identity_errors(): 42 42 raise redirect(forward_url) 43 43 44 44 forward_url = None 45 45 previous_url = request.path 46 46 47 47 if identity.was_login_attempted(): 48 48 msg = 'The credentials you supplied were not correct.' … … 52 52 msg = 'Please log in.' 53 53 forward_url = request.headers.get('Referer', '/') 54 54 55 55 response.status = 403 56 return dict(message=msg, 57 previous_url=previous_url, 56 return dict(message=msg, 57 previous_url=previous_url, 58 58 logging_in=True, 59 59 original_parameters=request.params, 60 60 forward_url=forward_url) 61 62 61 62 63 63 @expose() 64 64 def logout(self): -
elixir/trunk/examples/videostore/videostore/model.py
r316 r501 29 29 movies = ManyToMany('Movie', inverse='actors', tablename='movie_casting') 30 30 using_options(tablename='actors') 31 31 32 32 33 33 # 34 34 # identity model 35 # 35 # 36 36 37 37 class Visit(Entity): … … 40 40 expiry = Field(DateTime) 41 41 using_options(tablename='visit') 42 42 43 43 @classmethod 44 44 def lookup_visit(cls, visit_key): … … 68 68 groups = ManyToMany('Group', inverse='users') 69 69 using_options(tablename='tg_user') 70 70 71 71 @property 72 72 def permissions(self): -
elixir/trunk/examples/videostore/videostore/tests/test_controllers.py
r11 r501 7 7 def teardown_func(): 8 8 """Tests for apps using identity need to stop CP/TG after each test to 9 stop the VisitManager thread. See http://trac.turbogears.org/turbogears/ticket/121710 for details.9 stop the VisitManager thread. 10 See http://trac.turbogears.org/turbogears/ticket/1217 for details. 11 11 """ 12 12 turbogears.startup.stopTurboGears()
