Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
dc241f2a
Commit
dc241f2a
authored
Jun 24, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to use new object management hooks.
parent
152645d3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
124 additions
and
141 deletions
+124
-141
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+9
-11
lib/python/App/Factory.py
lib/python/App/Factory.py
+22
-11
lib/python/App/Product.py
lib/python/App/Product.py
+7
-34
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+17
-16
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+27
-23
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+5
-9
lib/python/Products/OFSP/Draft.py
lib/python/Products/OFSP/Draft.py
+12
-19
lib/python/Products/OFSP/Version.py
lib/python/Products/OFSP/Version.py
+20
-14
lib/python/ZClasses/Property.py
lib/python/ZClasses/Property.py
+5
-4
No files found.
lib/python/AccessControl/User.py
View file @
dc241f2a
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Access control package"""
"""Access control package"""
__version__
=
'$Revision: 1.
79
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
80
$'
[
11
:
-
2
]
import
Globals
,
App
.
Undo
,
socket
,
regex
import
Globals
,
App
.
Undo
,
socket
,
regex
from
Globals
import
HTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
from
Globals
import
HTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
...
@@ -596,17 +596,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
...
@@ -596,17 +596,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def
user_names
(
self
):
def
user_names
(
self
):
return
self
.
getUserNames
()
return
self
.
getUserNames
()
# Copy/Paste support
def
manage_beforeDelete
(
self
,
item
,
container
):
if
item
is
self
:
try
:
del
container
.
__allow_groups__
except
:
pass
def
_notifyOfCopyTo
(
self
,
container
,
op
=
0
):
def
manage_afterAdd
(
self
,
item
,
container
):
if
hasattr
(
container
,
'aq_base'
):
if
item
is
self
:
container
=
container
.
aq_base
if
hasattr
(
self
,
'aq_base'
):
self
=
self
.
aq_base
if
hasattr
(
container
,
'acl_users'
):
container
.
__allow_groups__
=
self
raise
TypeError
,
(
'Target already contains a UserFolder.'
)
def
_postCopy
(
self
,
container
,
op
=
0
):
container
.
__allow_groups__
=
container
.
acl_users
def
_setId
(
self
,
id
):
def
_setId
(
self
,
id
):
if
id
!=
self
.
id
:
if
id
!=
self
.
id
:
...
...
lib/python/App/Factory.py
View file @
dc241f2a
...
@@ -84,10 +84,11 @@
...
@@ -84,10 +84,11 @@
##############################################################################
##############################################################################
__doc__
=
'''Principia Factories
__doc__
=
'''Principia Factories
$Id: Factory.py,v 1.1
0 1999/06/16 14:15:27 brian
Exp $'''
$Id: Factory.py,v 1.1
1 1999/06/24 19:24:55 jim
Exp $'''
__version__
=
'$Revision: 1.1
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
import
OFS.SimpleItem
,
Acquisition
,
Globals
import
OFS.SimpleItem
,
Acquisition
,
Globals
import
Product
class
Factory
(
Globals
.
Persistent
,
Acquisition
.
Implicit
,
OFS
.
SimpleItem
.
Item
):
class
Factory
(
Globals
.
Persistent
,
Acquisition
.
Implicit
,
OFS
.
SimpleItem
.
Item
):
"Model factory meta-data"
"Model factory meta-data"
...
@@ -101,12 +102,13 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
...
@@ -101,12 +102,13 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
{
'label'
:
'Security'
,
'action'
:
'manage_access'
},
{
'label'
:
'Security'
,
'action'
:
'manage_access'
},
)
)
def
__init__
(
self
,
id
,
title
,
object_type
,
initial
,
product
):
def
__init__
(
self
,
id
,
title
,
object_type
,
initial
,
product
=
None
):
self
.
id
=
id
self
.
id
=
id
self
.
title
=
title
self
.
title
=
title
self
.
object_type
=
object_type
self
.
object_type
=
object_type
self
.
initial
=
initial
self
.
initial
=
initial
self
.
__of__
(
product
).
_register
()
if
product
is
not
None
:
self
.
__of__
(
product
).
_register
()
def
manage_edit
(
self
,
title
,
object_type
,
initial
,
REQUEST
=
None
):
def
manage_edit
(
self
,
title
,
object_type
,
initial
,
REQUEST
=
None
):
"Modify factory properties."
"Modify factory properties."
...
@@ -117,13 +119,23 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
...
@@ -117,13 +119,23 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
self
.
_register
()
self
.
_register
()
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
)
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
)
def
_notifyOfCopyTo
(
self
,
container
,
op
=
0
):
def
manage_afterAdd
(
self
,
item
,
container
):
if
container
.
__class__
is
not
Product
:
if
hasattr
(
self
,
'aq_parent'
):
raise
TypeError
,
(
container
=
self
.
aq_parent
'Factories can only be copied to <b>products</b>.'
)
elif
item
is
not
self
:
container
=
None
def
_postCopy
(
self
,
container
,
op
=
0
):
if
getattr
(
container
,
'__class__'
,
None
)
is
Product
.
Product
:
self
.
_register
()
self
.
_register
()
def
manage_beforeDelete
(
self
,
item
,
container
):
if
hasattr
(
self
,
'aq_parent'
):
container
=
self
.
aq_parent
elif
item
is
not
self
:
container
=
None
if
getattr
(
container
,
'__class__'
,
None
)
is
Product
.
Product
:
self
.
_unregister
()
def
_register
(
self
):
def
_register
(
self
):
# Register with the product folder
# Register with the product folder
...
@@ -137,7 +149,6 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
...
@@ -137,7 +149,6 @@ class Factory(Globals.Persistent, Acquisition.Implicit, OFS.SimpleItem.Item):
product
.
aq_acquire
(
'_manage_remove_product_meta_type'
)(
product
.
aq_acquire
(
'_manage_remove_product_meta_type'
)(
product
,
self
.
id
,
self
.
object_type
)
product
,
self
.
id
,
self
.
object_type
)
manage_main
=
Globals
.
HTMLFile
(
'editFactory'
,
globals
())
manage_main
=
Globals
.
HTMLFile
(
'editFactory'
,
globals
())
def
index_html
(
self
,
REQUEST
):
def
index_html
(
self
,
REQUEST
):
...
...
lib/python/App/Product.py
View file @
dc241f2a
...
@@ -111,7 +111,7 @@ from OFS.Folder import Folder
...
@@ -111,7 +111,7 @@ from OFS.Folder import Folder
import
regex
,
zlib
,
Globals
,
cPickle
,
marshal
,
rotor
import
regex
,
zlib
,
Globals
,
cPickle
,
marshal
,
rotor
from
string
import
rfind
,
atoi
,
find
,
strip
,
join
from
string
import
rfind
,
atoi
,
find
,
strip
,
join
from
Factory
import
Factory
from
Factory
import
Factory
import
ZClasses
import
ZClasses
,
ZClasses
.
ZClass
class
ProductFolder
(
Folder
):
class
ProductFolder
(
Folder
):
"Manage a collection of Products"
"Manage a collection of Products"
...
@@ -142,13 +142,6 @@ class ProductFolder(Folder):
...
@@ -142,13 +142,6 @@ class ProductFolder(Folder):
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
def
_delObject
(
self
,
id
):
try
:
for
factory
in
getattr
(
self
,
id
).
_factories
():
factory
.
_unregister
()
except
:
pass
ProductFolder
.
inheritedAttribute
(
'_delObject'
)(
self
,
id
)
def
_canCopy
(
self
,
op
=
0
):
def
_canCopy
(
self
,
op
=
0
):
return
0
return
0
...
@@ -206,39 +199,15 @@ class Product(Folder):
...
@@ -206,39 +199,15 @@ class Product(Folder):
def
manage_addPrincipiaFactory
(
def
manage_addPrincipiaFactory
(
self
,
id
,
title
,
object_type
,
initial
,
REQUEST
=
None
):
self
,
id
,
title
,
object_type
,
initial
,
REQUEST
=
None
):
' '
' '
i
=
Factory
(
id
,
title
,
object_type
,
initial
,
self
)
i
=
Factory
(
id
,
title
,
object_type
,
initial
)
self
.
_setObject
(
id
,
i
)
self
.
_setObject
(
id
,
i
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
def
_delObject
(
self
,
id
,
dp
=
1
):
o
=
getattr
(
self
,
id
)
if
o
.
meta_type
==
Factory
.
meta_type
:
o
.
_unregister
()
Product
.
inheritedAttribute
(
'_delObject'
)(
self
,
id
,
dp
=
1
)
def
__init__
(
self
,
id
,
title
):
def
__init__
(
self
,
id
,
title
):
self
.
id
=
id
self
.
id
=
id
self
.
title
=
title
self
.
title
=
title
def
_notifyOfCopyTo
(
self
,
container
,
op
=
0
):
if
container
.
__class__
is
not
ProductFolder
:
raise
TypeError
,
(
'Products can only be copied to <b>product folders</b>.'
)
def
_postCopy
(
self
,
container
,
op
=
0
):
for
factory
in
self
.
_factories
():
factory
.
_register
()
def
_factories
(
self
):
r
=
[]
append
=
r
.
append
for
o
in
self
.
__dict__
.
values
():
if
hasattr
(
o
,
'meta_type'
)
and
o
.
meta_type
==
Factory
.
meta_type
:
append
(
o
.
__of__
(
self
))
return
r
def
Destination
(
self
):
def
Destination
(
self
):
"Return the destination for factory output"
"Return the destination for factory output"
return
self
return
self
...
@@ -440,8 +409,12 @@ def initializeProduct(productp, name, home, app):
...
@@ -440,8 +409,12 @@ def initializeProduct(productp, name, home, app):
if
old
is
not
None
:
if
old
is
not
None
:
app
.
_manage_remove_product_meta_type
(
product
)
app
.
_manage_remove_product_meta_type
(
product
)
products
.
_delObject
(
name
)
products
.
_delObject
(
name
)
for
id
,
v
in
old
.
objectValues
():
try
:
product
.
_setObject
(
id
,
v
)
except
:
pass
products
.
_setObject
(
name
,
product
)
products
.
_setObject
(
name
,
product
)
product
.
__of__
(
products
).
_postCopy
(
products
)
#
product.__of__(products)._postCopy(products)
product
.
manage_options
=
Folder
.
manage_options
product
.
manage_options
=
Folder
.
manage_options
product
.
icon
=
'p_/InstalledProduct_icon'
product
.
icon
=
'p_/InstalledProduct_icon'
product
.
version
=
fver
product
.
version
=
fver
...
...
lib/python/OFS/CopySupport.py
View file @
dc241f2a
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__doc__
=
"""Copy interface"""
__doc__
=
"""Copy interface"""
__version__
=
'$Revision: 1.3
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
6
$'
[
11
:
-
2
]
import
sys
,
string
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
import
sys
,
string
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
from
marshal
import
loads
,
dumps
from
marshal
import
loads
,
dumps
...
@@ -183,24 +183,25 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -183,24 +183,25 @@ class CopyContainer(ExtensionClass.Base):
try
:
ob
=
m
.
bind
()
try
:
ob
=
m
.
bind
()
except
:
raise
CopyError
,
eNotFound
except
:
raise
CopyError
,
eNotFound
self
.
_verifyObjectPaste
(
ob
,
REQUEST
)
self
.
_verifyObjectPaste
(
ob
,
REQUEST
)
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
op
)
#
try: ob._notifyOfCopyTo(self, op=op)
except
:
raise
CopyError
,
MessageDialog
(
#
except: raise CopyError, MessageDialog(
title
=
'Copy Error'
,
#
title='Copy Error',
message
=
sys
.
exc_value
,
#
message=sys.exc_value,
action
=
'manage_main'
)
#
action ='manage_main')
oblist
.
append
(
ob
)
oblist
.
append
(
ob
)
if
op
==
0
:
if
op
==
0
:
# Copy operation
# Copy operation
for
ob
in
oblist
:
for
ob
in
oblist
:
if
not
ob
.
cb_isCopyable
():
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
absattr
(
ob
.
id
)
raise
CopyError
,
eNotSupported
%
absattr
(
ob
.
id
)
ob
=
ob
.
_getCopy
(
self
)
ob
=
ob
.
_getCopy
(
self
)
ob
.
manage_afterClone
(
ob
)
id
=
_get_id
(
self
,
absattr
(
ob
.
id
))
id
=
_get_id
(
self
,
absattr
(
ob
.
id
))
ob
.
_setId
(
id
)
ob
.
_setId
(
id
)
self
.
_setObject
(
id
,
ob
)
self
.
_setObject
(
id
,
ob
)
ob
=
ob
.
__of__
(
self
)
#
ob=ob.__of__(self)
ob
.
_postCopy
(
self
,
op
=
0
)
#
ob._postCopy(self, op=0)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
,
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
,
...
@@ -218,8 +219,8 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -218,8 +219,8 @@ class CopyContainer(ExtensionClass.Base):
id
=
_get_id
(
self
,
id
)
id
=
_get_id
(
self
,
id
)
ob
.
_setId
(
id
)
ob
.
_setId
(
id
)
self
.
_setObject
(
id
,
ob
)
self
.
_setObject
(
id
,
ob
)
ob
=
ob
.
__of__
(
self
)
#
ob=ob.__of__(self)
ob
.
_postCopy
(
self
,
op
=
1
)
#
ob._postCopy(self, op=1)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
setCookie
(
'cp_'
,
'deleted'
,
REQUEST
[
'RESPONSE'
].
setCookie
(
'cp_'
,
'deleted'
,
...
@@ -251,10 +252,10 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -251,10 +252,10 @@ class CopyContainer(ExtensionClass.Base):
self
.
_delObject
(
id
,
dp
=
0
)
self
.
_delObject
(
id
,
dp
=
0
)
if
hasattr
(
ob
,
'aq_base'
):
if
hasattr
(
ob
,
'aq_base'
):
ob
=
ob
.
aq_base
ob
=
ob
.
aq_base
self
.
_setObject
(
new_id
,
ob
)
ob
=
ob
.
__of__
(
self
)
ob
.
_setId
(
new_id
)
ob
.
_setId
(
new_id
)
ob
.
_postCopy
(
self
,
op
=
1
)
self
.
_setObject
(
new_id
,
ob
)
#ob=ob.__of__(self)
#ob._postCopy(self, op=1)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
None
return
None
...
@@ -282,8 +283,8 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -282,8 +283,8 @@ class CopyContainer(ExtensionClass.Base):
ob
=
ob
.
_getCopy
(
self
)
ob
=
ob
.
_getCopy
(
self
)
ob
.
_setId
(
id
)
ob
.
_setId
(
id
)
self
.
_setObject
(
id
,
ob
)
self
.
_setObject
(
id
,
ob
)
ob
=
ob
.
__of__
(
self
)
#
ob=ob.__of__(self)
ob
.
_postCopy
(
self
,
op
=
0
)
#
ob._postCopy(self, op=0)
return
ob
return
ob
def
cb_dataValid
(
self
):
def
cb_dataValid
(
self
):
...
...
lib/python/OFS/ObjectManager.py
View file @
dc241f2a
...
@@ -84,9 +84,9 @@
...
@@ -84,9 +84,9 @@
##############################################################################
##############################################################################
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.7
3 1999/06/18 00:32:39 amos
Exp $"""
$Id: ObjectManager.py,v 1.7
4 1999/06/24 19:27:16 jim
Exp $"""
__version__
=
'$Revision: 1.7
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
4
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
App
.
Undo
,
Globals
,
CopySupport
import
App.Management
,
Acquisition
,
App
.
Undo
,
Globals
,
CopySupport
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
...
@@ -205,6 +205,8 @@ class ObjectManager(
...
@@ -205,6 +205,8 @@ class ObjectManager(
except
:
t
=
None
except
:
t
=
None
self
.
_objects
=
self
.
_objects
+
({
'id'
:
id
,
'meta_type'
:
t
},)
self
.
_objects
=
self
.
_objects
+
({
'id'
:
id
,
'meta_type'
:
t
},)
self
.
_setOb
(
id
,
object
)
self
.
_setOb
(
id
,
object
)
object
=
self
.
_getOb
(
id
)
object
.
manage_afterAdd
(
object
,
self
)
# Try to give user the local role "Owner".
# Try to give user the local role "Owner".
if
hasattr
(
self
,
'REQUEST'
)
and
hasattr
(
object
,
'__ac_local_roles__'
):
if
hasattr
(
self
,
'REQUEST'
)
and
hasattr
(
object
,
'__ac_local_roles__'
):
user
=
self
.
REQUEST
[
'AUTHENTICATED_USER'
]
user
=
self
.
REQUEST
[
'AUTHENTICATED_USER'
]
...
@@ -213,28 +215,30 @@ class ObjectManager(
...
@@ -213,28 +215,30 @@ class ObjectManager(
object
.
manage_setLocalRoles
(
name
,
[
'Owner'
])
object
.
manage_setLocalRoles
(
name
,
[
'Owner'
])
return
id
return
id
def
manage_afterAdd
(
self
,
item
,
container
):
for
object
in
self
.
objectValues
():
try
:
s
=
object
.
_p_changed
except
:
s
=
0
object
.
manage_afterAdd
(
item
,
container
)
if
s
is
None
:
object
.
_p_deactivate
()
def
manage_afterClone
(
self
,
item
):
for
object
in
self
.
objectValues
():
try
:
s
=
object
.
_p_changed
except
:
s
=
0
object
.
manage_afterClone
(
item
)
if
s
is
None
:
object
.
_p_deactivate
()
def
manage_beforeDelete
(
self
,
item
,
container
):
for
object
in
self
.
objectValues
():
try
:
s
=
object
.
_p_changed
except
:
s
=
0
object
.
manage_beforeDelete
(
item
,
container
)
if
s
is
None
:
object
.
_p_deactivate
()
def
_delObject
(
self
,
id
,
dp
=
1
):
def
_delObject
(
self
,
id
,
dp
=
1
):
if
id
==
'acl_users'
:
object
=
self
.
_getOb
(
id
)
# Yikes - acl_users is referred to by two names and
object
.
manage_beforeDelete
(
object
,
self
)
# must be treated as a special case! Only get rid of
# __allow_groups__ if it is an instance attribute, to
# avoid deleting the class-default __allow_groups__
# in the top-level application object which is needed
# to allow people to replace the top-level userfolder.
if
hasattr
(
self
,
'__allow_groups__'
)
and
\
self
.
__dict__
.
has_key
(
'__allow_groups__'
):
delattr
(
self
,
'__allow_groups__'
)
# Deletion protocol - when an object is being deleted,
# attempt to call it's _on_delete_object method if
# if has one. The dp flag allows allows callers to
# avoid having the delete protocol triggered (for
# instance when an object is cut and pasted).
if
dp
:
ob
=
self
.
_getOb
(
id
)
if
hasattr
(
ob
,
'_on_delete_object'
)
and
\
callable
(
ob
.
_on_delete_object
):
ob
.
_on_delete_object
()
del
ob
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
self
.
_delOb
(
id
)
self
.
_delOb
(
id
)
...
...
lib/python/OFS/SimpleItem.py
View file @
dc241f2a
...
@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
...
@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
This module can also be used as a simple template for implementing new
item types.
item types.
$Id: SimpleItem.py,v 1.5
8 1999/06/23 15:27:01
jim Exp $'''
$Id: SimpleItem.py,v 1.5
9 1999/06/24 19:27:25
jim Exp $'''
__version__
=
'$Revision: 1.5
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
9
$'
[
11
:
-
2
]
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
from
webdav.Resource
import
Resource
from
webdav.Resource
import
Resource
...
@@ -111,13 +111,9 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
...
@@ -111,13 +111,9 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
isPrincipiaFolderish
=
0
isPrincipiaFolderish
=
0
isTopLevelPrincipiaApplicationObject
=
0
isTopLevelPrincipiaApplicationObject
=
0
def
manage_afterAdd
(
self
,
item
,
container
):
pass
def
manage_beforeDelete
(
self
,
item
,
container
):
pass
# HACK HACK HACK -- TAKE THIS OUT LATER!!!!
def
manage_afterClone
(
self
,
item
):
pass
def
_on_delete_object
(
self
):
if
hasattr
(
self
,
'onDeleteObject'
)
and
\
callable
(
self
.
onDeleteObject
):
self
.
onDeleteObject
()
# The name of this object and the name used to traverse to thie
# The name of this object and the name used to traverse to thie
# object in a URL:
# object in a URL:
...
...
lib/python/Products/OFSP/Draft.py
View file @
dc241f2a
...
@@ -207,25 +207,18 @@ class Draft(Persistent, Implicit, SimpleItem.Item):
...
@@ -207,25 +207,18 @@ class Draft(Persistent, Implicit, SimpleItem.Item):
if
REQUEST
:
if
REQUEST
:
REQUEST
[
'RESPONSE'
].
redirect
(
REQUEST
[
'URL2'
]
+
'/manage_main'
)
REQUEST
[
'RESPONSE'
].
redirect
(
REQUEST
[
'URL2'
]
+
'/manage_main'
)
def
_notifyOfCopyTo
(
self
,
container
,
isMove
=
0
):
def
manage_afterClone
(
self
,
item
):
if
isMove
and
self
.
nonempty
():
self
.
_version
=
''
raise
'Copy Error'
,
(
"You cannot copy a %s object with <b>unapproved</b> changes.
\
n
"
def
manage_afterAdd
(
self
,
item
,
container
):
"You must <b>approve</b> the changes first."
if
not
self
.
_version
:
%
self
.
meta_type
)
self
.
_version
=
self
.
absolute_url
(
1
)
def
_postCopy
(
self
,
container
,
op
=
0
):
def
manage_beforeDelete
(
self
,
item
,
container
):
if
self
.
_nonempty
():
try
:
raise
'Version Error'
,
(
version
=
self
.
REQUEST
[
'PATH_INFO'
]
'Attempt to %sdelete a non-empty version.<p>'
l
=
rfind
(
version
,
'/'
)
((
self
is
not
item
)
and
'indirectly '
or
''
))
if
l
>=
0
:
version
=
version
[:
l
]
self
.
_version
=
"%s/%s"
%
(
version
,
self
.
id
)
finally
:
if
0
:
raise
'Copy Error'
,
(
"This object can only be copied through the web.<p>"
)
Globals
.
default__class_init__
(
Draft
)
Globals
.
default__class_init__
(
Draft
)
...
...
lib/python/Products/OFSP/Version.py
View file @
dc241f2a
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Version object"""
"""Version object"""
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
import
Globals
,
time
import
Globals
,
time
from
AccessControl.Role
import
RoleManager
from
AccessControl.Role
import
RoleManager
...
@@ -100,10 +100,11 @@ manage_addVersionForm=Globals.HTMLFile('versionAdd', globals())
...
@@ -100,10 +100,11 @@ manage_addVersionForm=Globals.HTMLFile('versionAdd', globals())
def
manage_addVersion
(
self
,
id
,
title
,
REQUEST
=
None
):
def
manage_addVersion
(
self
,
id
,
title
,
REQUEST
=
None
):
""" """
""" """
self
.
_setObject
(
id
,
Version
(
id
,
title
,
self
,
REQUEST
))
return
self
.
manage_main
(
self
,
REQUEST
)
self
=
self
.
this
()
self
.
_setObject
(
id
,
Version
(
id
,
title
,
REQUEST
))
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
redirect
(
self
.
absolute_url
()
+
'/manage_main'
)
class
Version
(
Persistent
,
Implicit
,
RoleManager
,
Item
):
class
Version
(
Persistent
,
Implicit
,
RoleManager
,
Item
):
""" """
""" """
...
@@ -121,12 +122,11 @@ class Version(Persistent,Implicit,RoleManager,Item):
...
@@ -121,12 +122,11 @@ class Version(Persistent,Implicit,RoleManager,Item):
(
'Save/discard Version changes'
,
(
'save'
,
'discard'
)),
(
'Save/discard Version changes'
,
(
'save'
,
'discard'
)),
)
)
def
__init__
(
self
,
id
,
title
,
parent
,
REQUEST
):
cookie
=
''
def
__init__
(
self
,
id
,
title
,
REQUEST
):
self
.
id
=
id
self
.
id
=
id
self
.
title
=
title
self
.
title
=
title
try
:
parent
=
parent
.
Destination
()
except
:
pass
self
.
cookie
=
self
.
__of__
(
parent
).
absolute_url
(
1
)
manage
=
manage_main
=
Globals
.
HTMLFile
(
'version'
,
globals
())
manage
=
manage_main
=
Globals
.
HTMLFile
(
'version'
,
globals
())
manage_editForm
=
Globals
.
HTMLFile
(
'versionEdit'
,
globals
())
manage_editForm
=
Globals
.
HTMLFile
(
'versionEdit'
,
globals
())
...
@@ -230,11 +230,17 @@ class Version(Persistent,Implicit,RoleManager,Item):
...
@@ -230,11 +230,17 @@ class Version(Persistent,Implicit,RoleManager,Item):
# ZODB 3
# ZODB 3
return
not
db
.
versionEmpty
(
self
.
cookie
)
return
not
db
.
versionEmpty
(
self
.
cookie
)
def
_notifyOfCopyTo
(
self
,
container
,
isMove
=
0
):
def
manage_afterClone
(
self
,
item
):
if
isMove
and
self
.
nonempty
():
self
.
cookie
=
''
raise
'Copy Error'
,
(
"You cannot copy a %s object with <b>unsaved</b> changes.
\
n
"
def
manage_afterAdd
(
self
,
item
,
container
):
"You must <b>save</b> the changes first."
if
not
self
.
cookie
:
%
self
.
meta_type
)
self
.
cookie
=
self
.
absolute_url
(
1
)
def
manage_beforeDelete
(
self
,
item
,
container
):
if
self
.
_nonempty
():
raise
'Version Error'
,
(
'Attempt to %sdelete a non-empty version.<p>'
((
self
is
not
item
)
and
'indirectly '
or
''
))
lib/python/ZClasses/Property.py
View file @
dc241f2a
...
@@ -221,9 +221,10 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
...
@@ -221,9 +221,10 @@ class ZCommonSheet(OFS.PropertySheets.PropertySheet, OFS.SimpleItem.Item):
return
''
return
''
def
_on_delete_object
(
self
):
def
manage_beforeDelete
(
self
,
item
,
container
):
for
d
in
self
.
_properties
:
if
self
is
item
:
self
.
delClassAttr
(
d
[
'id'
])
for
d
in
self
.
_properties
:
self
.
delClassAttr
(
d
[
'id'
])
def
manage_createEditor
(
self
,
id
,
title
=
''
,
REQUEST
=
None
):
def
manage_createEditor
(
self
,
id
,
title
=
''
,
REQUEST
=
None
):
"""Create an edit interface for a property sheet
"""Create an edit interface for a property sheet
...
@@ -305,7 +306,7 @@ class ZInstanceSheet(OFS.PropertySheets.FixedSchema,
...
@@ -305,7 +306,7 @@ class ZInstanceSheet(OFS.PropertySheets.FixedSchema,
):
):
"Waaa this is too hard"
"Waaa this is too hard"
_Manage_properties_Permission
=
''
_Manage_properties_Permission
=
'
Manage properties
'
_Access_contents_information_Permission
=
'View'
_Access_contents_information_Permission
=
'View'
__ac_permissions__
=
(
__ac_permissions__
=
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment