Skip to main content

The main purpose of this package is to provide support for enabling Grok applications to be run as aster served WSGI applications without using the zodb.

Using megrok.nozodb

To setup a grok environment which works without the zodb you have to replace the paster-application-factory which typically is located in the debug.ini and in the deploy.ini: To be concrete replace grokcore.startup#… with megrok.nozodb#nozodb

[app:grok] use = egg:megrok.nozodb#nozodb

The next you have to do is setting up global utility which acts as an ApplicationRoot which is a starting point for your application. megrok.nozodb has an ungrokked default one. You can subclass from it or provide your own stuff which acts as ApplicationRoot.:

>>> from megrok.nozodb import ApplicationRoot

>>> class MyApplicationRoot(ApplicationRoot):
...     pass

>>> myapp = MyApplicationRoot()
>>> from zope.site.interfaces import IRootFolder
>>> IRootFolder.providedBy(myapp)
True

>>> from grok.interfaces import IApplication
>>> IApplication.providedBy(myapp)
True

>>> from zope.location import ILocation
>>> ILocation.providedBy(myapp)
True

>>> from zope.interface.verify import verifyObject
>>> from zope.component.interfaces import ISite
>>> verifyObject(ISite, myapp)
True

API Documentation

We have to create a simple site definition file, which is also quite plain:

 >>> import os, tempfile
 >>> temp_dir = tempfile.mkdtemp()

 >>> sitezcml = os.path.join(temp_dir, 'site.zcml')
 >>> open(sitezcml, 'w').write('<configure />')

 >>> zope_conf = os.path.join(temp_dir, 'zope.conf')
 >>> open(zope_conf, 'wb').write('''
 ... site-definition %s
 ...
 ... <zodb>
 ... </zodb>
 ...
 ... <eventlog>
 ...   <logfile>
 ...     path STDOUT
 ...   </logfile>
 ... </eventlog>
 ... ''' %sitezcml)


 >>> from megrok.nozodb import nozodb_factory
 >>> app_factory = nozodb_factory({'zope_conf': zope_conf})

Clean up the temp_dir

  >>> import shutil
  >>> shutil.rmtree(temp_dir)

Changelog

0.1 (2010-11-04)

  • Initial release

Release files for megrok.nozodb 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for megrok.nozodb 0.1
File Size Uploaded
megrok.nozodb-0.1.tar.gz 8.7 kB Details

Release files / megrok.nozodb-0.1.tar.gz

Download URL megrok.nozodb-0.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1e81f69cf4b1ba17f34ddbcf772cb72ad7267adbc2d41c06115b069014894ab1
BLAKE2b-256 checksum
How to use checksums
860588d5e4eb037c6574ae556dd05e7fced7656e95ea668b0a3ff07da73c7da2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page