/[glsr]/trunk/site/basedomain.py
Gentoo

Contents of /trunk/site/basedomain.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 171 - (show annotations) (download) (as text)
Sun Oct 30 19:42:41 2005 UTC (8 years, 9 months ago) by hadfield
File MIME type: text/x-python
File size: 1960 byte(s)
modified code to work with the new framework
1
2 import os
3
4 from framework.lib.template import Template
5
6 from glsr.setup import config
7 from glsr.site import user
8
9 class BaseDomain:
10
11 def __init__(self, harm):
12
13 self._harm = harm
14 self._template = Template()
15 self._tmpl_name = ""
16
17 if hasattr(self, 'init'):
18 self.init()
19
20 def _set_template(self, template):
21 self._template.set_template(template)
22
23 def _get_user(self):
24 """Returns the uid with the user's alias."""
25
26 uid = user.get_uid_by_sid(self._harm.session.get_id())
27
28 if uid == None:
29 return (0, '')
30
31 return (uid, user.User(uid).get_alias())
32
33 def _do_header(self, title = ""):
34 """Print the header."""
35
36 (uid, alias) = self._get_user()
37 user_obj = user.User(uid)
38
39 self._set_template(os.path.join(config.template_loc, "header.tpl"))
40 self._template.param('GLSR_URL', config.url)
41 self._template.param('STATIC_URL', config.static_url)
42 self._template.param('TITLE', title)
43 self._template.param('USER_ALIAS', alias)
44 self._template.param('USER_ID', uid)
45 self._template.param('USER_TYPE', user_obj.type_name())
46 self._harm.response.append_body(self._template.output())
47
48 def _do_footer(self):
49 """Print the footer."""
50
51 user_obj = user.User(self._get_user()[0])
52
53 self._set_template(os.path.join(config.template_loc, 'footer.tpl'))
54 self._template.param('GLSR_VERSION', config.__version__)
55 self._template.param('USER_TYPE', user_obj.type_name())
56 self._harm.response.append_body(self._template.output())
57
58 def access_error(self):
59 """Print an access error message."""
60
61 self._do_header()
62 self._set_template(os.path.join(config.template_loc,
63 "access_error.tpl"))
64 self._harm.response.append_body(self._template.output())
65 self._do_footer()

Properties

Name Value
svn:keyword Id
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.20