[Cherokee-commits] [4083] CTK/trunk/CTK: Sync

SVN at cherokee-project.com SVN at cherokee-project.com
Mon Jan 4 12:47:38 CET 2010


Revision: 4083
          http://svn.cherokee-project.com/changeset/4083
Author:   alo
Date:     2010-01-04 12:47:37 +0100 (Mon, 04 Jan 2010)

Log Message:
-----------
Sync

Modified Paths:
--------------
    CTK/trunk/CTK/HTTP.py
    CTK/trunk/CTK/PropsTable.py

Modified: CTK/trunk/CTK/HTTP.py
===================================================================
--- CTK/trunk/CTK/HTTP.py	2010-01-04 08:52:25 UTC (rev 4082)
+++ CTK/trunk/CTK/HTTP.py	2010-01-04 11:47:37 UTC (rev 4083)
@@ -96,12 +96,13 @@
 
 
 class HTTP_Error (HTTP_Response):
-    def __init__ (self, error=500):
+    def __init__ (self, error=500, desc=None):
         HTTP_Response.__init__ (self, error)
-
         self.body  = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\r\n'
         self.body += "<html><head><title>Error %d: %s</title></head>\n" %(error, HTTP_Response.DESC[error])
         self.body += '<body><h1>Error %d: %s</h1></body>\n' %(error, HTTP_Response.DESC[error])
+        if desc:
+            self.body += "<p>%s</p>"%(desc)
         self.body += "</html>"
 
 

Modified: CTK/trunk/CTK/PropsTable.py
===================================================================
--- CTK/trunk/CTK/PropsTable.py	2010-01-04 08:52:25 UTC (rev 4082)
+++ CTK/trunk/CTK/PropsTable.py	2010-01-04 11:47:37 UTC (rev 4083)
@@ -23,6 +23,8 @@
 from Table import Table
 from RawHTML import RawHTML
 from Submitter import Submitter
+from Container import Container
+from HiddenField import HiddenField
 
 class PropsTable (Table):
     def __init__ (self, **kwargs):
@@ -44,10 +46,23 @@
 class PropsTableAuto (PropsTable):
     def __init__ (self, url, **kwargs):
         PropsTable.__init__ (self, **kwargs)
-        self._url = url
+        self._url      = url
+        self.constants = {}
 
     def Add (self, title, widget, comment):
         submit = Submitter (self._url)
-        submit += widget
 
+        if self.constants:
+            box = Container()
+            box += widget
+            for key in self.constants:
+                box += HiddenField ({'name': key, 'value': self.constants[key]})
+
+            submit += box
+        else:
+            submit += widget
+
         return PropsTable.Add (self, title, submit, comment)
+
+    def AddConstant (self, key, val):
+        self.constants[key] = val

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.octality.com/pipermail/cherokee-commits/attachments/20100104/f4843a55/attachment.htm 


More information about the Cherokee-commits mailing list