r1272 - in zope-formulator/trunk (10 files)
Andreas Tille
tille at alioth.debian.org
Fri Jul 18 07:38:26 UTC 2008
Date: Friday, July 18, 2008 @ 07:38:25
Author: tille
Revision: 1272
Removed unneeded random upstream files.
Deleted:
zope-formulator/trunk/FieldHelpTopic.py
zope-formulator/trunk/ProductForm.py
zope-formulator/trunk/TODO.txt
zope-formulator/trunk/__init__.py
zope-formulator/trunk/configure.zcml
zope-formulator/trunk/dtml/
zope-formulator/trunk/helpers.py
zope-formulator/trunk/homepage.html
zope-formulator/trunk/monkey.py
zope-formulator/trunk/www/
Deleted: zope-formulator/trunk/FieldHelpTopic.py
===================================================================
--- zope-formulator/trunk/FieldHelpTopic.py 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/FieldHelpTopic.py 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,35 +0,0 @@
-from Globals import DTMLFile
-from HelpSys import HelpTopic
-
-class FieldHelpTopic(HelpTopic.HelpTopic):
- """A special help topic for fields.
- """
- meta_type = 'Help Topic'
-
- def __init__(self, id, title, field_class,
- permissions=None, categories=None):
- self.id = id
- self.title = title
- self.field_class = field_class
-
- if permissions is not None:
- self.permissions = permissions
- if categories is not None:
- self.categories = categories
-
- index_html = DTMLFile('dtml/FieldHelpTopic', globals())
-
- def SearchableText(self):
- """Full text of the Help Topic, for indexing purposes."""
- return "" # return self.index_html()
-
- def get_groups(self):
- """Get form groups of this field.
- """
- return self.field_class.form.get_groups()
-
- def get_fields_in_group(self, group):
- """Get the fields in the group.
- """
- return self.field_class.form.get_fields_in_group(group)
-
Deleted: zope-formulator/trunk/ProductForm.py
===================================================================
--- zope-formulator/trunk/ProductForm.py 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/ProductForm.py 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,138 +0,0 @@
-"""
-ProductForm.py
-
-This file is an adaptation from part of Plone's FormTool.py tool.
-It provides a wrapping around Formulator.BasicForm, allowing it
-to be created inside a product but used outside it.
-"""
-
-import string
-
-from AccessControl import ClassSecurityInfo
-
-from Globals import InitializeClass
-import FormValidationError, BasicForm
-import StandardFields
-
-class ProductForm(BasicForm):
- """Wraps Formulator.BasicForm and provides some convenience methods that
- make BasicForms easier to work with from external methods."""
- security = ClassSecurityInfo()
- security.declareObjectPublic()
-
- security.declareProtected('View', 'get_field')
- def get_field(self, id):
- """Get a field of a certain id, wrapping in context of self
- """
- return self.fields[id].__of__(self)
-
- security.declarePublic('addField')
- def addField(self, field_id, fieldType, group=None, **kwargs):
- """
- Adds a Formulator Field to the wrapped BasicForm.
-
- fieldType: An abbreviation for the Field type.
- 'String' generates a StringField, 'Int' generates an IntField, etc.
- Uses a StringField if no suitable Field type is found.
- field_id: Name of the variable in question. Note that Formulator adds
- 'field_' to variable names, so you will need to refer to the variable
- foo as field_foo in form page templates.
- group: Formulator group for the field.
-
- Additional arguments: addField passes all other arguments on to the
- new Field object. In addition, it allows you to modify the
- Field's error messages by passing in arguments of the form
- name_of_message = 'New error message'
-
- See Formulator.StandardFields for details.
- """
-
- if fieldType[-5:]!='Field':
- fieldType = fieldType+'Field'
-
- formulatorFieldClass = None
-
- if hasattr(StandardFields, fieldType):
- formulatorFieldClass = getattr(StandardFields, fieldType)
- else:
- formulatorFieldClass = getattr(StandardFields, 'StringField')
-
- # pass a title parameter to the Field
- kwargs['title'] = field_id
-
- fieldObject = apply(formulatorFieldClass, (field_id, ), kwargs)
-
- # alter Field error messages
- # Note: This messes with Formulator innards and may break in the future.
- # Unfortunately, Formulator doesn't do this already in Field.__init__
- # and there isn't a Python-oriented method for altering message values
- # so at present it's the only option.
- for arg in kwargs.keys():
- if fieldObject.message_values.has_key(arg):
- fieldObject.message_values[arg] = kwargs[arg]
-
- # Add the new Field to the wrapped BasicForm object
- BasicForm.add_field(self, fieldObject, group)
-
-
- security.declarePublic('validate')
- def validate(self, REQUEST, errors=None):
- """
- Executes the validator for each field in the wrapped BasicForm.add_field
- Returns the results in a dictionary.
- """
-
- if errors is None:
- errors = REQUEST.get('errors', {})
-
- # This is a bit of a hack to make some of Formulator's quirks
- # transparent to developers. Formulator expects form fields to be
- # prefixed by 'field_' in the request. To remove this restriction,
- # we mangle the REQUEST, renaming keys from key to 'field_' + key
- # before handing off to Formulator's validators. We will undo the
- # mangling afterwards.
- for field in self.get_fields():
- key = field.id
- value = REQUEST.get(key)
- if value:
- # get rid of the old key
- try:
- del REQUEST[key]
- except:
- pass
- # move the old value to 'field_' + key
- # if there is already a value at 'field_' + key,
- # move it to 'field_field_' + key, and repeat
- # to prevent key collisions
- newKey = 'field_' + key
- newValue = REQUEST.get(newKey)
- while newValue:
- REQUEST[newKey] = value
- newKey = 'field_' + newKey
- value = newValue
- newValue = REQUEST.get(newKey)
- REQUEST[newKey] = value
-
- try:
- result=self.validate_all(REQUEST)
- except FormValidationError, e:
- for error in e.errors:
- errors[error.field.get_value('title')]=error.error_text
-
- # unmangle the REQUEST
- for field in self.get_fields():
- key = field.id
- value = 1
- while value:
- key = 'field_' + key
- value = REQUEST.get(key)
- if value:
- REQUEST[key[6:]] = value
- try:
- del REQUEST[key]
- except:
- pass
-
- return errors
-
-InitializeClass(ProductForm)
Deleted: zope-formulator/trunk/TODO.txt
===================================================================
--- zope-formulator/trunk/TODO.txt 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/TODO.txt 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,18 +0,0 @@
-Formulator TODO
-
- - When using a BasicForm a field cannot get to the form's
- get_form_encoding method (where the ZMIForm uses acquisistion
- to achieve this).
-
- - Make composite fields work well as hidden fields.
-
- - Add combobox field
-
- - Add various button fields
-
- - Investigate duration and time only field.
-
- - HTML filtering field?
-
- - Add more unit tests.
-
Deleted: zope-formulator/trunk/__init__.py
===================================================================
--- zope-formulator/trunk/__init__.py 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/__init__.py 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,93 +0,0 @@
-from Globals import DTMLFile
-import Form
-import StandardFields, HelperFields
-from FieldRegistry import FieldRegistry
-import Errors
-from AccessControl import allow_module
-
-try:
- import Products.FileSystemSite
-except ImportError:
- try:
- import Products.CMFCore
- except ImportError:
- pass
- else:
- import FSForm
-else:
- import FSForm
-
-# Allow Errors to be imported TTW
-allow_module('Products.Formulator.Errors')
-
-def initialize(context):
- """Initialize the Formulator product.
- """
- # register field classes
- FieldRegistry.registerField(StandardFields.StringField,
- 'www/StringField.gif')
- FieldRegistry.registerField(StandardFields.CheckBoxField,
- 'www/CheckBoxField.gif')
- FieldRegistry.registerField(StandardFields.IntegerField,
- 'www/IntegerField.gif')
- FieldRegistry.registerField(StandardFields.TextAreaField,
- 'www/TextAreaField.gif')
- FieldRegistry.registerField(StandardFields.RawTextAreaField,
- 'www/TextAreaField.gif')
- FieldRegistry.registerField(StandardFields.LinesField,
- 'www/LinesField.gif')
- FieldRegistry.registerField(StandardFields.ListField,
- 'www/ListField.gif')
- FieldRegistry.registerField(StandardFields.MultiListField,
- 'www/MultiListField.gif')
- FieldRegistry.registerField(StandardFields.RadioField,
- 'www/RadioField.gif')
- FieldRegistry.registerField(StandardFields.MultiCheckBoxField,
- 'www/MultiCheckBoxField.gif')
- FieldRegistry.registerField(StandardFields.PasswordField,
- 'www/PasswordField.gif')
- FieldRegistry.registerField(StandardFields.EmailField,
- 'www/EmailField.gif')
- FieldRegistry.registerField(StandardFields.PatternField,
- 'www/PatternField.gif')
- FieldRegistry.registerField(StandardFields.FloatField,
- 'www/FloatField.gif')
- FieldRegistry.registerField(StandardFields.DateTimeField,
- 'www/DateTimeField.gif')
- FieldRegistry.registerField(StandardFields.FileField,
- 'www/FileField.gif')
- FieldRegistry.registerField(StandardFields.LinkField,
- 'www/LinkField.gif')
- FieldRegistry.registerField(StandardFields.LabelField,
- 'www/LabelField.gif')
-
- # some helper fields
- FieldRegistry.registerField(HelperFields.ListTextAreaField)
- FieldRegistry.registerField(HelperFields.MethodField)
- FieldRegistry.registerField(HelperFields.TALESField)
-
- # obsolete field (same as helper; useable but not addable)
- FieldRegistry.registerField(StandardFields.RangedIntegerField,
- 'www/RangedIntegerField.gif')
-
- # register the form itself
- context.registerClass(
- Form.ZMIForm,
- constructors = (Form.manage_addForm,
- Form.manage_add),
- icon = 'www/Form.gif')
-
- # make Dummy Fields into real fields
- FieldRegistry.initializeFields()
-
- # do initialization of Form class to make fields addable
- Form.initializeForm(FieldRegistry)
-
- # register help for the product
- context.registerHelp()
- # register field help for all fields
- FieldRegistry.registerFieldHelp(context)
-
-# monkey patches
-import monkey
-monkey.patch_all()
Deleted: zope-formulator/trunk/configure.zcml
===================================================================
--- zope-formulator/trunk/configure.zcml 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/configure.zcml 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,9 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:i18n="http://namespaces.zope.org/i18n"
- >
-
- <!-- i18n -->
- <i18n:registerTranslations directory="i18n" />
-
-</configure>
Deleted: zope-formulator/trunk/helpers.py
===================================================================
--- zope-formulator/trunk/helpers.py 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/helpers.py 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,30 +0,0 @@
-from Acquisition import aq_base
-
-seq_types = [type([]), type(())]
-
-def is_sequence(v):
- return type(aq_base(v)) in seq_types
-
-def convert_unicode(struct):
- """ convert all strings of a possibly deeply nested structure
- of lists from utf-8 to unicode
- in case of a dictionary only converts the values, not the keys
- """
-
- if type(struct) == type(''):
- return unicode(struct, 'utf-8')
-
- if type(struct) == type([]):
- return map( convert_unicode, struct )
-
- if type(struct) == type(()):
- return tuple( map( convert_unicode, struct ) )
-
- if type(struct) == type({}):
- new_dict = {}
- for k,v in struct.items():
- new_dict[k] = convert_unicode(v)
- return new_dict
-
- # if it something else, leave it untouched
- return struct
Deleted: zope-formulator/trunk/homepage.html
===================================================================
--- zope-formulator/trunk/homepage.html 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/homepage.html 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,49 +0,0 @@
-Formulator is an extensible framework that eases the creation and
-validation of web forms.
-
-Important links:
-
- * Subscribe to the <a
- href="http://lists.sourceforge.net/lists/listinfo/formulator-general">Formulator
- mailing list</a>, for general discussions and questions on
- Formulator usage.
-
- * If you're interested in the further development of Formulator,
- subscribe to the <a
- href="http://lists.infrae.com/mailman/listinfo/formulator-dev">Formulator-dev
- list</a>
-
- * <a href="http://sourceforge.net/projects/formulator/">Formulator
- SourceForge project page</a>
-
- * <a href="http://cvs.infrae.com/Formulator/">Formulator CVS web</a>
-
- * Check out Formulator from CVS anonymously like this::
-
- cvs -z3 -d:pserver:anonymous at cvs.infrae.com:/cvs/infrae co Formulator
-
-Important hint:
-
- *Don't ever* use *field_<fieldname>*; anything
- prefixed with *field_* in REQUEST is a Formulator
- implementation detail. Instead, don't forget to validate the form,
- for instance using *validate_all_to_request()*. See the
- Formulator API help and Howto for more information. Forgetting to
- validate the form is the most frequently made Formulator mistake
- that I've encountered.
-
-Documentation:
-
- * <a href="formulator_howto">Formulator HOWTO</a>
-
- * <a href="http://www.jquade.de./formulator-slides-de">Very nice slides about Formulator by Jens Quade (in German)</a>
-
- * <a href="http://www.zopelabs.com/cookbook/1032909599">A Zopelabs recipe by Scott Burton on using Formulator with Zope Page Templates</a>
-
- * <a href="http://www.zope.org/Members/beno/HowTo/HowTo/Formulator_With_ZPT">Howto on using Formulator with Zope Page Templates by Beno</a>
-
-Some less important links:
-
- * <a href="http://freshmeat.net/projects/formulator/">Formulator on Freshmeat</a>
-
- * <a href="http://www.advogato.org/proj/Formulator/">Formulator project page on Advogato</a>
Deleted: zope-formulator/trunk/monkey.py
===================================================================
--- zope-formulator/trunk/monkey.py 2008-07-18 07:36:47 UTC (rev 1271)
+++ zope-formulator/trunk/monkey.py 2008-07-18 07:38:25 UTC (rev 1272)
@@ -1,11 +0,0 @@
-from AccessControl import allow_class
-
-def monkey_zope3_message_id():
- from zope.i18nmessageid.messageid import MessageID
-
- # open it up for Zope 2...
- allow_class(MessageID)
-
-def patch_all():
- monkey_zope3_message_id()
-
More information about the pkg-zope-commits
mailing list