Skip to content

Commit

Permalink
horus almost working
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Santagada committed Jul 19, 2013
1 parent 6fe0cb4 commit a929f70
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
17 changes: 15 additions & 2 deletions development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@ pyramid.default_locale_name = en
pyramid.includes =
pyramid_debugtoolbar
pyramid_tm
horus
pyramid_beaker
pyramid_mailer

sqlalchemy.url = sqlite:///%(here)s/timtec.sqlite

horus.user_class = timtec.models.User
horus.activation_class = timtec.models.Activation
horus.login_redirect = login
horus.logout_redirect = logout

session.type = memory
session.key = mykey
session.secret = mysecret
session.cookie_on_exception = true

cache.regions = default_term, second, short_term, long_term
cache.type = memory
cache.second.expire = 1
cache.short_term.expire = 60
cache.default_term.expire = 300
cache.long_term.expire = 3600

# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ WebOb==1.2.3
zope.deprecation==4.0.2
zope.interface==4.0.5
zope.sqlalchemy==0.7.2
horus==0.9.13
git+git://github.com/eventray/horus.git#egg=horus
10 changes: 6 additions & 4 deletions timtec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from hem.interfaces import IDBSession

from pyramid_beaker import session_factory_from_settings
from .models import (
DBSession,
Base,
)
from . import models


def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.bind = engine
session_factory = session_factory_from_settings(settings)
config = Configurator(settings=settings)
config.include('horus')
config.include('pyramid_mailer')
config.set_session_factory(session_factory)
config.registry.registerUtility(DBSession, IDBSession)
# config.scan_horus(models)
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.scan_horus(models)
config.add_route('index', '/')
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.scan()
Expand Down
2 changes: 1 addition & 1 deletion timtec/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)


@view_config(route_name='home', renderer='templates/mytemplate.pt')
@view_config(route_name='index', renderer='templates/mytemplate.pt')
def my_view(request):
try:
one = DBSession.query(User).filter(User.username == 'one').first()
Expand Down

0 comments on commit a929f70

Please sign in to comment.