[Checkins] SVN: grok/trunk/src/grok/ Cosmetics on the file, added white spaces (as recommanded in pep8), for readability.
Souheil CHELFOUH
souheil at chelfouh.com
Wed Jul 7 09:24:10 EDT 2010
Log message for revision 114285:
Cosmetics on the file, added white spaces (as recommanded in pep8), for readability.
Changed:
U grok/trunk/src/grok/directive.py
U grok/trunk/src/grok/index.py
U grok/trunk/src/grok/interfaces.py
U grok/trunk/src/grok/meta.py
U grok/trunk/src/grok/publication.py
U grok/trunk/src/grok/testing.py
-=-
Modified: grok/trunk/src/grok/directive.py
===================================================================
--- grok/trunk/src/grok/directive.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/directive.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -47,6 +47,7 @@
store = martian.ONCE
validate = martian.validateInterfaceOrClass
+
class permissions(martian.Directive):
"""The `grok.permissions()` directive.
@@ -84,6 +85,7 @@
permission_ids.append(value)
return permission_ids
+
class traversable(martian.Directive):
"""The `grok.traversable()` directive.
@@ -111,6 +113,7 @@
name = attr
return (name, attr)
+
class restskin(martian.Directive):
"""The `grok.restskin()` directive.
Modified: grok/trunk/src/grok/index.py
===================================================================
--- grok/trunk/src/grok/index.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/index.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -27,6 +27,7 @@
from grok.interfaces import IIndexDefinition
+
class IndexDefinition(object):
"""The definition of a particular index in a `grok.Indexes` class.
@@ -82,20 +83,23 @@
call = IMethod.providedBy(method)
else:
call = callable(getattr(context, field_name, None))
- context = None # no interface lookup
+ context = None # no interface lookup
catalog[name] = self.index_class(field_name=field_name,
interface=context,
field_callable=call,
*self._args, **self._kw)
+
class Field(IndexDefinition):
"""A `grok.Indexes` index that matches against an entire field."""
index_class = FieldIndex
+
class Text(IndexDefinition):
"""A `grok.Indexes` index supporting full-text searches of a field."""
index_class = TextIndex
+
class Set(IndexDefinition):
"""A `grok.Indexes` index supporting keyword searches of a field."""
index_class = SetIndex
Modified: grok/trunk/src/grok/interfaces.py
===================================================================
--- grok/trunk/src/grok/interfaces.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/interfaces.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -66,7 +66,6 @@
"""
-
class IGrokEvents(interface.Interface):
IObjectCreatedEvent = interface.Attribute("")
@@ -179,6 +178,7 @@
body = interface.Attribute(
"""The text of the request body.""")
+
class IApplication(interface.Interface):
"""Marker-interface for grok application factories.
@@ -186,6 +186,7 @@
provide a list of grokked applications.
"""
+
class IIndexDefinition(interface.Interface):
"""Define an index for grok.Indexes.
"""
@@ -197,20 +198,24 @@
index for interface or class context.
"""
+
class IRESTLayer(IHTTPRequest):
"""REST-specific Request functionality.
Base Interfaces for defining REST-layers.
"""
+
class IRESTSkinType(IInterface):
"""Skin type for REST requests.
"""
+
class IContainer(IContext, IContainerBase):
"""A Grok container.
"""
+
class IGrokSecurityView(interface.Interface):
"""A view treated special by the Grok publisher.
@@ -222,6 +227,7 @@
applied to such views.
"""
+
class IApplicationInitializedEvent(IObjectEvent):
"""A Grok Application has been created with success and is now ready
to be used.
Modified: grok/trunk/src/grok/meta.py
===================================================================
--- grok/trunk/src/grok/meta.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/meta.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -53,6 +53,7 @@
from grokcore.view.meta.views import default_fallback_to_name
+
class MethodPublisher(XMLRPCView, Location):
"""Copied from zope.app.publisher.xmlrpc to get rid of that dependency.
"""
@@ -64,6 +65,7 @@
__parent__ = property(__getParent, __setParent)
+
class XMLRPCGrokker(martian.MethodGrokker):
"""Grokker for methods of a `grok.XMLRPC` subclass.
@@ -89,8 +91,7 @@
# views have a location
method_view = type(
factory.__name__, (factory, MethodPublisher),
- {'__call__': method}
- )
+ {'__call__': method})
adapts = (context, IXMLRPCRequest)
config.action(
@@ -135,8 +136,7 @@
method_view = type(
factory.__name__, (factory,),
- {'__call__': method }
- )
+ {'__call__': method})
adapts = (context, layer)
config.action(
@@ -154,6 +154,7 @@
_restskin_not_used = object()
+
class RestskinInterfaceDirectiveGrokker(martian.InstanceGrokker):
"""Grokker for interfaces providing the `grok.restskin()` directive.
@@ -186,13 +187,13 @@
"required for interfaces that are used as layers and are to "
"be registered as a restskin."
% (interface.__identifier__, interface.__identifier__),
- interface
- )
+ interface)
+
config.action(
discriminator=('restprotocol', restskin),
callable=zope.component.interface.provideInterface,
- args=(restskin, interface, IRESTSkinType)
- )
+ args=(restskin, interface, IRESTSkinType))
+
return True
@@ -221,20 +222,21 @@
# JSON class knows what method to call.
method_view = type(
factory.__name__, (factory,),
- {'__view_name__': method.__name__}
- )
+ {'__view_name__': method.__name__})
+
adapts = (context, layer)
name = method.__name__
+
config.action(
discriminator=('adapter', adapts, interface.Interface, name),
callable=component.provideAdapter,
- args=(method_view, adapts, interface.Interface, name),
- )
+ args=(method_view, adapts, interface.Interface, name))
+
config.action(
discriminator=('protectName', method_view, '__call__'),
callable=make_checker,
- args=(factory, method_view, permission),
- )
+ args=(factory, method_view, permission))
+
return True
@@ -407,4 +409,3 @@
grokcore.site.interfaces.IUtilityInstaller)
setupUtility(site, intids, IIntIds)
return intids
-
Modified: grok/trunk/src/grok/publication.py
===================================================================
--- grok/trunk/src/grok/publication.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/publication.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -40,6 +40,7 @@
from grok.interfaces import IGrokSecurityView
+
class ZopePublicationSansProxy(object):
"""Grok mixin that makes a publisher remove security proxies.
@@ -103,6 +104,7 @@
request, ob)
return removeSecurityProxy(obj), path
+
class GrokBrowserFactory(BrowserFactory):
"""Returns the classes Grok uses for browser requests and publication.
@@ -121,6 +123,7 @@
class GrokXMLRPCPublication(ZopePublicationSansProxy, BaseHTTPPublication):
"""Combines `BaseHTTPPublication` with the Grok sans-proxy mixin."""
+
class GrokXMLRPCFactory(XMLRPCFactory):
"""Returns the classes Grok uses for browser requests and publication.
@@ -163,6 +166,7 @@
raise GrokMethodNotAllowed(orig, request)
return mapply(ob, request.getPositionalArguments(), request)
+
class GrokHTTPFactory(HTTPFactory):
"""Returns the classes Grok uses for HTTP requests and publication.
Modified: grok/trunk/src/grok/testing.py
===================================================================
--- grok/trunk/src/grok/testing.py 2010-07-07 13:14:30 UTC (rev 114284)
+++ grok/trunk/src/grok/testing.py 2010-07-07 13:24:10 UTC (rev 114285)
@@ -19,6 +19,7 @@
# Provide this import here for BBB reasons:
from grokcore.component.testing import grok_component
+
def grok(module_name):
config = ConfigurationMachine()
zcml.do_grok('grokcore.component.meta', config)
@@ -33,6 +34,7 @@
zcml.do_grok(module_name, config)
config.execute_actions()
+
def warn(message, category=None, stacklevel=1):
"""Intended to replace warnings.warn in tests.
More information about the checkins
mailing list