[Zope3-checkins] CVS: Zope3/src/zope/app/broken - __init__.py:1.1 broken.gif:1.1 broken.pt:1.1 broken.py:1.1 browser.zcml:1.1 configure.zcml:1.1

Jim Fulton jim at zope.com
Wed Feb 25 07:31:50 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/broken
In directory cvs.zope.org:/tmp/cvs-serv4961/src/zope/app/broken

Added Files:
	__init__.py broken.gif broken.pt broken.py browser.zcml 
	configure.zcml 
Log Message:
Integrated new ZODB broken-object support with Zope 3, providing an
icon basic view for broken objects.  Also providing location support.

(A next step is to provide annotation support.)

Broken objects are objects who's class has gone away, typically
because modules or classes have been removed or moved.


=== Added File Zope3/src/zope/app/broken/__init__.py ===
#


=== Added File Zope3/src/zope/app/broken/broken.gif ===
  <Binary-ish file>

=== Added File Zope3/src/zope/app/broken/broken.pt ===
<html metal:use-macro="context/@@standard_macros/page">

<div metal:fill-slot="body">

<p>This object is broken because it's class can't be found.</p>

<p>This probably because the class' module, 
<strong tal:content="context/__class__/__module__">somemodule</strong>,
can't be found or because the name, <strong
tal:content="context/__class__/__name__">somemodule</strong>, is no longer
defined by the module.</p>


</div>

</html>


=== Added File Zope3/src/zope/app/broken/broken.py ===
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Broken-object support

$Id: broken.py,v 1.1 2004/02/25 12:31:49 jim Exp $
"""


import ZODB.broken
import zope.interface
import zope.app.interfaces.location
import zope.app.event.function

class IBroken(zope.interface.Interface):
    """Marker interface for broken objects
    """

class Broken(ZODB.broken.Broken):
    zope.interface.implements(IBroken, zope.app.interfaces.location.ILocation)

    def __parent__(self):
        return self.__Broken_state__.get('__parent__')

    __parent__ = property(__parent__)

    def __name__(self):
        return self.__Broken_state__.get('__name__')
    
    __name__ = property(__name__)

def installBroken(event):
    
    Broken_ = Broken # make it local for speed
    find_global = ZODB.broken.find_global
    
    def classFactory(connection, modulename, globalname):
        return find_global(modulename, globalname, Broken_)

    event.database.setClassFactory(classFactory)

installBroken = zope.app.event.function.Subscriber(installBroken)


=== Added File Zope3/src/zope/app/broken/browser.zcml ===
<configure xmlns="http://namespaces.zope.org/browser">

   <icon name="zmi_icon" for=".broken.IBroken" file="broken.gif" />

   <page
       name="index.html"
       menu="zmi_views" title="What?"
       for=".broken.IBroken"
       template="broken.pt"
       permission="zope.ManageContent"
       />

</configure>


=== Added File Zope3/src/zope/app/broken/configure.zcml ===
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:event="http://namespaces.zope.org/event"
    >

  <event:subscribe
      subscriber=".broken.installBroken"
      event_types="zope.app.interfaces.event.IDatabaseOpenedEvent" 
      />

  <include file="browser.zcml" /> 

</configure>




More information about the Zope3-Checkins mailing list