Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

"""Basic views with no home""" 

from pyramid.httpexceptions import HTTPFound 

from pyramid.httpexceptions import HTTPNotFound 

from pyramid.view import view_config 

 

from bookie.models.auth import UserMgr 

 

 

@view_config(route_name="home", renderer="index.mako") 

@view_config(route_name="user_home", renderer="index.mako") 

def home(request): 

    """Inital / view for now until we find a better one""" 

    rdict = request.matchdict 

    username = rdict.get('username', None) 

 

    if not request.user: 

        return {} 

    else: 

        if not username: 

            return HTTPFound(location=request.route_url("bmark_recent")) 

        else: 

            # we need to see if we have a user by this name 

            user = UserMgr.get(username=username) 

 

            if not user: 

                return HTTPNotFound() 

            else: 

                return HTTPFound( 

                    location=request.route_url("user_bmark_recent", 

                                               username=username))