Commit 477d8bc1 authored by Martijn Pieters's avatar Martijn Pieters

Clean up indentation and trailing whitespace.

As the 'if 1:' block for diff preservation was heavily tabbed anyway, I
removed an indent level and the 'if 1:' statement.
parent 4ba09362
This diff is collapsed.
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
__doc__="""Cacheable object and cache management base classes.
$Id: Cache.py,v 1.9 2002/02/07 17:20:59 andreasjung Exp $"""
$Id: Cache.py,v 1.10 2002/08/14 21:42:56 mj Exp $"""
__version__='$Revision: 1.9 $'[11:-2]
__version__='$Revision: 1.10 $'[11:-2]
import time, sys
import Globals
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
__doc__="""Copy interface"""
__version__='$Revision: 1.81 $'[11:-2]
__version__='$Revision: 1.82 $'[11:-2]
import sys, Globals, Moniker, tempfile, ExtensionClass
from marshal import loads, dumps
......@@ -77,7 +77,7 @@ class CopyContainer(ExtensionClass.Base):
REQUEST['__cp'] = cp
return self.manage_main(self, REQUEST)
return cp
def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None):
"""Put a reference to the objects named in ids in the clip board"""
if ids is None and REQUEST is not None:
......@@ -130,7 +130,7 @@ class CopyContainer(ExtensionClass.Base):
cp=REQUEST['__cp']
if cp is None:
raise CopyError, eNoData
try: cp=_cb_decode(cp)
except: raise CopyError, eInvalid
......@@ -186,7 +186,7 @@ class CopyContainer(ExtensionClass.Base):
# try to make ownership explicit so that it gets carried
# along to the new location if needed.
ob.manage_changeOwnershipType(explicit=1)
aq_parent(aq_inner(ob))._delObject(id)
ob = aq_base(ob)
orig_id=id
......@@ -232,7 +232,7 @@ class CopyContainer(ExtensionClass.Base):
action ='manage_main')
ob=self._getOb(id)
if not ob.cb_isMoveable():
raise CopyError, eNotSupported % id
raise CopyError, eNotSupported % id
self._verifyObjectPaste(ob)
try: ob._notifyOfCopyTo(self, op=1)
except: raise CopyError, MessageDialog(
......@@ -242,7 +242,7 @@ class CopyContainer(ExtensionClass.Base):
self._delObject(id)
ob = aq_base(ob)
ob._setId(new_id)
# Note - because a rename always keeps the same context, we
# can just leave the ownership info unchanged.
self._setObject(new_id, ob, set_owner=0)
......@@ -308,7 +308,7 @@ class CopyContainer(ExtensionClass.Base):
#
# Passing a false value for the validate_src argument will skip
# checking the passed in object in its existing context. This is
# mainly useful for situations where the passed in object has no
# mainly useful for situations where the passed in object has no
# existing context, such as checking an object during an import
# (the object will not yet have been connected to the acquisition
# heirarchy).
......@@ -390,7 +390,7 @@ class CopySource(ExtensionClass.Base):
__ac_permissions__=(
('Copy or Move', (), ('Anonymous', 'Manager',)),
)
def _canCopy(self, op=0):
"""Called to make sure this object is copyable. The op var
is 0 for a copy, 1 for a move."""
......@@ -430,7 +430,7 @@ class CopySource(ExtensionClass.Base):
# Called after the copy is finished to accomodate special cases.
# The op var is 0 for a copy, 1 for a move.
pass
def _setId(self, id):
# Called to set the new id of a copied object.
self.id=id
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""DTML Document objects."""
__version__='$Revision: 1.47 $'[11:-2]
__version__='$Revision: 1.48 $'[11:-2]
from ZPublisher.Converters import type_converters
from Globals import HTML, DTMLFile, MessageDialog
......@@ -87,12 +87,12 @@ class DTMLDocument(PropertyManager, DTMLMethod):
if self.wl_isLocked():
raise ResourceLockedError, (
'This document has been locked via WebDAV.')
if type(file) is not type(''):
if REQUEST and not file:
if type(file) is not type(''):
if REQUEST and not file:
raise ValueError, 'No file specified'
file=file.read()
self.munge(file)
self.ZCacheable_invalidate()
if REQUEST:
......@@ -114,7 +114,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
if hasattr(self, 'aq_explicit'):
bself=self.aq_explicit
else: bself=self
security=getSecurityManager()
security.addContext(self)
......@@ -178,5 +178,3 @@ def addDTMLDocument(self, id, title='', file='', REQUEST=None, submit=None):
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.78 $'[11:-2]
__version__='$Revision: 1.79 $'[11:-2]
import History
from Globals import HTML, DTMLFile, MessageDialog
......@@ -101,7 +101,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
if data is not _marker:
# Return cached results.
return data
kw['document_id'] =self.getId()
kw['document_title']=self.title
......@@ -113,7 +113,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
self.__dict__['validate'] = security.DTMLValidate
first_time_through = 1
try:
if client is None:
# Called as subtemplate, so don't need error propagation!
r=apply(HTML.__call__, (self, client, REQUEST), kw)
......@@ -179,7 +179,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
Returns the cacheNamespaceKeys.
'''
return self._cache_namespace_keys
def setCacheNamespaceKeys(self, keys, REQUEST=None):
'''
Sets the list of names that should be looked up in the
......@@ -220,14 +220,14 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
dr,dc = self._size_changes[SUBMIT]
rows=str(max(1,int(dtpref_rows)+dr))
if dtpref_cols[-1]=='%':
cols= str(min(100, max(25,int(dtpref_cols[:-1])+dc)))+'%'
else:
cols=str(max(35,int(dtpref_cols)+dc))
e=(DateTime('GMT') + 365).rfc822()
resp=REQUEST['RESPONSE']
resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
......@@ -267,11 +267,11 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
if self.wl_isLocked():
raise ResourceLockedError, 'This DTML Method is locked via WebDAV'
if type(file) is not type(''):
if REQUEST and not file:
if type(file) is not type(''):
if REQUEST and not file:
raise ValueError, 'No file specified'
file=file.read()
self.munge(file)
self.ZCacheable_invalidate()
if REQUEST:
......@@ -297,7 +297,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
raise 'Forbidden', (
'You are not authorized to change <em>%s</em> because you '
'do not have proxy roles.\n<!--%s, %s-->' % (self.__name__, u, roles))
def manage_proxy(self, roles=(), REQUEST=None):
"Change Proxy Roles"
......@@ -368,11 +368,11 @@ def decapitate(html, RESPONSE=None):
headers.append(header)
spos = m.end() + 1
while spos < len(html) and html[spos] in ' \t':
eol = find(html, '\r\n', spos)
eol = find(html, '\r\n', spos)
if eol <> -1:
eolen = 2
else:
eol = find(html, '\n', spos)
eol = find(html, '\n', spos)
if eol < 0: return html
eolen = 1
header.append(strip(html[spos:eol]))
......@@ -387,7 +387,7 @@ def decapitate(html, RESPONSE=None):
default_dm_html="""<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<p>
This is the <dtml-var document_id> Document
This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.
</p>
<dtml-var standard_html_footer>"""
......@@ -411,4 +411,3 @@ def addDTMLMethod(self, id, title='', file='', REQUEST=None, submit=None):
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
__doc__="""Implement Observable interface (see
http://www.zope.org/Members/michel/Projects/Interfaces/ObserverAndNotification)
This class is intended to be used as a mixin (note that it doesn't derive
from any Zope persistence classes, for instance).
$Id: DefaultObservable.py,v 1.5 2002/02/07 17:20:59 andreasjung Exp $"""
$Id: DefaultObservable.py,v 1.6 2002/08/14 21:42:56 mj Exp $"""
__version__='$Revision: 1.5 $'[11:-2]
__version__='$Revision: 1.6 $'[11:-2]
from types import StringType
......@@ -57,12 +57,12 @@ http://www.zope.org/Members/michel/Projects/Interfaces/ObserverAndNotification
def __init__( self, debug=0 ):
self._observers = []
self._debug = debug
def _normalize( self, observer ):
# Assert that observer is a string or a sequence of strings.
if type( observer ) != StringType:
observer = '/'.join( observer)
observer = '/'.join( observer)
return observer
......@@ -102,13 +102,13 @@ http://www.zope.org/Members/michel/Projects/Interfaces/ObserverAndNotification
traceback.print_exc()
else:
bozos.append( observer )
for bozo in bozos:
try: # avoid race condition if unregister() called before now
self._observers.remove( bozo )
except:
pass
#
# Unit tests
......@@ -117,7 +117,7 @@ http://www.zope.org/Members/michel/Projects/Interfaces/ObserverAndNotification
if __name__ == '__main__':
class DontGoHere( Exception ): pass
class TestSubject( DefaultObservable ):
def __init__( self, paths ):
......@@ -134,29 +134,29 @@ if __name__ == '__main__':
if cbrec is None:
cbrec = callbacks[ name ] = []
cbrec.append( ( subject, event ) )
class TestObserver:
def __call__( self, subject, event ):
recordCallback( 'direct', subject, event )
def namedCallback( self, subject, event ):
recordCallback( 'named', subject, event )
def named2Callback( self, subject, event ):
recordCallback( 'named2', subject, event )
def boundCallback( self, subject, event ):
recordCallback( 'bound', subject, event )
def freefuncObserver( subject, event ):
recordCallback( 'freefunc', subject, event )
recordCallback( 'freefunc', subject, event )
def tryVeto( subject, event ):
""" Simulate attempted veto. """
raise 'Idawanna!'
observer = TestObserver()
# Simulate Zope's path traversal mechanism.
......@@ -204,4 +204,3 @@ if __name__ == '__main__':
print '[%s]' % key
for cb in callbacks[ key ]:
print ' %s' % `cb`
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Deprecated - use DTMLMethod"""
__version__='$Revision: 1.75 $'[11:-2]
__version__='$Revision: 1.76 $'[11:-2]
import DTMLMethod
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""FTP Support for Zope classes.
......@@ -23,11 +23,11 @@ All FTP methods should be governed by a single permission:
class FTPInterface:
"Interface for FTP objects"
# XXX The stat and list marshal format should probably
# be XML, not marshal, maybe Andrew K's xml-marshal.
# This will probably be changed later.
def manage_FTPstat(self,REQUEST):
"""Returns a stat-like tuple. (marshalled to a string) Used by
FTP for directory listings, and MDTM and SIZE"""
......@@ -37,13 +37,13 @@ class FTPInterface:
(id,stat) tuples, marshaled to a string. Note, the listing it
should include '..' if there is a Folder above the current
one.
In the case of non-foldoid objects it should return a single
tuple (id,stat) representing itself."""
# Optional method to support FTP download.
# Should not be implemented by Foldoid objects.
def manage_FTPget(self):
"""Returns the source content of an object. For example, the
source text of a Document, or the data of a file."""
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
__doc__="""Find support"""
__version__='$Revision: 1.30 $'[11:-2]
__version__='$Revision: 1.31 $'[11:-2]
import sys, os, time, Globals, ExtensionClass
......@@ -42,10 +42,10 @@ class FindSupport(ExtensionClass.Base):
('manage_findFrame', 'manage_findForm', 'manage_findAdv',
'manage_findResult')),
)
manage_options=(
{'label':'Find', 'action':'manage_findForm',
'help':('OFSP','Find.stx')},
{'label':'Find', 'action':'manage_findForm',
'help':('OFSP','Find.stx')},
)
def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None,
......@@ -61,7 +61,7 @@ class FindSupport(ExtensionClass.Base):
if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None
if obj_mtime and type(obj_mtime)==type('s'):
obj_mtime=DateTime(obj_mtime).timeTime()
......@@ -70,7 +70,7 @@ class FindSupport(ExtensionClass.Base):
if obj_roles and type(obj_roles) is type('s'):
obj_roles=[obj_roles]
if obj_expr:
# Setup expr machinations
md=td()
......@@ -97,7 +97,7 @@ class FindSupport(ExtensionClass.Base):
for id, ob in items:
if pre: p="%s/%s" % (pre, id)
else: p=id
dflag=0
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
......@@ -148,9 +148,9 @@ class FindSupport(ExtensionClass.Base):
PrincipiaFind=ZopeFind
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None,
......@@ -165,7 +165,7 @@ class FindSupport(ExtensionClass.Base):
if obj_metatypes and 'all' in obj_metatypes:
obj_metatypes=None
if obj_mtime and type(obj_mtime)==type('s'):
obj_mtime=DateTime(obj_mtime).timeTime()
......@@ -174,7 +174,7 @@ class FindSupport(ExtensionClass.Base):
if obj_roles and type(obj_roles) is type('s'):
obj_roles=[obj_roles]
if obj_expr:
# Setup expr machinations
md=td()
......@@ -196,7 +196,7 @@ class FindSupport(ExtensionClass.Base):
for id, ob in items:
if pre: p="%s/%s" % (pre, id)
else: p=id
dflag=0
if hasattr(ob, '_p_changed') and (ob._p_changed == None):
dflag=1
......@@ -229,7 +229,7 @@ class FindSupport(ExtensionClass.Base):
else:
add_result((p, ob))
dflag=0
if search_sub and hasattr(bs, 'objectItems'):
self.ZopeFindAndApply(ob, obj_ids, obj_metatypes,
obj_searchterm, obj_expr,
......@@ -261,14 +261,14 @@ def expr_match(ob, ed, c=InstanceDict, r=0):
def mtime_match(ob, t, q, fn=hasattr):
if not fn(ob, '_p_mtime'):
return 0
return 0
return q=='<' and (ob._p_mtime < t) or (ob._p_mtime > t)
def role_match(ob, permission, roles, lt=type([]), tt=type(())):
pr=[]
fn=pr.append
while 1:
if hasattr(ob, permission):
p=getattr(ob, permission)
......@@ -307,5 +307,3 @@ def absattr(attr):
def p_name(name):
return '_' + translate(name, name_trans) + '_Permission'
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Folder object
Folders are the basic container objects and are analogous to directories.
$Id: Folder.py,v 1.100 2002/06/07 18:10:31 caseman Exp $"""
$Id: Folder.py,v 1.101 2002/08/14 21:42:56 mj Exp $"""
__version__='$Revision: 1.100 $'[11:-2]
__version__='$Revision: 1.101 $'[11:-2]
import Globals, SimpleItem, ObjectManager, PropertyManager
import AccessControl.Role, webdav.Collection, FindSupport
......@@ -46,7 +46,7 @@ def manage_addFolder(self, id, title='',
self._setObject(id, ob)
ob=self._getOb(id)
checkPermission=getSecurityManager().checkPermission
checkPermission=getSecurityManager().checkPermission
if createUserF:
if not checkPermission('Add User Folders', ob):
......@@ -61,7 +61,7 @@ def manage_addFolder(self, id, title='',
'You are not authorized to add Page Templates.'
)
ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(
id='index_html', title='')
id='index_html', title='')
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Object Histories"""
__version__='$Revision: 1.13 $'[11:-2]
__version__='$Revision: 1.14 $'[11:-2]
import Globals, ExtensionClass, difflib
from DateTime import DateTime
......@@ -92,7 +92,7 @@ class Historical(ExtensionClass.Base):
)
),
)
manage_options=({'label':'History', 'action':'manage_change_history_page',
'help':('OFSP','History.stx')
},
......@@ -110,7 +110,7 @@ class Historical(ExtensionClass.Base):
if request is not None:
first=request.get('first_transaction', first)
last=request.get('last_transaction',last)
r=self._p_jar.db().history(self._p_oid, None, last)
r=r[first:]
......@@ -146,7 +146,7 @@ class Historical(ExtensionClass.Base):
base._p_deactivate()
base.__setstate__(state)
base._p_changed=1
self.manage_afterHistoryCopy()
if RESPONSE is not None and URL1 is not None:
......@@ -154,7 +154,7 @@ class Historical(ExtensionClass.Base):
def manage_afterHistoryCopy(self): pass # ? (Hook)
_manage_historyComparePage=Globals.DTMLFile(
'dtml/historyCompare', globals(), management_view='History')
def manage_historyCompare(self, rev1, rev2, REQUEST,
......@@ -174,10 +174,10 @@ class Historical(ExtensionClass.Base):
if len(keys) > 2:
raise HistorySelectionError, (
"Only two historical revision can be compared<p>")
serial=apply(pack, ('>HHHH',)+tuple(map(int, keys[-1].split('.'))))
rev1=historicalRevision(self, serial)
if len(keys)==2:
serial=apply(pack,
('>HHHH',)+tuple(map(int, keys[0].split('.'))))
......@@ -187,7 +187,7 @@ class Historical(ExtensionClass.Base):
rev2=self
return self.manage_historyCompare(rev1, rev2, REQUEST)
Globals.default__class_init__(Historical)
def dump(tag, x, lo, hi, r):
......
This diff is collapsed.
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Object monikers
......@@ -18,7 +18,7 @@
and aquisition relationships via a simple interface.
"""
__version__='$Revision: 1.15 $'[11:-2]
__version__='$Revision: 1.16 $'[11:-2]
import Globals
......@@ -28,7 +28,7 @@ class Moniker:
persistent object. A moniker can be turned back into
a real object that retains its correct version context
and acquisition relationships via a simple interface."""
def __init__(self, ob=None):
if ob is None: return
self.idpath = ob.getPhysicalPath()
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
__doc__="""Object Manager
$Id: ObjectManager.py,v 1.157 2002/08/14 19:59:18 mj Exp $"""
$Id: ObjectManager.py,v 1.158 2002/08/14 21:42:56 mj Exp $"""
__version__='$Revision: 1.157 $'[11:-2]
__version__='$Revision: 1.158 $'[11:-2]
import App.Management, Acquisition, Globals, CopySupport, Products
import os, App.FactoryDispatcher, re, Products
......@@ -102,7 +102,7 @@ class ObjectManager(
):
"""Generic object manager
This class provides core behavior for collections of heterogeneous objects.
This class provides core behavior for collections of heterogeneous objects.
"""
__ac_permissions__=(
......@@ -123,7 +123,7 @@ class ObjectManager(
meta_type ='Object Manager'
meta_types=() # Sub-object types that are specific to this object
_objects =()
manage_main=DTMLFile('dtml/main', globals())
......@@ -148,7 +148,7 @@ class ObjectManager(
except: pass
mt.sort()
self.meta_types=tuple(mt)
default__class_init__(self)
def all_meta_types(self, interfaces=None):
......@@ -179,11 +179,11 @@ class ObjectManager(
eil = entry.get('interfaces',None)
if eil is not None:
for ei in eil:
for i in interfaces:
for i in interfaces:
if ei is i or ei.extends(i):
interface_constrained_meta_types.append(entry)
interface_constrained_meta_types.append(entry)
raise BreakoutException # only append 1ce
except BreakoutException:
except BreakoutException:
pass
# Meta types specified by this instance are not checked against the
......@@ -316,7 +316,7 @@ class ObjectManager(
self._objects=tuple(filter(lambda i,n=id: i['id']!=n, self._objects))
self._delOb(id)
# Indicate to the object that it has been deleted. This is
# Indicate to the object that it has been deleted. This is
# necessary for object DB mount points. Note that we have to
# tolerate failure here because the object being deleted could
# be a Broken object, and it is not possible to set attributes
......@@ -410,7 +410,7 @@ class ObjectManager(
vals.append(get(id))
seen[physicalPath]=1
except: pass
if hasattr(obj,'aq_parent'):
obj=obj.aq_parent
relativePhysicalPath = ('..',) + relativePhysicalPath
......@@ -424,7 +424,7 @@ class ObjectManager(
def manage_delObjects(self, ids=[], REQUEST=None):
"""Delete a subordinate object
The objects specified in 'ids' get deleted.
"""
if type(ids) is type(''): ids=[ids]
......@@ -447,7 +447,7 @@ class ObjectManager(
self._delObject(id)
del ids[-1]
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
return self.manage_main(self, REQUEST, update_menu=1)
def tpValues(self):
......@@ -475,7 +475,7 @@ class ObjectManager(
def manage_exportObject(self, id='', download=None, toxml=None,
RESPONSE=None,REQUEST=None):
"""Exports an object to a file and returns that file."""
"""Exports an object to a file and returns that file."""
if not id:
# can't use getId() here (breaks on "old" exported objects)
id=self.id
......@@ -484,7 +484,7 @@ class ObjectManager(
else: ob=self._getOb(id)
suffix=toxml and 'xml' or 'zexp'
if download:
f=StringIO()
if toxml: XMLExportImport.exportXML(ob._p_jar, ob._p_oid, f)
......@@ -502,7 +502,7 @@ class ObjectManager(
ob._p_jar.exportFile(ob._p_oid, f)
if REQUEST is not None:
return self.manage_main(self, REQUEST,
return self.manage_main(self, REQUEST,
manage_tabs_message=
'<em>%s</em> sucessfully exported to <em>%s</em>' % (id,f),
title = 'Object exported')
......@@ -518,7 +518,7 @@ class ObjectManager(
instance_home = INSTANCE_HOME
zope_home = ZOPE_HOME
for impath in (instance_home, zope_home):
filepath = os.path.join(impath, 'import', file)
if os.path.exists(filepath):
......@@ -528,9 +528,9 @@ class ObjectManager(
self._importObjectFromFile(filepath, verify=not not REQUEST,
set_owner=set_owner)
if REQUEST is not None:
return self.manage_main(self, REQUEST,
return self.manage_main(self, REQUEST,
manage_tabs_message='<em>%s</em> sucessfully imported' % id,
title = 'Object imported',
update_menu=1)
......@@ -556,7 +556,7 @@ class ObjectManager(
ob.manage_changeOwnershipType(explicit=0)
# FTP support methods
def manage_FTPlist(self, REQUEST):
"Directory listing for FTP"
out=()
......@@ -569,7 +569,7 @@ class ObjectManager(
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
files=self.objectItems()
# recursive ride through all subfolders (ls -R) (ajung)
......@@ -582,7 +582,7 @@ class ObjectManager(
all_files.extend(findChilds(f[1]))
else:
all_files.append(f)
files = all_files
try:
......@@ -592,7 +592,7 @@ class ObjectManager(
files.sort()
# Perform globbing on list of files (ajung)
globbing = REQUEST.environ.get('GLOBBING','')
if globbing :
files = filter(lambda x,g=globbing: fnmatch.fnmatch(x[0],g) , files)
......@@ -602,7 +602,7 @@ class ObjectManager(
except AttributeError:
files=list(files)
files.sort()
if not (hasattr(self,'isTopLevelPrincipiaApplicationObject') and
self.isTopLevelPrincipiaApplicationObject):
files.insert(0,('..',self.aq_parent))
......@@ -614,7 +614,7 @@ class ObjectManager(
except: stat=None
if stat is not None:
out=out+((k,stat),)
return marshal.dumps(out)
return marshal.dumps(out)
def manage_FTPstat(self,REQUEST):
"Psuedo stat used for FTP listings"
......
##############################################################################
#
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
......@@ -8,11 +8,11 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
#
##############################################################################
"""Property management"""
__version__='$Revision: 1.45 $'[11:-2]
__version__='$Revision: 1.46 $'[11:-2]
import ExtensionClass, Globals
import ZDOM
......@@ -90,9 +90,9 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
manage_options=(
{'label':'Properties', 'action':'manage_propertiesForm',
'help':('OFSP','Properties.stx')},
'help':('OFSP','Properties.stx')},
)
manage_propertiesForm=DTMLFile('dtml/properties', globals(),
property_extensible_schema__=1)
manage_propertyTypeForm=DTMLFile('dtml/propertyType', globals())
......@@ -134,7 +134,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
return 0
def getProperty(self, id, d=None):
"""Get the property 'id', returning the optional second
"""Get the property 'id', returning the optional second
argument or None if no such property is found."""
if self.hasProperty(id):
return getattr(self, id)
......@@ -165,7 +165,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
# for selection and multiple selection properties
# the value argument indicates the select variable
# of the property
self._wrapperCheck(value)
if not self.valid_property_id(id):
raise 'Bad Request', 'Invalid or duplicate property id'
......@@ -213,7 +213,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
def propertyItems(self):
"""Return a list of (id,property) tuples """
return map(lambda i,s=self: (i['id'],getattr(s,i['id'])),
return map(lambda i,s=self: (i['id'],getattr(s,i['id'])),
self._properties)
def _propertyMap(self):
"""Return a tuple of mappings, giving meta-data for properties """
......@@ -289,7 +289,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
return self.manage_propertiesForm(self,REQUEST,manage_tabs_message=message)
# Note - this is experimental, pending some community input.
def manage_changePropertyTypes(self, old_ids, props, REQUEST=None):
"""Replace one set of properties with another
......@@ -307,7 +307,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
self._setProperty(prop.new_id, prop.new_value, prop.new_type)
if REQUEST is not None:
return self.manage_propertiesForm(self, REQUEST)
def manage_delProperties(self, ids=None, REQUEST=None):
"""Delete one or more properties specified by 'ids'."""
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Property sheets"""
__version__='$Revision: 1.86 $'[11:-2]
__version__='$Revision: 1.87 $'[11:-2]
import time, App.Management, Globals
from webdav.WriteLockInterface import WriteLockInterface
......@@ -43,7 +43,7 @@ class View(App.Management.Tabs, Base):
RESPONSE.redirect(URL1+'/manage')
def tpURL(self): return self.getId()
def manage_options(self):
"""Return a manage option data structure for me instance
"""
......@@ -58,7 +58,7 @@ class View(App.Management.Tabs, Base):
if l >= 0:
pre=pre[:l]
pre=pre+'/'
r=[]
for d in self.aq_parent.aq_parent.manage_options:
path=d['action']
......@@ -109,7 +109,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
),
)
__reserved_ids= ('values','items')
__reserved_ids= ('values','items')
def property_extensible_schema__(self):
"""Return a flag indicating whether new properties may be
......@@ -195,7 +195,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
if hasattr(aq_base(self),id):
if not (id=='title' and not self.__dict__.has_key(id)):
raise 'Bad Request', (
'Invalid property id, <em>%s</em>. It is in use.' %
'Invalid property id, <em>%s</em>. It is in use.' %
escape(id))
if meta is None: meta={}
prop={'id':id, 'type':type, 'meta':meta}
......@@ -261,7 +261,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
def propertyItems(self):
# Return a list of (id, property) tuples.
return map(lambda i, s=self: (i['id'], s.getProperty(i['id'])),
return map(lambda i, s=self: (i['id'], s.getProperty(i['id'])),
self._propertyMap())
def propertyInfo(self, id):
......@@ -316,7 +316,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
attrs=''.join(attrs)
else:
# Quote non-xml items here?
attrs=''
attrs=''
if hasattr(self,"dav__"+name):
prop=' <n:%s%s>%s</n:%s>' % (name, attrs, value, name)
......@@ -326,7 +326,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
result.append(prop)
if not result: return ''
result='\n'.join(result)
return propstat % (self.xml_namespace(), result, '200 OK', '')
def dav__propnames(self, propstat=propstat):
......@@ -375,7 +375,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
if not result.has_key(code):
result[code]=[prop]
else: result[code].append(prop)
return
return
del propstat
......@@ -383,7 +383,7 @@ class PropertySheet(Traversable, Persistent, Implicit):
# Web interface
manage=DTMLFile('dtml/properties', globals())
def manage_propertiesForm(self, URL1):
" "
......@@ -456,7 +456,7 @@ class Virtual:
def __init__(self):
pass
def v_self(self):
return self.aq_parent.aq_parent
......@@ -485,7 +485,7 @@ class DAVProperties(Virtual, PropertySheet, View):
{'id':'supportedlock', 'mode':'r'},
{'id':'lockdiscovery', 'mode':'r'},
)
def getProperty(self, id, default=None):
method='dav__%s' % id
if not hasattr(self, method):
......@@ -506,10 +506,10 @@ class DAVProperties(Virtual, PropertySheet, View):
if hasattr(self.v_self(), '_p_mtime'):
return self.pm + ({'id':'getlastmodified', 'mode':'r'},)
return self.pm
def propertyMap(self):
return map(lambda dict: dict.copy(), self._propertyMap())
def dav__creationdate(self):
return iso8601_date(43200.0)
......@@ -518,7 +518,7 @@ class DAVProperties(Virtual, PropertySheet, View):
def dav__resourcetype(self):
vself=self.v_self()
if (isDavCollection(vself) or
if (isDavCollection(vself) or
getattr(aq_base(vself), 'isAnObjectManager', None)):
return '<n:collection/>'
return ''
......@@ -559,7 +559,7 @@ class DAVProperties(Virtual, PropertySheet, View):
def dav__lockdiscovery(self):
security = getSecurityManager()
user = security.getUser().getUserName()
vself = self.v_self()
out = '\n'
......@@ -570,9 +570,9 @@ class DAVProperties(Virtual, PropertySheet, View):
creator = lock.getCreator()[-1]
if creator == user: fake=0
else: fake=1
out = '%s\n%s' % (out, lock.asLockDiscoveryProperty('n',fake=fake))
out = '%s\n' % out
return out
......@@ -584,7 +584,7 @@ Globals.default__class_init__(DAVProperties)
class PropertySheets(Traversable, Implicit, App.Management.Tabs):
"""A tricky container to keep property sets from polluting
an object's direct attribute namespace."""
id='propertysheets'
__ac_permissions__=(
......@@ -603,7 +603,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
webdav =DAVProperties()
def _get_defaults(self):
return (self.webdav,)
def __propsets__(self):
propsets=self.aq_parent.__propsets__
__traceback_info__= propsets, type(propsets)
......@@ -631,7 +631,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
r.append((id, n.__of__(self)))
return r
def get(self, name, default=None):
for propset in self.__propsets__():
if propset.id==name or (hasattr(propset, 'xml_namespace') and \
......@@ -657,7 +657,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
if propset.getId() != name and propset.xml_namespace() != name:
result.append(propset)
self.parent.__propsets__=tuple(result)
def __len__(self):
return len(self.__propsets__())
......@@ -683,7 +683,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
if l >= 0:
pre=pre[:l]
pre=pre+'/'
r=[]
for d in self.aq_parent.manage_options:
r.append({'label': d['label'], 'action': pre+d['action']})
......@@ -734,7 +734,7 @@ class FixedSchema(PropertySheet):
if 'd' in mode:
d['mode']=filter(lambda c: c != 'd', mode)
r.append(d)
return tuple(r)
def propertyMap(self):
......@@ -745,7 +745,7 @@ class FixedSchema(PropertySheet):
return self._base._extensible
Globals.default__class_init__(FixedSchema)
class vps(Base):
......@@ -757,7 +757,7 @@ class vps(Base):
"""
def __init__(self, c=PropertySheets):
self.c=c
def __of__(self, parent):
return self.c().__of__(parent)
......@@ -771,7 +771,7 @@ def xml_escape(v):
""" convert any content from ISO-8859-1 to UTF-8
The main use is to escape non-US object property values
(e.g. containing accented characters). Also we convert "<" and ">"
to entities to keep the properties XML compliant.
to entities to keep the properties XML compliant.
"""
v = str(v)
v = v.replace('&', '&amp;')
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
'''This module implements a simple item mix-in for objects that have a
very simple (e.g. one-screen) management interface, like documents,
Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
item types.
$Id: SimpleItem.py,v 1.101 2002/06/25 20:52:56 caseman Exp $'''
__version__='$Revision: 1.101 $'[11:-2]
$Id: SimpleItem.py,v 1.102 2002/08/14 21:42:56 mj Exp $'''
__version__='$Revision: 1.102 $'[11:-2]
import re, sys, Globals, App.Management, Acquisition, App.Undo
import AccessControl.Role, AccessControl.Owned, App.Common
......@@ -49,7 +49,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
"""A common base class for simple, non-container objects."""
isPrincipiaFolderish=0
isTopLevelPrincipiaApplicationObject=0
def manage_afterAdd(self, item, container): pass
def manage_beforeDelete(self, item, container): pass
def manage_afterClone(self, item): pass
......@@ -81,17 +81,17 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
# Meta type used for selecting all objects of a given type.
meta_type='simple item'
# Default title.
# Default title.
title=''
# Default propertysheet info:
__propsets__=()
manage_options=(
App.Undo.UndoSupport.manage_options
+AccessControl.Owned.Owned.manage_options
)
# Attributes that must be acquired
REQUEST=Acquisition.Acquired
......@@ -121,7 +121,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
title=title()
id = self.getId()
return title and ("%s (%s)" % (title,id)) or id
def this(self):
# Handy way to talk to ourselves in document templates.
return self
......@@ -147,7 +147,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
try:
if error_type is None: error_type =sys.exc_info()[0]
if error_value is None: error_value=sys.exc_info()[1]
# allow for a few different traceback options
if tb is None and error_tb is None:
tb=sys.exc_info()[2]
......@@ -171,7 +171,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
# Stop if there is recursion.
raise error_type, error_value, tb
self._v_eek=1
if str(error_type).lower() in ('redirect',):
raise error_type, error_value, tb
......@@ -227,7 +227,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
def manage(self, URL1):
" "
raise 'Redirect', "%s/manage_main" % URL1
raise 'Redirect', "%s/manage_main" % URL1
# This keeps simple items from acquiring their parents
# objectValues, etc., when used in simple tree tags.
......@@ -236,14 +236,14 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
objectIds=objectItems=objectValues
# FTP support methods
def manage_FTPstat(self,REQUEST):
"psuedo stat, used by FTP for directory listings"
from AccessControl.User import nobody
mode=0100000
# check read permissions
if (hasattr(aq_base(self),'manage_FTPget') and
if (hasattr(aq_base(self),'manage_FTPget') and
hasattr(self.manage_FTPget, '__roles__')):
try:
if getSecurityManager().validateValue(self.manage_FTPget):
......@@ -252,17 +252,17 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
if nobody.allowed(self.manage_FTPget,
self.manage_FTPget.__roles__):
mode=mode | 0004
# check write permissions
if hasattr(aq_base(self),'PUT') and hasattr(self.PUT, '__roles__'):
try:
if getSecurityManager().validateValue(self.PUT):
mode=mode | 0220
except: pass
if nobody.allowed(self.PUT, self.PUT.__roles__):
mode=mode | 0002
# get size
if hasattr(aq_base(self), 'get_size'):
size=self.get_size()
......@@ -295,7 +295,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
if not hasattr(ob,'aq_parent'):
break
ob=ob.aq_parent
stat=marshal.loads(self.manage_FTPstat(REQUEST))
id = self.getId()
return marshal.dumps((id,stat))
......@@ -331,11 +331,11 @@ class Item_w__name__(Item):
and getPhysicalPath() are designed to operate together.
'''
path = (self.__name__,)
p = aq_parent(aq_inner(self))
if p is not None:
if p is not None:
path = p.getPhysicalPath() + path
return path
......@@ -358,7 +358,7 @@ class SimpleItem(Item, Globals.Persistent,
'action':'manage_access',
'help':('OFSP', 'Security.stx')},
)
__ac_permissions__=(('View', ()),)
def __repr__(self):
......@@ -385,4 +385,3 @@ class SimpleItem(Item, Globals.Persistent,
res += ' used for %s' % context_path
res += '>'
return res
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
'''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.14 2002/02/07 17:20:59 andreasjung Exp $'''
__version__='$Revision: 1.14 $'[11:-2]
$Id: Traversable.py,v 1.15 2002/08/14 21:42:56 mj Exp $'''
__version__='$Revision: 1.15 $'[11:-2]
from Acquisition import Acquired, aq_inner, aq_parent, aq_base
......@@ -57,9 +57,9 @@ class Traversable:
and getPhysicalPath() are designed to operate together.
'''
path = (self.getId(),)
p = aq_parent(aq_inner(self))
if p is not None:
if p is not None:
path = p.getPhysicalPath() + path
return path
......@@ -94,7 +94,7 @@ class Traversable:
self=self.getPhysicalRoot()
if (restricted and not securityManager.validateValue(self)):
raise Unauthorized, name
try:
object = self
while path:
......@@ -127,7 +127,7 @@ class Traversable:
if (not securityManager.validate(object,
container, name, o)):
raise Unauthorized, name
else:
o=get(object, name, M)
if o is not M:
......@@ -142,7 +142,7 @@ class Traversable:
if not securityManager.validate(
object, N, name, o):
raise Unauthorized, name
else:
o=object[name]
if (restricted and not securityManager.validate(
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""
Objects for packages that have been uninstalled.
......@@ -23,7 +23,7 @@ from cgi import escape
broken_klasses={}
broken_klasses_lock = allocate_lock()
class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
Persistence.Overridable):
_p_changed=0
meta_type='Broken Because Product is Gone'
......@@ -47,7 +47,7 @@ class BrokenClass(Acquisition.Explicit, SimpleItem.Item,
manage=manage_main=Globals.DTMLFile('dtml/brokenEdit',globals())
manage_workspace=manage
def Broken(self, oid, pair):
broken_klasses_lock.acquire()
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
import Shared.DC.xml.ppml
ppml=Shared.DC.xml.ppml
......@@ -117,4 +117,3 @@ def importXML(jar, file, clue=''):
r=p.Parse(data)
outfile.seek(0)
return jar.importFile(outfile,clue)
This diff is collapsed.
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""A utility module for content-type handling."""
__version__='$Revision: 1.17 $'[11:-2]
__version__='$Revision: 1.18 $'[11:-2]
import re, mimetypes
......@@ -86,15 +86,14 @@ def guess_content_type(name='', body='', default=None):
if find_binary(body) is not None:
type=default or 'application/octet-stream'
else:
type=(default or text_type(body)
type=(default or text_type(body)
or 'text/x-unknown-content-type')
else:
type=default or 'text/x-unknown-content-type'
type=default or 'text/x-unknown-content-type'
return type.lower(), enc and enc.lower() or None
if __name__=='__main__':
items=mimetypes.types_map.items()
items.sort()
for item in items: print "%s:\t%s" % item
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
from App.ImageFile import ImageFile
......@@ -21,7 +21,7 @@ class misc_:
class p_:
"Shared system information"
__roles__=None
broken=ImageFile('www/broken.gif', globals())
User_icon =ImageFile('AccessControl/www/User_icon.gif')
......
......@@ -14,7 +14,7 @@ Print a human-friendly file difference report to stdout. Both inter-
and intra-line differences are noted. In the second form, recreate file1
(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.
In the first form, if -q ("quiet") is not specified, the first two lines
In the first form, if -q ("quiet") is not specified, the first two lines
of output are
-: file1
......@@ -28,7 +28,7 @@ Each remaining line begins with a two-letter code:
"? " line not present in either input file
Lines beginning with "? " attempt to guide the eye to intraline
differences, and were not present in either input file. These lines can
differences, and were not present in either input file. These lines can
be confusing if the source files contain tab characters.
The first file can be recovered by retaining only lines that begin with
......
##############################################################################
#
# Copyright (c) 2001 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
#
#
##############################################################################
"""Restricted unpickler"""
__version__='$Revision: 1.5 $'[11:-2]
__version__='$Revision: 1.6 $'[11:-2]
import pickle
......@@ -42,5 +42,3 @@ def register(mod, cls, obj):
def unregister(mod, cls):
"""Unregister a class"""
del reg[(mod,cls)]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment