[Checkins] SVN: grok/trunk/src/grok/components.py Coding style.
Christian Theune
ct at gocept.com
Fri Jul 13 02:19:06 EDT 2007
Log message for revision 77792:
Coding style.
Changed:
U grok/trunk/src/grok/components.py
-=-
Modified: grok/trunk/src/grok/components.py
===================================================================
--- grok/trunk/src/grok/components.py 2007-07-13 06:17:32 UTC (rev 77791)
+++ grok/trunk/src/grok/components.py 2007-07-13 06:19:05 UTC (rev 77792)
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006â2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -11,8 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Grok components
-"""
+"""Grok components"""
import os
import persistent
@@ -55,6 +54,7 @@
from grok import interfaces, formlib
from grok.util import url
+
class Model(Contained, persistent.Persistent):
# XXX Inheritance order is important here. If we reverse this,
# then containers can't be models anymore because no unambigous MRO
@@ -74,6 +74,7 @@
"""A top-level application object."""
interface.implements(interfaces.IApplication)
+
class Adapter(object):
def __init__(self, context):
@@ -169,6 +170,7 @@
def update(self):
pass
+
class GrokViewAbsoluteURL(AbsoluteURL):
def _getContextName(self, context):
@@ -180,6 +182,7 @@
class XMLRPC(object):
pass
+
class JSON(BrowserPage):
def __call__(self):
@@ -188,6 +191,7 @@
method_result = mapply(method, (), self.request)
return simplejson.dumps(method_result)
+
class GrokPageTemplate(object):
def __repr__(self):
@@ -316,6 +320,7 @@
# try to get the item from the container
return self.context.get(name)
+
default_form_template = PageTemplateFile(os.path.join(
'templates', 'default_edit_form.pt'))
default_form_template.__grok_name__ = 'default_edit_form'
@@ -323,6 +328,7 @@
'templates', 'default_display_form.pt'))
default_display_template.__grok_name__ = 'default_display_form'
+
class GrokForm(object):
"""Mix-in to console zope.formlib's forms with grok.View and to
add some more useful methods.
@@ -375,6 +381,7 @@
self.update_form()
return self.render()
+
class Form(GrokForm, form.FormBase, View):
# We're only reusing the form implementation from zope.formlib, we
# explicitly don't want to inherit the interface semantics (mostly
@@ -394,9 +401,11 @@
"'applyData' instead.", DeprecationWarning, 2)
return bool(self.applyData(obj, **data))
+
class AddForm(Form):
pass
+
class EditForm(GrokForm, form.EditFormBase, View):
# We're only reusing the form implementation from zope.formlib, we
# explicitly don't want to inherit the interface semantics (mostly
@@ -433,6 +442,7 @@
else:
self.status = 'No changes'
+
class DisplayForm(GrokForm, form.DisplayFormBase, View):
# We're only reusing the form implementation from zope.formlib, we
# explicitly don't want to inherit the interface semantics (mostly
@@ -441,6 +451,7 @@
template = default_display_template
+
class IndexesClass(object):
def __init__(self, name, bases=(), attrs=None):
if attrs is None:
@@ -461,5 +472,5 @@
# __grok_module__ is needed to make defined_locally() return True for
# inline templates
self.__grok_module__ = util.caller_module()
-
+
Indexes = IndexesClass('Indexes')
More information about the Checkins
mailing list