[Checkins]
SVN: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/
Add some files I forgot to add before. Taking a break until the
Paul Carduner
paulcarduner at gmail.com
Mon Apr 21 00:12:27 EDT 2008
Log message for revision 85523:
Add some files I forgot to add before. Taking a break until the
extjs.com site decides to come back.
Changed:
A Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/form-widget.pyt
A Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/pytemplate.py
A Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/text-area-widget.pyt
-=-
Added: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/form-widget.pyt
===================================================================
--- Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/form-widget.pyt (rev 0)
+++ Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/form-widget.pyt 2008-04-21 04:12:25 UTC (rev 85523)
@@ -0,0 +1,16 @@
+from string import Template
+# context is a widget
+r += Template("""
+
+var ${widgetVar} = ${formVar}.add(new Ext.form.TextField({
+ fieldLabel: '${widgetLabel}',
+ value: '${widgetValue}',
+ width: '300px',
+ }));
+
+""").substitute(dict(
+ widgetVar = 'widget%s' % jsSafe(context.id),
+ formVar = 'form%s' % jsSafe(context.form.id),
+ widgetLabel = context.label,
+ widgetValue = escape(context.value),
+ ))
Property changes on: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/form-widget.pyt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/pytemplate.py
===================================================================
--- Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/pytemplate.py (rev 0)
+++ Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/pytemplate.py 2008-04-21 04:12:25 UTC (rev 85523)
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Simple Python Template Engine.
+
+$Id$
+"""
+import os.path, sys
+
+def package_home(gdict):
+ filename = gdict["__file__"]
+ return os.path.dirname(filename)
+
+class PythonTemplateFile(object):
+
+ def __init__(self, filename, _prefix=None):
+ path = self.get_path_from_prefix(_prefix)
+ self.filename = os.path.join(path, filename)
+ if not os.path.isfile(self.filename):
+ raise ValueError("No such file", self.filename)
+
+ def get_path_from_prefix(self, _prefix):
+ if isinstance(_prefix, str):
+ path = _prefix
+ else:
+ if _prefix is None:
+ _prefix = sys._getframe(2).f_globals
+ path = package_home(_prefix)
+ return path
+
+ def __call__(self, context, **kwargs):
+ inFile = open(self.filename, 'rb')
+ scope = {'r':'', 'context':context}
+ scope.update(kwargs)
+ exec inFile in scope
+ return scope['r']
Property changes on: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/pytemplate.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/text-area-widget.pyt
===================================================================
--- Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/text-area-widget.pyt (rev 0)
+++ Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/text-area-widget.pyt 2008-04-21 04:12:25 UTC (rev 85523)
@@ -0,0 +1,16 @@
+from string import Template
+# context is a widget
+r += Template("""
+
+var ${widgetVar} = ${formVar}.add(new Ext.form.TextArea({
+ fieldLabel: '${widgetLabel}',
+ value: '${widgetValue}',
+ width: '300px',
+ }));
+
+""").substitute(dict(
+ widgetVar = 'widget%s' % jsSafe(context.id),
+ formVar = 'form%s' % jsSafe(context.form.id),
+ widgetLabel = context.label,
+ widgetValue = escape(context.value),
+ ))
Property changes on: Sandbox/pcardune/z3c.formextjs/src/z3c/formextjs/browser/text-area-widget.pyt
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Checkins
mailing list