[Zope3-checkins] CVS: Zope3/src/zope/app/schemagen - schemaspec.py:1.1.2.3 typereg.py:1.1.2.3
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:45 -0500
Update of /cvs-repository/Zope3/src/zope/app/schemagen
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/app/schemagen
Modified Files:
Tag: NameGeddon-branch
schemaspec.py typereg.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/app/schemagen/schemaspec.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/schemagen/schemaspec.py:1.1.2.2 Tue Dec 24 07:51:15 2002
+++ Zope3/src/zope/app/schemagen/schemaspec.py Tue Dec 24 21:20:44 2002
@@ -41,7 +41,7 @@
def _appendHistory(self, action):
self._history.append(action)
self._current_version += 1
-
+
def addField(self, name, field):
if name in self._fields:
raise KeyError, "Field %s already exists." % name
@@ -52,7 +52,7 @@
self._appendHistory(action)
self._p_changed = 1
return action
-
+
def removeField(self, name):
if name not in self._fields:
raise KeyError, "Field %s does not exist." % name
@@ -77,7 +77,7 @@
self._appendHistory(action)
self._p_changed = 1
return action
-
+
def insertField(self, name, field, position):
if name in self._fields:
raise KeyError, "Field %s already exists." % name
@@ -90,7 +90,7 @@
self._appendHistory(action)
self._p_changed = 1
return action
-
+
def moveField(self, name, position):
if name not in self._fields:
raise KeyError, "Field %s does not exist." % name
@@ -102,7 +102,7 @@
self._appendHistory(action)
self._p_changed = 1
return action
-
+
def getFieldsInOrder(self):
"""Get all fields in order as (name, field) tuples.
"""
@@ -111,7 +111,7 @@
def getCurrentVersion(self):
return self._current_version
-
+
def getHistory(self):
return self._history
@@ -132,12 +132,12 @@
lines.append(' %s.%s.update(dict, state%s)' % (
_helper_module, type(item).__name__, args))
count += 1
-
+
method_text_list = [' def __setstate__(self, state):']
# indent by 8: '12345678%s'
method_text_list += [' %s' % line for line in lines]
return '\n'.join(method_text_list) + '\n'
-
+
def generateModuleSource(self):
if not self._history:
# don't generate any __setstate__ when there is no history
@@ -176,7 +176,7 @@
except KeyError:
pass
update = staticmethod(update)
-
+
class RemoveField:
def __init__(self, name):
self.name = name
@@ -187,7 +187,7 @@
def update(dict, state, name):
del dict[name]
update = staticmethod(update)
-
+
class RenameField:
def __init__(self, original, target):
self.original = original
@@ -200,7 +200,7 @@
del dict[original]
dict[target] = state[original]
update = staticmethod(update)
-
+
class InsertField:
def __init__(self, name, position):
self.name = name
=== Zope3/src/zope/app/schemagen/typereg.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/schemagen/typereg.py:1.1.2.2 Tue Dec 24 07:51:15 2002
+++ Zope3/src/zope/app/schemagen/typereg.py Tue Dec 24 21:20:44 2002
@@ -27,7 +27,7 @@
def __init__(self, default):
self._registry = {}
self._default = default
-
+
#def registerType(self, type, factory):
# self._registry[type] = factory
@@ -41,7 +41,7 @@
def register(self, representation):
for type in representation.getTypes():
self._registry[type] = representation
-
+
class DefaultTypeRepresentation:
__implements__ = ITypeRepresentation
@@ -53,7 +53,7 @@
self.importList = [(import_module, import_name)]
else:
self.importList = []
-
+
def getTypes():
return ()
getTypes = staticmethod(getTypes)
@@ -95,7 +95,7 @@
lambda interface: names.update(getFields(interface)))
# getFields only returns data for Fields in the interface.
# Otherwise, it returns an empty dict.
-
+
# At this point, name_property is a dict with keys of the
# property names, and values of property objects.
# XXX I don't know if we're following proper MRO though.
@@ -122,12 +122,12 @@
representation = typeRegistry.represent(value)
arguments.append((name, representation.text))
for import_spec in representation.importList:
- self.importList.append(import_spec)
+ self.importList.append(import_spec)
arguments_text = ', '.join(["%s=%s" % item for item in arguments])
self.text = "%s(%s)" % (type(field).__name__, arguments_text)
-
+
def getTypes():
return ()
getTypes = staticmethod(getTypes)
@@ -141,9 +141,9 @@
else:
module_name = field_class.__module__
return [(module_name, field_class.__name__)]
-
+
_getImportList = staticmethod(_getImportList)
-
+
typeRegistry = TypeRepresentationRegistry(DefaultTypeRepresentation)
typeRegistry.register(DatetimeRepresentation)