[Checkins] SVN: grokapps/GrokIMDB/ Initial import.
Uli Fouquet
uli at gnufix.de
Sun Jan 27 19:48:09 EST 2008
Log message for revision 83265:
Initial import.
Changed:
A grokapps/GrokIMDB/
A grokapps/GrokIMDB/branches/
A grokapps/GrokIMDB/tags/
A grokapps/GrokIMDB/trunk/
A grokapps/GrokIMDB/trunk/.installed.cfg
A grokapps/GrokIMDB/trunk/LICENSE.txt
A grokapps/GrokIMDB/trunk/README.txt
A grokapps/GrokIMDB/trunk/buildout.cfg
A grokapps/GrokIMDB/trunk/setup.py
A grokapps/GrokIMDB/trunk/src/
A grokapps/GrokIMDB/trunk/src/grokimdb/
A grokapps/GrokIMDB/trunk/src/grokimdb/README.txt
A grokapps/GrokIMDB/trunk/src/grokimdb/__init__.py
A grokapps/GrokIMDB/trunk/src/grokimdb/app.py
A grokapps/GrokIMDB/trunk/src/grokimdb/app_templates/
A grokapps/GrokIMDB/trunk/src/grokimdb/app_templates/index.pt
A grokapps/GrokIMDB/trunk/src/grokimdb/browser.txt
A grokapps/GrokIMDB/trunk/src/grokimdb/configure.zcml
A grokapps/GrokIMDB/trunk/src/grokimdb/ftesting.zcml
A grokapps/GrokIMDB/trunk/src/grokimdb/ftests.py
A grokapps/GrokIMDB/trunk/src/grokimdb/locales/
A grokapps/GrokIMDB/trunk/src/grokimdb/locales/grokimdb.pot
A grokapps/GrokIMDB/trunk/src/grokimdb/static/
A grokapps/GrokIMDB/trunk/src/grokimdb/static/grokimdb.css
A grokapps/GrokIMDB/trunk/src/grokimdb/testing.py
A grokapps/GrokIMDB/trunk/src/grokimdb/tests.py
-=-
Added: grokapps/GrokIMDB/trunk/.installed.cfg
===================================================================
--- grokapps/GrokIMDB/trunk/.installed.cfg (rev 0)
+++ grokapps/GrokIMDB/trunk/.installed.cfg 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,129 @@
+[buildout]
+installed_develop_eggs = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs/GrokIMDB.egg-link
+parts = app data zopectl i18n test
+
+[app]
+__buildout_installed__ = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/app
+__buildout_signature__ = zc.zope3recipes-0.6.1-py2.4.egg ZConfig-2.5-py2.4.egg zc.recipe.egg-1.0.0-py2.4.egg setuptools-0.6c7-py2.4.egg zope.testing-3.5.1-py2.4.egg zc.buildout-1.0.0-py2.4.egg zc.buildout-1.0.0-py2.4.egg
+_b = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+_d = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+_e = /home/uli/buildout-eggs
+bin-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+develop-eggs-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+eggs = GrokIMDB
+eggs-directory = /home/uli/buildout-eggs
+executable = /usr/bin/python2.4
+find-links = http://download.zope.org/distribution/
+index = http://download.zope.org/ppix
+location = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/app
+recipe = zc.zope3recipes>=0.5.3:application
+scripts =
+servers = twisted
+site.zcml = <include package="grokimdb" />
+ <include package="zope.app.twisted" />
+ <configure i18n_domain="grokimdb">
+ <unauthenticatedPrincipal id="zope.anybody"
+ title="Unauthenticated User" />
+ <unauthenticatedGroup id="zope.Anybody"
+ title="Unauthenticated Users" />
+ <authenticatedGroup id="zope.Authenticated"
+ title="Authenticated Users" />
+ <everybodyGroup id="zope.Everybody"
+ title="All Users" />
+ <principal id="zope.manager"
+ title="Manager"
+ login="grok"
+ password_manager="Plain Text"
+ password="grok"
+ />
+ <!-- Replace the following directive if you don't want
+ public access -->
+ <grant permission="zope.View"
+ principal="zope.Anybody" />
+ <grant permission="zope.app.dublincore.view"
+ principal="zope.Anybody" />
+ <role id="zope.Manager" title="Site Manager" />
+ <role id="zope.Member" title="Site Member" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager"
+ principal="zope.manager" />
+ </configure>
+
+[data]
+__buildout_installed__ =
+__buildout_signature__ = zc.recipe.filestorage-1.0.0-py2.4.egg setuptools-0.6c7-py2.4.egg zope.testing-3.5.1-py2.4.egg zc.buildout-1.0.0-py2.4.egg
+blob-dir =
+path = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/data/Data.fs
+recipe = zc.recipe.filestorage
+zconfig = <zodb>
+ %(__buildout_space__)s%(__buildout_space__)s<filestorage>
+ %(__buildout_space__)s%(__buildout_space__)s%(__buildout_space__)s%(__buildout_space__)spath /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/data/Data.fs
+ %(__buildout_space__)s%(__buildout_space__)s</filestorage>
+ </zodb>%(__buildout_space_n__)s
+
+[zopectl]
+__buildout_installed__ = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/zopectl
+ /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin/zopectl
+__buildout_signature__ = zc.zope3recipes-0.6.1-py2.4.egg ZConfig-2.5-py2.4.egg zc.recipe.egg-1.0.0-py2.4.egg setuptools-0.6c7-py2.4.egg zope.testing-3.5.1-py2.4.egg zc.buildout-1.0.0-py2.4.egg zc.buildout-1.0.0-py2.4.egg
+_b = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+_d = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+_e = /home/uli/buildout-eggs
+application = app
+application-location = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/app
+bin-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+develop-eggs-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+eggs = zdaemon
+ setuptools
+eggs-directory = /home/uli/buildout-eggs
+executable = /usr/bin/python2.4
+find-links = http://download.zope.org/distribution/
+index = http://download.zope.org/ppix
+recipe = zc.zope3recipes:instance
+run-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/zopectl
+scripts =
+servers = twisted
+zope.conf = <zodb>
+ %(__buildout_space__)s%(__buildout_space__)s<filestorage>
+ %(__buildout_space__)s%(__buildout_space__)s%(__buildout_space__)s%(__buildout_space__)spath /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/data/Data.fs
+ %(__buildout_space__)s%(__buildout_space__)s</filestorage>
+ </zodb>%(__buildout_space_n__)s
+
+[i18n]
+__buildout_installed__ = bin/i18nextract
+ bin/i18nmergeall
+__buildout_signature__ = lovely.recipe-0.3.1b1-py2.4.egg ZConfig-2.5-py2.4.egg zc.zodbrecipes-0.3.1-py2.4.egg zc.zope3recipes-0.6.1-py2.4.egg zope.app.locales-3.4.0a1-py2.4.egg zc.recipe.egg-1.0.0-py2.4.egg zc.buildout-1.0.0-py2.4.egg setuptools-0.6c7-py2.4.egg ZConfig-2.5-py2.4.egg zope.testing-3.5.1-py2.4.egg ZConfig-2.5-py2.4.egg zope.tal-3.4.0b1-py2.4.egg zope.interface-3.4.0-py2.4-linux-i686.egg zope.i18nmessageid-3.4.0a1-py2.4-linux-i686.egg zope.app.appsetup-3.4.1-py2.4.egg zope.app.applicationcontrol-3.4.1-py2.4.egg zc.buildout-1.0.0-py2.4.egg zope.i18n-3.4.0-py2.4.egg ZODB3-3.8.0b2-py2.4-linux-i686.egg zope.traversing-3.5.0a1.dev_r78730-py2.4.egg zope.security-3.4.0b5-py2.4-linux-i686.egg zope.event-3.4.0-py2.4.egg zope.error-3.5.1-py2.4.egg zope.configuration-3.4.0-py2.4.egg zope.component-3.4.0-py2.4.egg zope.app.publication-3.4.2-py2.4.egg zope.app.folder-3.4.0a1-py2.4.egg zope.app.container-3.5.0a1-py2.4-linux-i686.egg zope.app.component-3.4.0b3-py2.4.egg zope.size-3.4.0-py2.4.egg zope.i18n-3.4.0-py2.4.egg zope.component-3.4.0-py2.4.egg pytz-2007f-py2.4.egg zdaemon-2.0.0-py2.4.egg zope.proxy-3.4.0-py2.4-linux-i686.egg zope.publisher-3.5.0a1.dev_r78838-py2.4.egg zope.schema-3.4.0-py2.4.egg zope.location-3.4.0b2-py2.4.egg zope.exceptions-3.4.0-py2.4.egg zope.deferredimport-3.4.0-py2.4.egg zope.publisher-3.5.0a1.dev_r78838-py2.4.egg zope.deprecation-3.4.0-py2.4.egg zope.app.security-3.4.0a1_1-py2.4.egg zope.app.exception-3.4.0a1-py2.4.egg zope.app.error-3.5.1-py2.4.egg zope.app.http-3.4.0a1-py2.4.egg zope.app.authentication-3.4.0a1-py2.4.egg zope.datetime-3.4.0-py2.4.egg zope.dublincore-3.4.0-py2.4.egg zope.copypastemove-3.4.0-py2.4.egg zope.app.broken-3.4.0a1-py2.4.egg zope.filerepresentation-3.4.0-py2.4.egg zope.lifecycleevent-3.4.0-py2.4.egg zope.location-3.4.0b2-py2.4.egg zope.dottedname-3.4.2-py2.4.egg zope.cachedescriptors-3.4.0-py2.4.egg zope.app.zapi-3.4.0a1-py2.4.egg zope.app.publisher-3.5.0a2-py2.4.egg zope.thread-3.4-py2.4.egg zope.location-3.4.0b2-py2.4.egg zope.formlib-3.4.0-py2.4.egg zope.component-3.4.0-py2.4.egg zope.app.pagetemplate-3.4.0-py2.4.egg zope.app.interface-3.4.0a1-py2.4.egg zope.annotation-3.4.0-py2.4.egg zope.proxy-3.4.0-py2.4-linux-i686.egg zope.app.i18n-3.4.0a1-py2.4.egg zope.app.form-3.4.0b2-py2.4.egg zope.app.session-3.4.0a1-py2.4.egg zope.app.testing-3.4.0a1-py2.4.egg zope.app.principalannotation-3.4.0a1-py2.4.egg zope.traversing-3.5.0a1.dev_r78730-py2.4.egg zope.pagetemplate-3.4.0a1-py2.4.egg zope.contenttype-3.4.0-py2.4.egg zope.app.zcmlfiles-3.4.0a1-py2.4.egg zope.hookable-3.4.0-py2.4-linux-i686.egg zope.tales-3.4.0a1-py2.4.egg zope.security-3.4.0b5-py2.4-linux-i686.egg zodbcode-3.4.0b1dev_r75670-py2.4.egg zope.location-3.4.0b2-py2.4.egg zope.location-3.4.0b2-py2.4.egg zope.app.basicskin-3.4.0a1-py2.4.egg zope.app.dependable-3.4.0a1-py2.4.egg zope.app.debug-3.4.0a1-py2.4.egg zope.app.schema-3.4.0a1-py2.4.egg zope.app.wsgi-3.4.0-py2.4.egg zope.app.rotterdam-3.4.0a1-py2.4.egg zope.app.zopeappgenerations-3.4.0a1-py2.4.egg zope.app.generations-3.4.0a1-py2.4.egg zope.app.content-3.4.0a1-py2.4.egg zope.modulealias-3.4.0a1-py2.4.egg RestrictedPython-3.4dev_r73256-py2.4.egg zope.app.renderer-3.4.0a1-py2.4.egg zope.structuredtext-3.4.0-py2.4.egg docutils-0.4-py2.4.egg
+_b = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+_d = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+_e = /home/uli/buildout-eggs
+bin-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+develop-eggs-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+domain = grokimdb
+eggs = %(__buildout_space_n__)szope.app.locales
+ grokimdb
+eggs-directory = /home/uli/buildout-eggs
+executable = /usr/bin/python2.4
+find-links = http://download.zope.org/distribution/
+index = http://download.zope.org/ppix
+location = src/grokimdb
+output = locales
+package = grokimdb
+recipe = lovely.recipe:i18n
+
+[test]
+__buildout_installed__ = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/test
+ /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin/test
+__buildout_signature__ = zc.recipe.testrunner-1.0.0-py2.4.egg zc.recipe.egg-1.0.0-py2.4.egg setuptools-0.6c7-py2.4.egg zope.testing-3.5.1-py2.4.egg zc.buildout-1.0.0-py2.4.egg zc.buildout-1.0.0-py2.4.egg
+_b = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+_d = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+_e = /home/uli/buildout-eggs
+bin-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+develop-eggs-directory = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/develop-eggs
+eggs = GrokIMDB
+eggs-directory = /home/uli/buildout-eggs
+executable = /usr/bin/python2.4
+find-links = http://download.zope.org/distribution/
+index = http://download.zope.org/ppix
+location = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/parts/test
+recipe = zc.recipe.testrunner
+script = /home/uli/WorkShop/devel/zope/GrokIMDB/GrokIMDB/bin/test
Added: grokapps/GrokIMDB/trunk/LICENSE.txt
===================================================================
--- grokapps/GrokIMDB/trunk/LICENSE.txt (rev 0)
+++ grokapps/GrokIMDB/trunk/LICENSE.txt 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+ accompanying copyright notice, this list of conditions,
+ and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+ endorse or promote products derived from this software
+ without prior written permission from the copyright
+ holders.
+
+4. The right to distribute this software or to use it for
+ any purpose does not give you the right to use
+ Servicemarks (sm) or Trademarks (tm) of the copyright
+ holders. Use of them is covered by separate agreement
+ with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+ files to carry prominent notices stating that you changed
+ the files and the date of any change.
+
+Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
Added: grokapps/GrokIMDB/trunk/README.txt
===================================================================
--- grokapps/GrokIMDB/trunk/README.txt (rev 0)
+++ grokapps/GrokIMDB/trunk/README.txt 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,117 @@
+********
+GrokIMDB
+********
+
+This is a nifty little demo application for Grok.
+
+It provides a userinterface to fetch and edit data retrieved from the
+Internet Movie Database (IMDb).
+
+Prerequisites
+=============
+
+You need
+
+ - Python 2.4 and
+
+ -`setuptools`
+
+to run this application. Rumors are, that also Python 2.5 will work.
+
+
+Installation
+============
+
+To install this package, run::
+
+ $ bootstrap/bootstrap.py
+
+which should create a `bin/` directory containing a `buildout` script.
+
+Next, run::
+
+ $ bin/buildout
+
+which should setup everything, fetch needed packages from the net
+etc.
+
+
+Run the Application
+===================
+
+This can be done in three steps.
+
+
+1) Start the Zope-Server
+------------------------
+
+To start the application in the background, run::
+
+ $ bin/zopectl start
+
+and stop it with::
+
+ $ bin/zopectl stop
+
+Tests are run doing::
+
+ $ bin/test
+
+If you want to run the application in foreground, you can do::
+
+ $ bin/zopectl fg
+
+The server can then be stopped hitting CTRL-D.
+
+
+2) Log into the admin interface
+-------------------------------
+
+One server can serve several instances of GrokIMDB. Therefore we
+firstly have to create an instance of it. To do this, we use the Grok
+admin interface, which can be reached via::
+
+ http://localhost:8080/
+
+Open that URL in a browser. You will be asked for a username/password.
+
+Enter::
+
+
+ grok
+
+and
+
+ grok
+
+That should log you in.
+
+
+3) Create an instance of GrokIMDB
+---------------------------------
+
+Now enter a name for your new GrokIMDB instance and click 'Add'. This
+should create a new instance of GrokIMDB, that will be displayed.
+
+To go to your new GrokIMDB, just click on the freshly created link.
+
+
+Development
+===========
+
+GrokIMDB can give you only a rough sketch of all possibilities of
+Grok. You can develop the application further by modifying the sources
+in the `src/` directory. Note, that you have to restart the server,
+when classes or similar things were changed.
+
+
+Further Grok Resources
+======================
+
+There is an excellent tutorial on the Grok homepage::
+
+ http://grok.zope.org/documentation/book/
+
+
+Happy Grokking!
+
Added: grokapps/GrokIMDB/trunk/buildout.cfg
===================================================================
--- grokapps/GrokIMDB/trunk/buildout.cfg (rev 0)
+++ grokapps/GrokIMDB/trunk/buildout.cfg 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,68 @@
+[buildout]
+develop = .
+parts = app data zopectl i18n test
+find-links = http://download.zope.org/distribution/
+newest = false
+extends= http://grok.zope.org/releaseinfo/grok-0.11.1.cfg
+versions = versions
+
+[data]
+recipe = zc.recipe.filestorage
+
+[app]
+recipe = zc.zope3recipes>=0.5.3:application
+eggs = GrokIMDB
+site.zcml = <include package="grokimdb" />
+ <include package="zope.app.twisted" />
+
+ <configure i18n_domain="grokimdb">
+ <unauthenticatedPrincipal id="zope.anybody"
+ title="Unauthenticated User" />
+ <unauthenticatedGroup id="zope.Anybody"
+ title="Unauthenticated Users" />
+ <authenticatedGroup id="zope.Authenticated"
+ title="Authenticated Users" />
+ <everybodyGroup id="zope.Everybody"
+ title="All Users" />
+ <principal id="zope.manager"
+ title="Manager"
+ login="grok"
+ password_manager="Plain Text"
+ password="grok"
+ />
+
+ <!-- Replace the following directive if you don't want
+ public access -->
+ <grant permission="zope.View"
+ principal="zope.Anybody" />
+ <grant permission="zope.app.dublincore.view"
+ principal="zope.Anybody" />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <role id="zope.Member" title="Site Member" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager"
+ principal="zope.manager" />
+ </configure>
+
+[data]
+recipe = zc.recipe.filestorage
+
+# this section named so that the start/stop script is called bin/zopectl
+[zopectl]
+recipe = zc.zope3recipes:instance
+application = app
+zope.conf = ${data:zconfig}
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = GrokIMDB
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+
+# this section named so that the i18n scripts are called bin/i18n...
+[i18n]
+recipe = lovely.recipe:i18n
+package = grokimdb
+domain = grokimdb
+location = src/grokimdb
+output = locales
Added: grokapps/GrokIMDB/trunk/setup.py
===================================================================
--- grokapps/GrokIMDB/trunk/setup.py (rev 0)
+++ grokapps/GrokIMDB/trunk/setup.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,39 @@
+from setuptools import setup, find_packages
+
+version = '0.1'
+long_description = (
+ read('README.txt')
+ + '\n\n'
+ )
+
+setup(name='GrokIMDB',
+ version=version,
+ description="A Grok demo application for editing data "
+ "retrieved from IMDb.",
+ long_description=long_description,
+ # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=['Development Status :: 3 - Alpha',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Framework :: Zope3',
+ ],
+ keywords="",
+ author="Uli Fouquet and Jan-Ulrich Hasecke",
+ author_email="uli at gnufix.de",
+ url="http://cheeseshop.python.org/GrokIMDB",
+ license="ZPL",
+ package_dir={'': 'src'},
+ packages=find_packages('src'),
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=['setuptools',
+ 'grok',
+ # Add extra requirements here
+ 'IMDbPY',
+ ],
+ entry_points="""
+ # Add entry points here
+ """,
+ )
Added: grokapps/GrokIMDB/trunk/src/grokimdb/README.txt
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/README.txt (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/README.txt 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,48 @@
+
+=======================
+The Grok IMDB interface
+=======================
+
+The Grok IMDB provides a little database to store information about
+movies. You can create an instance of the grokimdb as follows::
+
+ >>> from grokimdb.app import GrokIMDB
+ >>> mydb = GrokIMDB()
+ >>> mydb
+ <grokimdb.app.GrokIMDB object at 0x...>
+
+Now we have a GrokIMDB object.
+
+At first, the database is empty::
+
+ >>> list(mydb)
+ []
+
+We can add movies to the database::
+
+ >>> from grokimdb.app import Movie
+ >>> mymovie = Movie()
+ >>> mydb['entry1'] = mymovie
+ >>> list(mydb)
+ [u'entry1']
+
+We can obtain entries from the database::
+
+ >>> mydb['entry1']
+ <grokimdb.app.Movie object at 0x...>
+
+We cannot replace entries once they are in::
+
+ >>> mydb['entry1'] = Movie()
+ Traceback (most recent call last):
+ ...
+ DuplicationError: entry1
+
+We can remove existing entries:
+
+ >>> del mydb['entry1']
+ >>> list(mydb)
+ []
+
+Now the database is empty as it was in the beginning.
+
Added: grokapps/GrokIMDB/trunk/src/grokimdb/__init__.py
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/__init__.py (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/__init__.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1 @@
+# this directory is a package
Added: grokapps/GrokIMDB/trunk/src/grokimdb/app.py
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/app.py (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/app.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,103 @@
+import imdb
+import grok
+from zope import schema
+from zope.interface import Interface, implements
+
+class GrokIMDB(grok.Application, grok.Container):
+ pass
+
+class Index(grok.View):
+ grok.context(GrokIMDB)
+
+class IMovie(Interface):
+ """Infos about a movie.
+ """
+ id = schema.TextLine(title=u'IMDb ID', required=False)
+ title = schema.TextLine(title=u'Title', required=False)
+ year = schema.Int(title=u'Year', required=False)
+ summary = schema.Text(title=u'Summary', required=False)
+
+class Movie(grok.Model):
+ """Infos about a movie.
+
+ We can easily create movies::
+
+ >>> from grokimdb.app import Movie
+ >>> movie = Movie()
+ >>> movie
+ <grokimdb.app.Movie object at 0x...>
+
+ """
+ implements(IMovie)
+
+
+class AddMovie(grok.AddForm):
+ grok.context(GrokIMDB)
+ form_fields = grok.AutoFields(IMovie)
+ @grok.action("Add movie")
+ def add(self, **data):
+ movie = Movie()
+ self.applyData(movie, **data)
+ self.context[str(data['id'])] = movie
+ self.redirect(self.url(movie))
+ @grok.action("Lookup IMDb")
+ def lookup(self, **data):
+ movie = Movie()
+ imdb_query = imdb.IMDb(accessSystem='http')
+ results = imdb_query.search_movie(data['title'])
+ if not results:
+ self.redirect(self.url(context) + '/@@addmovie')
+ return
+ result = results[0] # Consider only the first result
+ imdb_query.update(result)
+ data['id'], data['year'], data['title'] = (
+ result.getID(), result['year'], result['title']
+ )
+ data['summary'] = ' '.join(result['plot'])
+ self.applyData(movie, **data)
+ self.context[str(data['id'])] = movie
+ self.redirect(self.url(movie) + '/@@edit')
+
+
+class DisplayMovie(grok.DisplayForm):
+ grok.context(IMovie)
+ grok.name('index')
+ form_fields = grok.AutoFields(IMovie)
+
+
+class EditMovie(grok.EditForm):
+ grok.context(IMovie)
+ grok.name('edit')
+ form_fields = grok.AutoFields(IMovie)
+
+ @grok.action("Apply changes")
+ def applyChanges(self, **data):
+ self.applyData(self.context, **data)
+
+ @grok.action("Return to index")
+ def returnToIndex(self, **data):
+ self.applyData(self.context, **data)
+ self.redirect(self.url(self.context.__parent__))
+
+
+class DeleteMovie(grok.View):
+ grok.context(GrokIMDB)
+ grok.name('delete')
+
+ def update(self, id):
+ del self.context[id]
+
+ def render(self):
+ self.redirect(self.url(self.context))
+
+
+class GrokIMDB_XMLRPC(grok.XMLRPC):
+ grok.context(GrokIMDB)
+ def getMovieIDs(self):
+ return list(self.context)
+ def getMovie(self, movie_id):
+ movie = self.context[movie_id]
+ return {'title': movie.title,
+ 'year' : movie.year,
+ 'summary': movie.summary}
+
Added: grokapps/GrokIMDB/trunk/src/grokimdb/app_templates/index.pt
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/app_templates/index.pt (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/app_templates/index.pt 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,48 @@
+<html>
+<head>
+ <link rel="stylesheet" type="text/css"
+ tal:attributes="href view/static/grokimdb.css" />
+</head>
+<body>
+ <h1>Welcome to your GrokIMDB!</h1>
+ <h2>Your movies:</h2>
+ <ul>
+ <li tal:repeat="movie context/values">
+ <a href=""
+ tal:attributes="href movie/id">
+ <span tal:content="movie/title" />
+ (<span tal:content="movie/year" />)
+ </a>
+ <a href=""
+ tal:attributes="href string:delete?id=${movie/id}">
+ Delete
+ </a>
+ </li>
+ </ul>
+
+ <a href="addmovie">Add a movie</a>
+</body>
+</html>
+<!--<html>
+<head></head>
+<body>
+ <h1>Welcome to your GrokIMDB!</h1>
+ <h2>Your movies:</h2>
+ <ul>
+ <li tal:repeat="movie context/values">
+ <a href=""
+ tal:attributes="href movie/id">
+ <span tal:content="movie/title" />
+ (<span tal:content="movie/year" />)
+ </a>
+ <a href=""
+ tal:attributes="href string:delete?id=${movie/id}">
+ Delete
+ </a>
+ </li>
+ </ul>
+
+ <a href="addmovie">Add a movie</a>
+</body>
+</html>
+-->
\ No newline at end of file
Added: grokapps/GrokIMDB/trunk/src/grokimdb/browser.txt
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/browser.txt (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/browser.txt 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,57 @@
+=================================
+Using the GrokIMDB with a browser
+=================================
+
+First, we have to authenticate ourselves against the testing
+environment. We use the credentials, that are setup by default::
+
+ >>> import grok
+ >>> grok.grok('grokimdb')
+ >>> from zope.testbrowser.testing import Browser
+ >>> browser = Browser()
+ >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+
+Now we can 'send' requests to the server, using the `browser` object::
+
+ >>> browser.open("http://localhost/")
+
+We should see the Grok-Interface::
+
+ >>> print browser.contents
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ ...
+ ... <legend>Add application</legend>
+ ...
+
+Now, let's add an instance of ``GrokIMDB``::
+
+ >>> subform = browser.getForm(name='GrokIMDB')
+ >>> subform.getControl('Name your new app:').value = 'myimdb'
+ >>> subform.getControl('Create').click()
+
+We submitted a form and now the new application should be ready for
+use. We try to fetch it::
+
+ >>> browser.open("http://localhost/myimdb")
+ >>> print browser.contents
+ <html>
+ ...
+ ...<h1>Welcome to your GrokIMDB!</h1>
+ ...
+
+The application was created. Now, we want to add a movie. We look for
+a link, that is entitled "Add a movie"::
+
+ >>> link = browser.getLink("Add a movie")
+ >>> link is not None
+ True
+
+If found, we click that link and should get a page with an `Add movie`
+button on it::
+
+ >>> link.click()
+ >>> print browser.contents
+ <html>
+ ...
+ ... <input type="submit" ... value="Add movie" ...>
+ ...
Added: grokapps/GrokIMDB/trunk/src/grokimdb/configure.zcml
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/configure.zcml (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/configure.zcml 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,5 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:grok="http://namespaces.zope.org/grok">
+ <include package="grok" />
+ <grok:grok package="." />
+</configure>
Added: grokapps/GrokIMDB/trunk/src/grokimdb/ftesting.zcml
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/ftesting.zcml (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/ftesting.zcml 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,35 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="grokimdb"
+ package="grokimdb"
+ >
+
+ <include package="grok" />
+ <include package="grokimdb" />
+
+ <!-- Typical functional testing security setup -->
+ <securityPolicy
+ component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+ />
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User"
+ />
+ <grant
+ permission="zope.View"
+ principal="zope.anybody"
+ />
+
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw"
+ />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>
Added: grokapps/GrokIMDB/trunk/src/grokimdb/ftests.py
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/ftests.py (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/ftests.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,47 @@
+import unittest
+import os.path
+import grok
+
+from zope.testing import doctest
+from zope.app.testing.functional import (
+ HTTPCaller, getRootFolder, FunctionalTestSetup,
+ sync, ZCMLLayer, FunctionalDocFileSuite)
+
+DOCTESTFILES = ['browser.txt']
+
+ftesting_zcml = os.path.join(os.path.dirname(grok.__file__),
+ 'ftesting.zcml')
+GrokIMDBFunctionalLayer = ZCMLLayer(ftesting_zcml, __name__,
+ 'GrokIMDBFunctionalLayer')
+
+def setUp(test):
+ FunctionalTestSetup().setUp()
+
+def tearDown(test):
+ FunctionalTestSetup().tearDown()
+
+def suiteFromFile(name):
+ suite = unittest.TestSuite()
+ test = FunctionalDocFileSuite(
+ name, setUp=setUp, tearDown=tearDown,
+ encoding='utf-8',
+ globs=dict(http=HTTPCaller(),
+ getRootFolder=getRootFolder,
+ sync=sync
+ ),
+ optionflags = (doctest.ELLIPSIS+
+ doctest.NORMALIZE_WHITESPACE+
+ doctest.REPORT_NDIFF)
+ )
+ test.layer = GrokIMDBFunctionalLayer
+ suite.addTest(test)
+ return suite
+
+def test_suite():
+ suite = unittest.TestSuite()
+ for name in DOCTESTFILES:
+ suite.addTest(suiteFromFile(name))
+ return suite
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Added: grokapps/GrokIMDB/trunk/src/grokimdb/locales/grokimdb.pot
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/locales/grokimdb.pot (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/locales/grokimdb.pot 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2003-2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+msgid ""
+msgstr ""
+"Project-Id-Version: Development/Unknown\n"
+"POT-Creation-Date: Wed Nov 14 16:16:57 2007\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: Zope 3 Developers <zope3-dev at zope.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/locales/extract.py\n"
+
Added: grokapps/GrokIMDB/trunk/src/grokimdb/static/grokimdb.css
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/static/grokimdb.css (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/static/grokimdb.css 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,5 @@
+body {
+ color:#555;
+ font-family:verdana;
+ font-size:0.8em;
+}
Added: grokapps/GrokIMDB/trunk/src/grokimdb/testing.py
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/testing.py (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/testing.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,7 @@
+import os.path
+import grokimdb
+from zope.app.testing.functional import ZCMLLayer
+
+ftesting_zcml = os.path.join(
+ os.path.dirname(grokimdb.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer')
Added: grokapps/GrokIMDB/trunk/src/grokimdb/tests.py
===================================================================
--- grokapps/GrokIMDB/trunk/src/grokimdb/tests.py (rev 0)
+++ grokapps/GrokIMDB/trunk/src/grokimdb/tests.py 2008-01-28 00:48:09 UTC (rev 83265)
@@ -0,0 +1,28 @@
+import unittest
+from zope.testing import doctest, cleanup
+import grokimdb
+
+DOCTESTFILES = ['app.py', 'grokimdb.txt']
+
+def setUpZope(test):
+ pass
+
+def cleanUpZope(test):
+ cleanup.cleanUp()
+
+def test_suite():
+ suite = unittest.TestSuite()
+ for name in DOCTESTFILES:
+ suite.addTest(doctest.DocFileSuite(
+ name,
+ package=grokimdb,
+ setUp=setUpZope,
+ tearDown=cleanUpZope,
+ encoding='utf8',
+ optionflags=doctest.ELLIPSIS+
+ doctest.NORMALIZE_WHITESPACE)
+ )
+ return suite
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
More information about the Checkins
mailing list