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
44192455
Commit
44192455
authored
Apr 09, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made sub-object access more abstract to work with collections
that don't store sub-objects in attributes.
parent
e5f18e26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
+28
-13
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+21
-6
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+6
-6
lib/python/OFS/renameForm.dtml
lib/python/OFS/renameForm.dtml
+1
-1
No files found.
lib/python/OFS/CopySupport.py
View file @
44192455
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__doc__
=
"""Copy interface"""
__version__
=
'$Revision: 1.3
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
import
sys
,
string
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
from
marshal
import
loads
,
dumps
...
...
@@ -94,6 +94,7 @@ from App.Dialogs import MessageDialog
CopyError
=
'Copy Error'
_marker
=
[]
class
CopyContainer
(
ExtensionClass
.
Base
):
"""Interface for containerish objects which allow cut/copy/paste"""
...
...
@@ -102,7 +103,21 @@ class CopyContainer(ExtensionClass.Base):
(
'manage_cutObjects'
,
'manage_copyObjects'
,
'manage_pasteObjects'
,
'manage_renameForm'
,
'manage_renameObject'
,)),
)
# The following three methods should be overridden to store sub-objects
# as non-attributes.
def
_setOb
(
self
,
id
,
object
):
setattr
(
self
,
id
,
object
)
def
_delOb
(
self
,
id
):
delattr
(
self
,
id
)
def
_getOb
(
self
,
id
,
default
=
_marker
):
if
hasattr
(
self
,
'aq_base'
):
self
=
self
.
aq_base
if
default
is
_marker
:
return
getattr
(
self
,
id
)
try
:
return
getattr
(
self
,
id
)
except
:
return
default
def
manage_CopyContainerFirstItem
(
self
,
REQUEST
):
return
self
.
_getOb
(
REQUEST
[
'ids'
][
0
])
def
manage_cutObjects
(
self
,
ids
,
REQUEST
=
None
):
"""Put a reference to the objects named in ids in the clip board"""
...
...
@@ -110,7 +125,7 @@ class CopyContainer(ExtensionClass.Base):
ids
=
[
ids
]
oblist
=
[]
for
id
in
ids
:
ob
=
getattr
(
self
,
id
)
ob
=
self
.
_getOb
(
id
)
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
id
m
=
Moniker
.
Moniker
(
ob
)
...
...
@@ -129,7 +144,7 @@ class CopyContainer(ExtensionClass.Base):
ids
=
[
ids
]
oblist
=
[]
for
id
in
ids
:
ob
=
getattr
(
self
,
id
)
ob
=
self
.
_getOb
(
id
)
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
id
m
=
Moniker
.
Moniker
(
ob
)
...
...
@@ -224,7 +239,7 @@ class CopyContainer(ExtensionClass.Base):
title
=
'Invalid Id'
,
message
=
sys
.
exc_value
,
action
=
'manage_main'
)
ob
=
getattr
(
self
,
id
)
ob
=
self
.
_getOb
(
id
)
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
id
self
.
_verifyObjectPaste
(
ob
,
REQUEST
)
...
...
@@ -317,7 +332,7 @@ class CopyContainer(ExtensionClass.Base):
meth
=
None
if
hasattr
(
self
,
method_name
):
meth
=
getattr
(
self
,
method_name
)
meth
=
self
.
_getOb
(
method_name
)
else
:
# Handle strange names that come from the Product
# machinery ;(
...
...
lib/python/OFS/ObjectManager.py
View file @
44192455
...
...
@@ -84,9 +84,9 @@
##############################################################################
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.6
3 1999/04/08 14:04:54 brian
Exp $"""
$Id: ObjectManager.py,v 1.6
4 1999/04/09 17:05:23 jim
Exp $"""
__version__
=
'$Revision: 1.6
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.6
4
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
App
.
Undo
,
Globals
,
CopySupport
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
...
...
@@ -351,10 +351,10 @@ class ObjectManager(
r
=
[]
if
hasattr
(
self
.
aq_base
,
'tree_ids'
):
for
id
in
self
.
aq_base
.
tree_ids
:
if
hasattr
(
self
,
id
):
r
.
append
(
getattr
(
self
,
id
))
if
hasattr
(
self
,
id
):
r
.
append
(
self
.
_getOb
(
id
))
else
:
for
id
in
self
.
_objects
:
o
=
getattr
(
self
,
id
[
'id'
])
o
=
self
.
_getOb
(
id
[
'id'
])
try
:
if
o
.
isPrincipiaFolderish
:
r
.
append
(
o
)
except
:
pass
...
...
@@ -366,7 +366,7 @@ class ObjectManager(
"""Exports a folder and its contents to /var/export.bbe
This file can later be imported by using manage_importHack"""
if
id
is
None
:
o
=
self
else
:
o
=
getattr
(
self
.
o
)
else
:
o
=
self
.
_getOb
(
id
)
f
=
Globals
.
data_dir
+
'/export.bbe'
o
.
_p_jar
.
export_file
(
o
,
f
)
return
f
...
...
@@ -388,7 +388,7 @@ class ObjectManager(
id
=
self
.
id
if
callable
(
id
):
id
=
id
()
ob
=
self
else
:
ob
=
getattr
(
self
,
id
)
else
:
ob
=
self
.
_getOb
(
id
)
if
download
:
f
=
StringIO
()
ob
.
_p_jar
.
export_file
(
ob
,
f
)
...
...
lib/python/OFS/renameForm.dtml
View file @
44192455
...
...
@@ -4,7 +4,7 @@
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#if expr="_.hasattr(REQUEST, 'ids') and REQUEST['ids']"-->
<!--#with expr="
_.getattr(this(), REQUEST['ids'][0]
)"-->
<!--#with expr="
manage_CopyContainerFirstItem(REQUEST
)"-->
<!--#if cb_isMoveable-->
<H2>Rename <!--#var meta_type--></H2>
<P>
...
...
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