From f3896a755ac9672fa202f5a7c2cd3069d8ae7357 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 29 Jan 2024 14:01:02 +0100 Subject: [PATCH 1/3] Update to `grok 5.0`. This requires us to drop support for: - `grokcore.xmlrpc` - `grokcore.rest` - `grokcore.json` --- dependabot/requirements.txt | 3 - docs/changes.rst | 12 ++ docs/design/views.py | 11 -- docs/reference/components.rst | 202 ---------------------------------- docs/reference/decorators.rst | 7 +- docs/tutorial_outline.txt | 15 +-- documentation.cfg | 2 - grok-sources.cfg | 2 - grok-versions.cfg | 5 +- grok.cfg | 2 - 10 files changed, 21 insertions(+), 240 deletions(-) diff --git a/dependabot/requirements.txt b/dependabot/requirements.txt index 8b6d750..9b017a3 100644 --- a/dependabot/requirements.txt +++ b/dependabot/requirements.txt @@ -8,7 +8,6 @@ grokcore.component==4.1 grokcore.content==4.1 grokcore.error==4.0 grokcore.formlib==4.0 -grokcore.json==4.1 grokcore.layout==4.0 grokcore.message==4.0 grokcore.security==4.0 @@ -17,7 +16,6 @@ grokcore.startup==4.0 grokcore.traverser==4.0 grokcore.view==4.0 grokcore.viewlet==4.0 -grokcore.xmlrpc==4.1 grokui.admin==1.0 grokui.base==0.8.2 ipython==8.20.0 @@ -41,7 +39,6 @@ collective.recipe.omelette==1.1.0 collective.recipe.template==2.2 decorator==5.1.1 gnureadline==8.1.2 -grokcore.rest==4.1 ipython-genutils==0.2.0 Paste==3.7.1 pexpect==4.9.0 diff --git a/docs/changes.rst b/docs/changes.rst index 1eb1eac..3d5e6de 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -1,6 +1,18 @@ .. note:: The buildout versions file for all current versions can be found at https://zopefoundation.github.io/groktoolkit/ +4.0 (unreleased) +---------------- + +- Update to ``grok 5.0``. This requires us to drop support for: + + - ``grokcore.xmlrpc`` + + - ``grokcore.rest`` + + - ``grokcore.json`` + + 3.0 (2023-12-20) ---------------- diff --git a/docs/design/views.py b/docs/design/views.py index 33d00cd..fa2016a 100644 --- a/docs/design/views.py +++ b/docs/design/views.py @@ -79,14 +79,3 @@ def whatever(self, **data): XXX render actions """) - - -class CalculatorXMLRPC(grok.XMLRPC): - - @grok.require('zope.Public') # this is actually the default - def sum(self, operand, operator, operand2): - return ... - - @grok.require('something.else') - def whatever(self): - return ... diff --git a/docs/reference/components.rst b/docs/reference/components.rst index 4df9847..8bd6793 100644 --- a/docs/reference/components.rst +++ b/docs/reference/components.rst @@ -987,208 +987,6 @@ main content area and a footer. This method renders the content provided by this Viewlet. - -:class:`grok.JSON` -================== - -Specialized View that returns data in JSON format. - -Python data returned is automatically converted into JSON format using -the simplejson library. Every method name in a grok.JSON component is -registered as the name of a JSON View. The exceptions are names that -begin with an _ or special names such as __call__. The grok.require -decorator can be used to protect methods with a permission. - -.. autoclass:: grok.JSON - - .. attribute:: context - - Object that the JSON handler presents. - - .. attribute:: request - - Request that JSON handler was looked up with. - - .. autoattribute:: response - - The response sent back to the client. - - .. attribute:: body - - The text of the request body. - - .. automethod:: redirect - - Redirect to `url`. - - The headers of the :attr:`response` are modified so that the - calling browser gets a redirect status code. Please note, that - this method returns before actually sending the response to - the browser. - - `url` is a string that can contain anything that makes sense - to a browser. Also relative URIs are allowed. - - `status` is a number representing the HTTP status code sent - back. If not given or ``None``, ``302`` or ``303`` will be - sent, depending on the HTTP protocol version in use (HTTP/1.0 - or HTTP/1.1). - - `trusted` is a boolean telling whether we're allowed to - redirect to 'external' hosts. Normally redirects to other - hosts than the one the request was sent to are forbidden and - will raise a :exc:`ValueError`. - - .. automethod:: url - - .. automethod:: publishTraverse - - Lookup a name and return an object with `self.context` as its parent. - The method can use the request to determine the correct object. - - The `request` argument is the publisher request object. The - `name` argument is the name that is to be looked up. It must - be an ASCII string or Unicode object. - - If a lookup is not possible, raise a :exc:`NotFound` error. - - .. automethod:: browserDefault - - Returns an object and a sequence of names. - - The publisher calls this method at the end of each traversal path. - If the sequence of names is not empty, then a traversal step is made - for each name. After the publisher gets to the end of the sequence, - it will call browserDefault on the last traversed object. - - The default behaviour in Grok is to return `self.context` for - the object and ``'index'`` for the default view name. - - Note that if additional traversal steps are indicated (via a - nonempty sequence of names), then the publisher will try to adjust - the base href. - - -**Example 1: Create a public and a protected JSON view.** - -.. code-block:: python - - class MammothJSON(grok.JSON): - """ - Returns JSON from URLs in the form of: - - http://localhost/stomp - http://localhost/dance - """ - - grok.context(zope.interface.Interface) - - def stomp(self): - return {'Manfred stomped.': ''} - - @grok.require('zope.ManageContent') - def dance(self): - return {'Manfred does not like to dance.': ''} - - -:class:`grok.REST` -================== - -Specialized View for making web services that conform to the REST style. -These Views can define methods named GET, PUT, POST and DELETE, which will -be invoked based on the Request type. - -.. autoclass:: grok.REST - - .. attribute:: context - - Object that the REST handler presents. - - .. attribute:: request - - Request that REST handler was looked up with. - - .. autoattribute:: response - - The response sent back to the client. - - .. autoattribute:: body - - The text of the request body. - - .. automethod:: url - - .. automethod:: redirect - - Redirect to `url`. - - The headers of the :attr:`response` are modified so that the - calling browser gets a redirect status code. Please note, that - this method returns before actually sending the response to - the browser. - - `url` is a string that can contain anything that makes sense - to a browser. Also relative URIs are allowed. - - `status` is a number representing the HTTP status code sent - back. If not given or ``None``, ``302`` or ``303`` will be - sent, depending on the HTTP protocol version in use (HTTP/1.0 - or HTTP/1.1). - - `trusted` is a boolean telling whether we're allowed to - redirect to 'external' hosts. Normally redirects to other - hosts than the one the request was sent to are forbidden and - will raise a :exc:`ValueError`. - - -:class:`grok.XMLRPC` -==================== - -Specialized View that responds to XML-RPC. - -.. autoclass:: grok.XMLRPC - - .. attribute:: context - - Object that the REST handler presents. - - .. attribute:: request - - Request that REST handler was looked up with. - - .. autoattribute:: grok.XMLRPC.response - - The response sent back to the client. - - .. autoattribute:: grok.XMLRPC.body - - The text of the request body. - - .. automethod:: grok.XMLRPC.url - - .. automethod:: grok.XMLRPC.redirect - - -**Example 1: Create a public and a protected XML-RPC view.** - -The grok.require decorator can be used to protect methods with a permission. - -.. code-block:: python - - import grok - import zope.interface - - class MammothRPC(grok.XMLRPC): - grok.context(zope.interface.Interface) - - def stomp(self): - return 'Manfred stomped.' - - @grok.require('zope.ManageContent') - def dance(self): - return 'Manfred doesn\'t like to dance.' - - :class:`grok.Traverser` ======================= diff --git a/docs/reference/decorators.rst b/docs/reference/decorators.rst index bf3b560..e76c469 100644 --- a/docs/reference/decorators.rst +++ b/docs/reference/decorators.rst @@ -33,8 +33,7 @@ functionality. .. function:: require(name_or_class) - The decorated method will be protected by the permission. Used in - web service views such as REST or XML-RPC. + The decorated method will be protected by the permission. :func:`grok.adapter/grok.implementer` -- declare an adapter factory @@ -42,12 +41,12 @@ functionality. These decorators are always used in tandem to declare an adapter factory. -.. function:: grok.adapter(*classes_or_interfaces) +.. function:: grok.adapter(*classes_or_interfaces) Describes that a function adapts an object or a combination of objects. -.. function:: grok.implementer(interface) +.. function:: grok.implementer(interface) Describes that a function that's used as an adapter implements an interface or a number of interfaces. diff --git a/docs/tutorial_outline.txt b/docs/tutorial_outline.txt index 829accc..c1e9146 100644 --- a/docs/tutorial_outline.txt +++ b/docs/tutorial_outline.txt @@ -68,22 +68,22 @@ Models Once we know how to show things, we need to go into what we're actually showing: the model. This involves view/model separation, dealing with the ZODB and persistence, and constructing applications -from models and containers. +from models and containers. Note that we also include some more advanced view use cases which only tend to become relevant with more complicated applications (such as redirection). * A view for a model - + * Storing data - + * Redirection * Showing the value in the form * The rules of persistence - + * Containers Some notes: @@ -134,7 +134,7 @@ widget some dynamic behavior. XXX we need to make it easy to make widgets in Grok. -XXX this needs work on the Grok end to at least expose JSON, and perhaps +XXX this needs work on the Grok end, and perhaps we need to ship with a 'recommended' Javascript library. Security @@ -196,11 +196,6 @@ and functional test with doctests. XXX We probably need to do some development work on a test grokker. -XMLRPC ------- - -Show how to do XMLRPC with Grok. - Extending grok -------------- diff --git a/documentation.cfg b/documentation.cfg index cbc8cc4..6d11700 100644 --- a/documentation.cfg +++ b/documentation.cfg @@ -13,14 +13,12 @@ eggs = grokcore.component grokcore.content grokcore.formlib - grokcore.json grokcore.message grokcore.security grokcore.site grokcore.traverser grokcore.view grokcore.viewlet - grokcore.xmlrpc martian py sphinx diff --git a/grok-sources.cfg b/grok-sources.cfg index 7054210..4b8095b 100644 --- a/grok-sources.cfg +++ b/grok-sources.cfg @@ -11,7 +11,6 @@ grokcore.component = git ${buildout:github}/grokcore.component pushurl=${buildou grokcore.content = git ${buildout:github}/grokcore.content pushurl=${buildout:github_push}/grokcore.content grokcore.error = git ${buildout:github}/grokcore.error pushurl=${buildout:github_push}/grokcore.error grokcore.formlib = git ${buildout:github}/grokcore.formlib pushurl=${buildout:github_push}/grokcore.formlib -grokcore.json = git ${buildout:github}/grokcore.json pushurl=${buildout:github_push}/grokcore.json grokcore.layout = git ${buildout:github}/grokcore.layout pushurl=${buildout:github_push}/grokcore.layout grokcore.message = git ${buildout:github}/grokcore.message pushurl=${buildout:github_push}/grokcore.message grokcore.security = git ${buildout:github}/grokcore.security pushurl=${buildout:github_push}/grokcore.security @@ -20,7 +19,6 @@ grokcore.startup = git ${buildout:github}/grokcore.startup pushurl=${buildout:gi grokcore.traverser = git ${buildout:github}/grokcore.traverser pushurl=${buildout:github_push}/grokcore.traverser grokcore.view = git ${buildout:github}/grokcore.view pushurl=${buildout:github_push}/grokcore.view grokcore.viewlet = git ${buildout:github}/grokcore.viewlet pushurl=${buildout:github_push}/grokcore.viewlet -grokcore.xmlrpc = git ${buildout:github}/grokcore.xmlrpc pushurl=${buildout:github_push}/grokcore.xmlrpc martian = git ${buildout:github}/martian pushurl=${buildout:github_push}/martian z3c.evalexception = git ${buildout:github}/z3c.evalexception pushurl=${buildout:github_push}/z3c.evalexception z3c.flashmessage = git ${buildout:github}/z3c.flashmessage pushurl=${buildout:github_push}/z3c.flashmessage diff --git a/grok-versions.cfg b/grok-versions.cfg index b3687e7..7dd1780 100644 --- a/grok-versions.cfg +++ b/grok-versions.cfg @@ -2,7 +2,7 @@ # GROK Chameleon = 4.5.0 fanstatic = 1.4 -grok = 4.0 +grok = 5.0 grokcore.annotation = 4.0 grokcore.catalog = 4.0 grokcore.chameleon = 4.0 @@ -10,7 +10,6 @@ grokcore.component = 4.1 grokcore.content = 4.1 grokcore.error = 4.0 grokcore.formlib = 4.0 -grokcore.json = 4.1 grokcore.layout = 4.0 grokcore.message = 4.0 grokcore.security = 4.0 @@ -19,7 +18,6 @@ grokcore.startup = 4.0 grokcore.traverser = 4.0 grokcore.view = 4.0 grokcore.viewlet = 4.0 -grokcore.xmlrpc = 4.1 grokui.admin = 1.0 grokui.base = 0.8.2 ipython = 8.20.0 @@ -45,7 +43,6 @@ collective.recipe.omelette = 1.1.0 collective.recipe.template = 2.2 decorator = 5.1.1 gnureadline = 8.1.2 -grokcore.rest = 4.1 ipython-genutils = 0.2.0 Paste = 3.7.1 pexpect = 4.9.0 diff --git a/grok.cfg b/grok.cfg index 689943f..a5639f3 100644 --- a/grok.cfg +++ b/grok.cfg @@ -19,7 +19,6 @@ included = grokcore.content grokcore.error grokcore.formlib - grokcore.json grokcore.layout grokcore.message grokcore.security @@ -28,7 +27,6 @@ included = grokcore.traverser grokcore.view grokcore.viewlet - grokcore.xmlrpc martian z3c.evalexception z3c.flashmessage From c31199b1a6c4593bbd7495121d90ff7c77106a9d Mon Sep 17 00:00:00 2001 From: icemac Date: Mon, 29 Jan 2024 13:01:51 +0000 Subject: [PATCH 2/3] Version synchronization --- dependabot/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependabot/requirements.txt b/dependabot/requirements.txt index 9b017a3..cf5ca5d 100644 --- a/dependabot/requirements.txt +++ b/dependabot/requirements.txt @@ -1,6 +1,6 @@ Chameleon==4.5.0 fanstatic==1.4 -grok==4.0 +grok==5.0 grokcore.annotation==4.0 grokcore.catalog==4.0 grokcore.chameleon==4.0 From ac2fa95492ed9c08482bc2fd93f709753a2586a3 Mon Sep 17 00:00:00 2001 From: Michael Howitz Date: Mon, 29 Jan 2024 14:27:29 +0100 Subject: [PATCH 3/3] Drop support `zope.fanstatic` + `fanstatic`. - `zope.fanstatic` has been archived and does not support Python 3.12. - `fanstatic` was only needed by `zope.fanstatic`. --- buildout.cfg | 2 -- dependabot/requirements.txt | 2 -- docs/changes.rst | 6 ++++++ grok-sources.cfg | 1 - grok-versions.cfg | 2 -- grok.cfg | 1 - 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/buildout.cfg b/buildout.cfg index eb63506..a3b7c1d 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -22,6 +22,4 @@ exclude = # that are defined in zc.catalog, including a hoist of (deprecated) # zope.app.* dependencies. zc.catalog -# Fanstatic use py.test for testing and compattest cannot deal with that. - fanstatic runner-defaults = ['--auto-color', '-v', '--auto-progress'] diff --git a/dependabot/requirements.txt b/dependabot/requirements.txt index cf5ca5d..aa22517 100644 --- a/dependabot/requirements.txt +++ b/dependabot/requirements.txt @@ -1,5 +1,4 @@ Chameleon==4.5.0 -fanstatic==1.4 grok==5.0 grokcore.annotation==4.0 grokcore.catalog==4.0 @@ -30,7 +29,6 @@ zope.app.debug==4.0.0 zope.app.publication==5.0 zope.app.wsgi==5.0 zope.errorview==2.0 -zope.fanstatic==3.0.0 zope.generations==5.1.0 zope.testbrowser==6.0 appnope==0.1.3 diff --git a/docs/changes.rst b/docs/changes.rst index 3d5e6de..0bdf0f0 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -12,6 +12,12 @@ - ``grokcore.json`` +- Drop support ``zope.fanstatic``, as this repository has been archived and + does not support Python 3.12. + +- Remove ``fanstatic`` from the list of version pins as it was only needed by + ``zope.fanstatic``. + 3.0 (2023-12-20) ---------------- diff --git a/grok-sources.cfg b/grok-sources.cfg index 4b8095b..4b3107d 100644 --- a/grok-sources.cfg +++ b/grok-sources.cfg @@ -26,5 +26,4 @@ z3c.recipe.i18n = git ${buildout:github}/z3c.recipe.i18n pushurl=${buildout:gith zope.app.debug = git ${buildout:github}/zope.app.debug pushurl=${buildout:github_push}/zope.app.debug zope.app.wsgi = git ${buildout:github}/zope.app.wsgi pushurl=${buildout:github_push}/zope.app.wsgi zope.errorview = git ${buildout:github}/zope.errorview pushurl=${buildout:github_push}/zope.errorview -zope.fanstatic = git ${buildout:github}/zope.fanstatic pushurl=${buildout:github_push}/zope.fanstatic zope.testbrowser = git ${buildout:github}/zope.testbrowser pushurl=${buildout:github_push}/zope.testbrowser diff --git a/grok-versions.cfg b/grok-versions.cfg index 7dd1780..b81b6a3 100644 --- a/grok-versions.cfg +++ b/grok-versions.cfg @@ -1,7 +1,6 @@ [versions] # GROK Chameleon = 4.5.0 -fanstatic = 1.4 grok = 5.0 grokcore.annotation = 4.0 grokcore.catalog = 4.0 @@ -32,7 +31,6 @@ zope.app.debug = 4.0.0 zope.app.publication = 5.0 zope.app.wsgi = 5.0 zope.errorview = 2.0 -zope.fanstatic = 3.0.0 zope.generations = 5.1.0 zope.testbrowser = 6.0 diff --git a/grok.cfg b/grok.cfg index a5639f3..cb6ac98 100644 --- a/grok.cfg +++ b/grok.cfg @@ -32,7 +32,6 @@ included = z3c.flashmessage zc.catalog zope.errorview - zope.fanstatic # These packages will be removed in the next version deprecating =