Skip to content

Commit

Permalink
Merge dd5a7a2 into 477c80d
Browse files Browse the repository at this point in the history
  • Loading branch information
thefunny42 committed Jun 24, 2015
2 parents 477c80d + dd5a7a2 commit efab513
Show file tree
Hide file tree
Showing 19 changed files with 828 additions and 96 deletions.
11 changes: 11 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,17 @@ Changes
0.12.1 (unreleased)
~~~~~~~~~~~~~~~~~~~

- Add a script to check a database to see if a class is used as a
persistent object in it or not or if it is missing.
- Add script to check a database for broken records and cache the
object references information in a sqlite database file. This allows
for displaying forward and backward object references as well as
providing an overview of currently broken objects and by which
objects they are referred to.
- Add support for a ZConfig configuration file to specify the
database. This bring support for RelStorage and other non-default
storage.


0.12.0 (2015-02-25)
~~~~~~~~~~~~~~~~~~~
Expand Down
46 changes: 46 additions & 0 deletions README.rst
Expand Up @@ -75,6 +75,52 @@ virtualenv, if you use virtualenvs). This way your application (or Zope's)
nice __repr__ will also be used.


Other scripts
-------------

zodbcheck
~~~~~~~~~

Script to scan and build a database containing the relationships
between object stored in the ZODB. By doing so it will count POSKey
errors: those are links to objects in the ZODB that are no longer
there.

You can use this database with zodbbrowser after: it will contain
additional information to browse objects using this reference
information.

In addition to this, a page will list all missing objects (that
triggers the errors) and the objects that referring to them.


This script only works on history free databases at the moment.

zodbsearch
~~~~~~~~~~

Script to search quickly trough a database to see if a Python class is
still used in it.

To have accurate results you must pack your databases before, as it
could be that the reported class is used in objects that got removed
from the ZODB or are present in older versions of the available
objects.

sqlpack
~~~~~~~

Script to pack Relstorage history free databases. It will use the
result computed by zodbcheck in order to find which object to remove
from the SQL database and generate an SQL file with delete statement
in order to remove them. If you store your blobs outside of the SQL
database, it can generate a shell script to remove those as well.

The advantage of this solution, is, mostly is speed, and the fact that
you do not need to execute it on your production database: you can run
both zodbcheck and sqlpack on a backup of your main database and after
execute the two scripts you obtain on the production one.

Online help
-----------

Expand Down
14 changes: 9 additions & 5 deletions setup.py
Expand Up @@ -5,13 +5,13 @@
from setuptools import setup, find_packages


def get_version_and_homepage():
def get_homepage():
# extracts it from src/zodbbrowser/__init__.py
here = os.path.dirname(__file__)
zodbbrowser = os.path.join(here, 'src', 'zodbbrowser', '__init__.py')
d = {}
execfile(zodbbrowser, d)
return d['__version__'], d['__homepage__']
return d['__homepage__']


class UltraMagicString(object):
Expand Down Expand Up @@ -61,7 +61,7 @@ def get_long_description():
)


version, homepage = get_version_and_homepage()
homepage = get_homepage()
long_description = get_long_description()

setup(
Expand All @@ -71,7 +71,7 @@ def get_long_description():
maintainer_email="marius@pov.lt",
description="ZODB browser",
long_description=long_description,
version=version,
version='0.12.1-md.dev0',
url=homepage,
classifiers=[
'Development Status :: 4 - Beta',
Expand All @@ -87,6 +87,7 @@ def get_long_description():
package_dir={'': 'src'},
install_requires=[
"ZODB3",
"ZConfig",
"zope.app.pagetemplate",
"zope.app.publication",
"zope.component",
Expand All @@ -109,7 +110,7 @@ def get_long_description():
"zope.app.component",
"zope.securitypolicy",
"zope.app.server",
"zope.app.session", # purely BBB for old Data.fs'es
"zope.app.session", # purely BBB for old Data.fs'es
"zope.app.zcmlfiles",
"zope.server",
"zope.error",
Expand All @@ -129,6 +130,9 @@ def get_long_description():
entry_points={
'console_scripts': [
'zodbbrowser = zodbbrowser.standalone:main',
'zodbcheck = zodbbrowser.check:main',
'zodbsearch = zodbbrowser.search:main',
'sqlpack = zodbbrowser.sqlpack:main',
],
'z3c.autoinclude.plugin': [
'target = plone',
Expand Down
1 change: 0 additions & 1 deletion src/zodbbrowser/__init__.py
Expand Up @@ -18,6 +18,5 @@
"""


__version__ = '0.12.1.dev0'
__homepage__ = 'https://github.com/mgedmin/zodbbrowser'
7 changes: 7 additions & 0 deletions src/zodbbrowser/browser-zope2.zcml
Expand Up @@ -34,4 +34,11 @@
permission="zope2.ViewManagementScreens"
/>

<page
name="zodbbrowser_missing"
class=".browser.ZodbMissingView"
for="zope.interface.Interface"
permission="zope2.ViewManagementScreens"
/>

</configure>
10 changes: 10 additions & 0 deletions src/zodbbrowser/browser-zope3.zcml
Expand Up @@ -36,4 +36,14 @@
permission="zope.ManageContent"
/>

<page
name="zodbbrowser_missing"
class=".browser.ZodbMissingView"
for="zope.interface.Interface"
permission="zope.ManageContent"
menu="zmi_actions"
title="ZODB missing Browser"
/>


</configure>

0 comments on commit efab513

Please sign in to comment.