~jelmer/loggerhead/breezy

« back to all changes in this revision

Viewing changes to loggerhead/controllers/__init__.py

  • Committer: Robey Pointer
  • Date: 2006-12-11 06:44:19 UTC
  • Revision ID: robey@lag.net-20061211064419-8ssa7mlsiflpmy0c
initial checkin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright (C) 2006  Robey Pointer <robey@lag.net>
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
#
 
18
 
 
19
import logging
 
20
 
 
21
import turbogears
 
22
from turbogears import controllers
 
23
from cherrypy import HTTPRedirect, NotFound
 
24
 
 
25
"""
 
26
from okulo.controllers.page_ui import PageUI
 
27
from okulo.controllers.login_ui import LoginUI, LogoutUI
 
28
from okulo.controllers.history_ui import HistoryUI
 
29
from okulo.controllers.edit_ui import EditUI
 
30
from okulo.controllers.contents_ui import ContentsUI
 
31
from okulo.controllers.source_ui import SourceUI
 
32
from okulo.controllers.search_ui import SearchUI
 
33
from okulo.controllers.add_ui import AddUI
 
34
from okulo.controllers.signup_ui import SignupUI
 
35
from okulo.controllers.atom_ui import AtomUI
 
36
from okulo.controllers.userhome_ui import UserHomeUI
 
37
from okulo.controllers.delete_ui import DeleteUI
 
38
"""
 
39
from loggerhead.controllers.changelog_ui import ChangeLogUI
 
40
from loggerhead.controllers.atom_ui import AtomUI
 
41
 
 
42
 
 
43
log = logging.getLogger("loggerhead.controllers")
 
44
 
 
45
class Root (controllers.RootController):
 
46
    changes = ChangeLogUI()
 
47
    atom = AtomUI()
 
48
    
 
49
    @turbogears.expose(template="loggerhead.templates.welcome")
 
50
    def index(self):
 
51
        import time
 
52
        log.debug("Happy TurboGears Controller Responding For Duty")
 
53
        return dict(now=time.ctime())
 
54
 
 
55
"""
 
56
            if args['cmd'][0] == 'changelog':
 
57
 
 
58
                otherrevid = get("otherrevid")
 
59
                pathrevid = get("pathrevid")
 
60
                path = get("path")
 
61
 
 
62
                self.write(self.changelog(revno, None, path, pathrevid, otherrevid))
 
63
 
 
64
    def changelog(self, revid, search=None, path=None,
 
65
        pathrevid=None, otherrevid=None ):
 
66
            import cmd_changelog
 
67
            return cmd_changelog.changelog(self, revid, search, path,
 
68
                pathrevid, otherrevid )
 
69
 
 
70
 
 
71
 
 
72
    revid, history, pathrevid, otherrevid =
 
73
     hgweb.compute_history(revid, path,        pathrevid, otherrevid )
 
74
                                                    
 
75
                                                    
 
76
class Root (controllers.Root):
 
77
    page = PageUI()
 
78
    login = LoginUI()
 
79
    logout = LogoutUI()
 
80
    history = HistoryUI()
 
81
    edit = EditUI()
 
82
    contents = ContentsUI()
 
83
    source = SourceUI()
 
84
    search = SearchUI()
 
85
    add = AddUI()
 
86
    signup = SignupUI()
 
87
    atom = AtomUI()
 
88
    delete = DeleteUI()
 
89
    
 
90
    @turbogears.expose()
 
91
    def index(self, *args):
 
92
        raise HTTPRedirect(turbogears.url('/page/start'))
 
93
    
 
94
    @turbogears.expose()
 
95
    def default(self, *args):
 
96
        if args[0].startswith('~'):
 
97
            home = UserHomeUI(args[0][1:])
 
98
            if len(args) == 1:
 
99
                return home.index()
 
100
            return home.default(*args[1:])
 
101
        raise NotFound()
 
102
"""