Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: commits

[4199] cherokee/branches/adminctk/admin: WIP: Gettext; PageGeneral

 

 

Cherokee commits RSS feed   Index | Next | Previous | View Threaded


cherokee at cherokee-project

Jan 29, 2010, 8:38 AM

Post #1 of 1 (120 views)
Permalink
[4199] cherokee/branches/adminctk/admin: WIP: Gettext; PageGeneral

Revision: 4199
http://svn.cherokee-project.com/changeset/4199
Author: alo
Date: 2010-01-29 17:38:12 +0100 (Fri, 29 Jan 2010)

Log Message:
-----------
WIP: Gettext; PageGeneral

Modified Paths:
--------------
cherokee/branches/adminctk/admin/PageGeneral.py
cherokee/branches/adminctk/admin/server.py
cherokee/branches/adminctk/admin-classic/PageGeneral.py

Modified: cherokee/branches/adminctk/admin/PageGeneral.py
===================================================================
--- cherokee/branches/adminctk/admin/PageGeneral.py 2010-01-29 16:37:15 UTC (rev 4198)
+++ cherokee/branches/adminctk/admin/PageGeneral.py 2010-01-29 16:38:12 UTC (rev 4199)
@@ -25,6 +25,26 @@
import CTK
import Page

+URL_BASE = '/general'
+URL_APPLY = '/general/apply'
+
+PRODUCT_TOKENS = [.
+ ('', N_('Default')),
+ ('product', N_('Product only')),
+ ('minor', N_('Product + Minor version')),
+ ('minimal', N_('Product + Minimal version')),
+ ('os', N_('Product + Platform')),
+ ('full', N_('Full Server string'))
+]
+
+NOTE_IPV6 = N_('Set to enable the IPv6 support. The OS must support IPv6 for this to work.')
+NOTE_TOKENS = N_('This option allows to choose how the server identifies itself.')
+
+
+
+def apply():
+ return {'ret': 'ok'}
+
class PortsWidget (CTK.Container):
def __init__ (self):
CTK.Container.__init__ (self)
@@ -33,12 +53,21 @@
class NetworkWidget (CTK.Container):
def __init__ (self):
CTK.Container.__init__ (self)
- self += CTK.RawHTML ('Network Content')

+ table = CTK.PropsTableAuto (URL_APPLY)
+ table.Add (_('IPv6'), CTK.CheckCfg('server!ipv6', True), NOTE_IPV6)
+ self += CTK.RawHTML ("<h2>%s</h2>" %(_('Support')))
+ self += table

+ table = CTK.PropsTableAuto (URL_APPLY)
+ table.Add (_('Server Tokens'), CTK.ComboCfg('server!server_tokens', PRODUCT_TOKENS), NOTE_TOKENS)
+ self += CTK.RawHTML ("<h2>%s</h2>" %(_('Network behavior')))
+ self += table
+
+
class Render():
def __call__ (self):
- txt = "<h1>%s</h1>" % (_('General Settings'))
+ txt = "<h1>%s</h1>" %(_('General Settings'))

tabs = CTK.Tab()
tabs.Add (_('Network'), NetworkWidget())
@@ -50,5 +79,5 @@

return page.Render()

-
-CTK.publish ('^/general', Render)
+CTK.publish ('^%s'%(URL_BASE), Render)
+CTK.publish ('^%s'%(URL_APPLY), apply, method="POST")

Modified: cherokee/branches/adminctk/admin/server.py
===================================================================
--- cherokee/branches/adminctk/admin/server.py 2010-01-29 16:37:15 UTC (rev 4198)
+++ cherokee/branches/adminctk/admin/server.py 2010-01-29 16:38:12 UTC (rev 4199)
@@ -36,15 +36,20 @@
# Cherokee imports
from configured import *

-# Pages
-import PageIndex
-import PageGeneral

-
-def main():
+def i18n_init():
# Gettext initialization
gettext.install('cherokee')

+ # Register N_
+ import __builtin__
+ __builtin__.__dict__['N_'] = lambda x: x
+
+
+def main():
+ # Translation support
+ i18n_init()
+
# Read the arguments
try:
scgi_port = sys.argv[1]
@@ -89,4 +94,12 @@
CTK.run (unix_socket=scgi_port)

if __name__ == "__main__":
+ # Init the translation system
+ i18n_init()
+
+ # Import the Pages
+ import PageIndex
+ import PageGeneral
+
+ # Run
main()

Modified: cherokee/branches/adminctk/admin-classic/PageGeneral.py
===================================================================
--- cherokee/branches/adminctk/admin-classic/PageGeneral.py 2010-01-29 16:37:15 UTC (rev 4198)
+++ cherokee/branches/adminctk/admin-classic/PageGeneral.py 2010-01-29 16:38:12 UTC (rev 4199)
@@ -5,8 +5,6 @@
from Entry import *
from Form import *

-# For gettext
-N_ = lambda x: x

PRODUCT_TOKENS = [
('', N_('Default')),

Cherokee commits RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.