Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 2923:29563959c026
language defaults to config option TRACKER_LANGUAGE
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Thu, 18 Nov 2004 14:05:35 +0000 |
| parents | a8808157f892 |
| children | 81c99c857b57 |
comparison
equal
deleted
inserted
replaced
| 2922:9d2c5d7c6f85 | 2923:29563959c026 |
|---|---|
| 1 # $Id: client.py,v 1.200 2004-11-12 04:07:05 richard Exp $ | 1 # $Id: client.py,v 1.201 2004-11-18 14:05:35 a1s Exp $ |
| 2 | 2 |
| 3 """WWW request handler (also used in the stand-alone server). | 3 """WWW request handler (also used in the stand-alone server). |
| 4 """ | 4 """ |
| 5 __docformat__ = 'restructuredtext' | 5 __docformat__ = 'restructuredtext' |
| 6 | 6 |
| 161 | 161 |
| 162 If omitted, create default TranslationService. | 162 If omitted, create default TranslationService. |
| 163 """ | 163 """ |
| 164 if translator is None: | 164 if translator is None: |
| 165 translator = TranslationService.get_translation( | 165 translator = TranslationService.get_translation( |
| 166 language=self.instance.config["TRACKER_LANGUAGE"], | |
| 166 tracker_home=self.instance.config["TRACKER_HOME"]) | 167 tracker_home=self.instance.config["TRACKER_HOME"]) |
| 167 self.translator = translator | 168 self.translator = translator |
| 168 self._ = self.gettext = translator.gettext | 169 self._ = self.gettext = translator.gettext |
| 169 self.ngettext = translator.ngettext | 170 self.ngettext = translator.ngettext |
| 170 | 171 |
| 800 self.userid = self.db.user.lookup('anonymous') | 801 self.userid = self.db.user.lookup('anonymous') |
| 801 self.user = 'anonymous' | 802 self.user = 'anonymous' |
| 802 | 803 |
| 803 def opendb(self, username): | 804 def opendb(self, username): |
| 804 ''' Open the database and set the current user. | 805 ''' Open the database and set the current user. |
| 805 | 806 |
| 806 Opens a database once. On subsequent calls only the user is set on | 807 Opens a database once. On subsequent calls only the user is set on |
| 807 the database object the instance.optimize is set. If we are in | 808 the database object the instance.optimize is set. If we are in |
| 808 "Development Mode" (cf. roundup_server) then the database is always | 809 "Development Mode" (cf. roundup_server) then the database is always |
| 809 re-opened. | 810 re-opened. |
| 810 ''' | 811 ''' |
| 811 # don't do anything if the db is open and the user has not changed | 812 # don't do anything if the db is open and the user has not changed |
| 812 if hasattr(self, 'db') and self.db.isCurrentUser(username): | 813 if hasattr(self, 'db') and self.db.isCurrentUser(username): |
| 813 return | 814 return |
| 814 | 815 |
| 815 # open the database or only set the user | 816 # open the database or only set the user |
| 816 if not hasattr(self, 'db'): | 817 if not hasattr(self, 'db'): |
| 817 self.db = self.instance.open(username) | 818 self.db = self.instance.open(username) |
| 818 else: | 819 else: |
| 819 if self.instance.optimize: | 820 if self.instance.optimize: |
