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
56ea1fc9
Commit
56ea1fc9
authored
Sep 05, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented getId() in SimpleItem; got rid of direct refs to object.id
in OFS package
parent
7371b1c6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
78 deletions
+87
-78
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+5
-5
lib/python/OFS/DTMLDocument.py
lib/python/OFS/DTMLDocument.py
+2
-2
lib/python/OFS/DTMLMethod.py
lib/python/OFS/DTMLMethod.py
+3
-3
lib/python/OFS/FindSupport.py
lib/python/OFS/FindSupport.py
+3
-3
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+40
-39
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+9
-6
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+22
-17
lib/python/OFS/Traversable.py
lib/python/OFS/Traversable.py
+3
-3
No files found.
lib/python/OFS/CopySupport.py
View file @
56ea1fc9
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__doc__
=
"""Copy interface"""
__doc__
=
"""Copy interface"""
__version__
=
'$Revision: 1.5
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
8
$'
[
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
...
@@ -207,7 +207,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -207,7 +207,7 @@ class CopyContainer(ExtensionClass.Base):
# 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
%
ob
.
getId
(
)
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
0
)
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
0
)
except
:
raise
CopyError
,
MessageDialog
(
except
:
raise
CopyError
,
MessageDialog
(
title
=
'Copy Error'
,
title
=
'Copy Error'
,
...
@@ -215,7 +215,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -215,7 +215,7 @@ class CopyContainer(ExtensionClass.Base):
action
=
'manage_main'
)
action
=
'manage_main'
)
ob
=
ob
.
_getCopy
(
self
)
ob
=
ob
.
_getCopy
(
self
)
ob
.
manage_afterClone
(
ob
)
ob
.
manage_afterClone
(
ob
)
id
=
self
.
_get_id
(
absattr
(
ob
.
id
))
id
=
self
.
_get_id
(
ob
.
getId
(
))
ob
.
_setId
(
id
)
ob
.
_setId
(
id
)
self
.
_setObject
(
id
,
ob
)
self
.
_setObject
(
id
,
ob
)
...
@@ -226,7 +226,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -226,7 +226,7 @@ class CopyContainer(ExtensionClass.Base):
if
op
==
1
:
if
op
==
1
:
# Move operation
# Move operation
for
ob
in
oblist
:
for
ob
in
oblist
:
id
=
absattr
(
ob
.
id
)
id
=
ob
.
getId
(
)
if
not
ob
.
cb_isMoveable
():
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
id
raise
CopyError
,
eNotSupported
%
id
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
1
)
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
1
)
...
@@ -312,7 +312,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -312,7 +312,7 @@ class CopyContainer(ExtensionClass.Base):
def
manage_clone
(
self
,
ob
,
id
,
REQUEST
=
None
):
def
manage_clone
(
self
,
ob
,
id
,
REQUEST
=
None
):
# Clone an object, creating a new object with the given id.
# Clone an object, creating a new object with the given id.
if
not
ob
.
cb_isCopyable
():
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
absattr
(
ob
.
id
)
raise
CopyError
,
eNotSupported
%
ob
.
getId
()
try
:
self
.
_checkId
(
id
)
try
:
self
.
_checkId
(
id
)
except
:
raise
CopyError
,
MessageDialog
(
except
:
raise
CopyError
,
MessageDialog
(
title
=
'Invalid Id'
,
title
=
'Invalid Id'
,
...
...
lib/python/OFS/DTMLDocument.py
View file @
56ea1fc9
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""DTML Document objects."""
"""DTML Document objects."""
__version__
=
'$Revision: 1.3
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
9
$'
[
11
:
-
2
]
from
DocumentTemplate.DT_Util
import
InstanceDict
,
TemplateDict
from
DocumentTemplate.DT_Util
import
InstanceDict
,
TemplateDict
from
ZPublisher.Converters
import
type_converters
from
ZPublisher.Converters
import
type_converters
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
...
@@ -158,7 +158,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
...
@@ -158,7 +158,7 @@ class DTMLDocument(PropertyManager, DTMLMethod):
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
"""Render the document given a client object, REQUEST mapping,
"""Render the document given a client object, REQUEST mapping,
Response, and key word arguments."""
Response, and key word arguments."""
kw
[
'document_id'
]
=
self
.
id
kw
[
'document_id'
]
=
self
.
getId
()
kw
[
'document_title'
]
=
self
.
title
kw
[
'document_title'
]
=
self
.
title
if
hasattr
(
self
,
'aq_explicit'
):
if
hasattr
(
self
,
'aq_explicit'
):
bself
=
self
.
aq_explicit
bself
=
self
.
aq_explicit
...
...
lib/python/OFS/DTMLMethod.py
View file @
56ea1fc9
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""DTML Method objects."""
"""DTML Method objects."""
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
4
$'
[
11
:
-
2
]
import
History
import
History
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
...
@@ -156,7 +156,7 @@ class DTMLMethod(HTML, Acquisition.Implicit, RoleManager,
...
@@ -156,7 +156,7 @@ class DTMLMethod(HTML, Acquisition.Implicit, RoleManager,
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
"""Render the document given a client object, REQUEST mapping,
"""Render the document given a client object, REQUEST mapping,
Response, and key word arguments."""
Response, and key word arguments."""
kw
[
'document_id'
]
=
self
.
id
kw
[
'document_id'
]
=
self
.
getId
()
kw
[
'document_title'
]
=
self
.
title
kw
[
'document_title'
]
=
self
.
title
security
=
getSecurityManager
()
security
=
getSecurityManager
()
...
@@ -180,7 +180,7 @@ class DTMLMethod(HTML, Acquisition.Implicit, RoleManager,
...
@@ -180,7 +180,7 @@ class DTMLMethod(HTML, Acquisition.Implicit, RoleManager,
if
self
.
__dict__
.
has_key
(
'content_type'
):
if
self
.
__dict__
.
has_key
(
'content_type'
):
c
=
self
.
content_type
c
=
self
.
content_type
else
:
else
:
c
,
e
=
guess_content_type
(
self
.
__name__
,
r
)
c
,
e
=
guess_content_type
(
self
.
getId
()
,
r
)
RESPONSE
.
setHeader
(
'Content-Type'
,
c
)
RESPONSE
.
setHeader
(
'Content-Type'
,
c
)
return
decapitate
(
r
,
RESPONSE
)
return
decapitate
(
r
,
RESPONSE
)
...
...
lib/python/OFS/FindSupport.py
View file @
56ea1fc9
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__doc__
=
"""Find support"""
__doc__
=
"""Find support"""
__version__
=
'$Revision: 1.2
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
1
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
time
,
Globals
,
ExtensionClass
import
sys
,
os
,
string
,
time
,
Globals
,
ExtensionClass
...
@@ -170,7 +170,7 @@ class FindSupport(ExtensionClass.Base):
...
@@ -170,7 +170,7 @@ class FindSupport(ExtensionClass.Base):
else
:
bs
=
ob
else
:
bs
=
ob
if
(
if
(
(
not
obj_ids
or
absattr
(
bs
.
id
)
in
obj_ids
)
(
not
obj_ids
or
absattr
(
bs
.
getId
()
)
in
obj_ids
)
and
and
(
not
obj_metatypes
or
(
hasattr
(
bs
,
'meta_type'
)
and
(
not
obj_metatypes
or
(
hasattr
(
bs
,
'meta_type'
)
and
bs
.
meta_type
in
obj_metatypes
))
bs
.
meta_type
in
obj_metatypes
))
...
@@ -262,7 +262,7 @@ class FindSupport(ExtensionClass.Base):
...
@@ -262,7 +262,7 @@ class FindSupport(ExtensionClass.Base):
else
:
bs
=
ob
else
:
bs
=
ob
if
(
if
(
(
not
obj_ids
or
absattr
(
bs
.
id
)
in
obj_ids
)
(
not
obj_ids
or
absattr
(
bs
.
getId
()
)
in
obj_ids
)
and
and
(
not
obj_metatypes
or
(
hasattr
(
bs
,
'meta_type'
)
and
(
not
obj_metatypes
or
(
hasattr
(
bs
,
'meta_type'
)
and
bs
.
meta_type
in
obj_metatypes
))
bs
.
meta_type
in
obj_metatypes
))
...
...
lib/python/OFS/ObjectManager.py
View file @
56ea1fc9
...
@@ -84,9 +84,9 @@
...
@@ -84,9 +84,9 @@
##############################################################################
##############################################################################
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.10
8 2000/08/17 20:17:24 shane
Exp $"""
$Id: ObjectManager.py,v 1.10
9 2000/09/05 20:52:47 brian
Exp $"""
__version__
=
'$Revision: 1.10
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.10
9
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
Globals
,
CopySupport
,
Products
import
App.Management
,
Acquisition
,
Globals
,
CopySupport
,
Products
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
...
@@ -483,8 +483,7 @@ class ObjectManager(
...
@@ -483,8 +483,7 @@ class ObjectManager(
RESPONSE
=
None
):
RESPONSE
=
None
):
"""Exports an object to a file and returns that file."""
"""Exports an object to a file and returns that file."""
if
not
id
:
if
not
id
:
id
=
self
.
id
id
=
self
.
getId
()
if
callable
(
id
):
id
=
id
()
ob
=
self
ob
=
self
else
:
ob
=
self
.
_getOb
(
id
)
else
:
ob
=
self
.
_getOb
(
id
)
...
@@ -530,8 +529,7 @@ class ObjectManager(
...
@@ -530,8 +529,7 @@ class ObjectManager(
ob
=
connection
.
importFile
(
ob
=
connection
.
importFile
(
file
,
customImporters
=
customImporters
)
file
,
customImporters
=
customImporters
)
if
REQUEST
:
self
.
_verifyObjectPaste
(
ob
,
validate_src
=
0
)
if
REQUEST
:
self
.
_verifyObjectPaste
(
ob
,
validate_src
=
0
)
id
=
ob
.
id
id
=
ob
.
getId
()
if
hasattr
(
id
,
'im_func'
):
id
=
id
()
self
.
_setObject
(
id
,
ob
,
set_owner
=
set_owner
)
self
.
_setObject
(
id
,
ob
,
set_owner
=
set_owner
)
# try to make ownership implicit if possible in the context
# try to make ownership implicit if possible in the context
...
@@ -619,38 +617,41 @@ class ObjectManager(
...
@@ -619,38 +617,41 @@ class ObjectManager(
Globals
.
default__class_init__
(
ObjectManager
)
Globals
.
default__class_init__
(
ObjectManager
)
class
PUTer
(
Acquisition
.
Explicit
):
"""Class to support the HTTP PUT protocol."""
## This isnt used anymore - NullResource now handles PUTs.
def
__init__
(
self
,
parent
,
id
):
## class PUTer(Acquisition.Explicit):
self
.
id
=
id
## """Class to support the HTTP PUT protocol."""
self
.
__parent__
=
parent
self
.
__roles__
=
parent
.
PUT__roles__
## def __init__(self, parent, id):
## self.id=id
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
## self.__parent__=parent
"""Adds a document, image or file to the folder when a PUT
## self.__roles__ =parent.PUT__roles__
request is received."""
name
=
self
.
id
## def PUT(self, REQUEST, RESPONSE):
type
=
REQUEST
.
get_header
(
'content-type'
,
None
)
## """Adds a document, image or file to the folder when a PUT
body
=
REQUEST
.
get
(
'BODY'
,
''
)
## request is received."""
if
type
is
None
:
## name=self.id
type
,
enc
=
mimetypes
.
guess_type
(
name
)
## type=REQUEST.get_header('content-type', None)
if
type
is
None
:
## body=REQUEST.get('BODY', '')
if
content_types
.
find_binary
(
body
)
>=
0
:
## if type is None:
type
=
'application/octet-stream'
## type, enc=mimetypes.guess_type(name)
else
:
type
=
content_types
.
text_type
(
body
)
## if type is None:
type
=
lower
(
type
)
## if content_types.find_binary(body) >= 0:
if
type
in
(
'text/html'
,
'text/xml'
,
'text/plain'
):
## type='application/octet-stream'
self
.
__parent__
.
manage_addDTMLDocument
(
name
,
''
,
body
)
## else: type=content_types.text_type(body)
elif
type
[:
6
]
==
'image/'
:
## type=lower(type)
ob
=
Image
(
name
,
''
,
body
,
content_type
=
type
)
## if type in ('text/html', 'text/xml', 'text/plain'):
self
.
__parent__
.
_setObject
(
name
,
ob
)
## self.__parent__.manage_addDTMLDocument(name, '', body)
else
:
## elif type[:6]=='image/':
ob
=
File
(
name
,
''
,
body
,
content_type
=
type
)
## ob=Image(name, '', body, content_type=type)
self
.
__parent__
.
_setObject
(
name
,
ob
)
## self.__parent__._setObject(name, ob)
RESPONSE
.
setStatus
(
201
)
## else:
RESPONSE
.
setBody
(
''
)
## ob=File(name, '', body, content_type=type)
return
RESPONSE
## self.__parent__._setObject(name, ob)
## RESPONSE.setStatus(201)
def
__str__
(
self
):
## RESPONSE.setBody('')
return
self
.
id
## return RESPONSE
## def __str__(self):
## return self.id
lib/python/OFS/PropertySheets.py
View file @
56ea1fc9
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Property sheets"""
"""Property sheets"""
__version__
=
'$Revision: 1.5
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
6
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
,
Globals
import
time
,
string
,
App
.
Management
,
Globals
from
ZPublisher.Converters
import
type_converters
from
ZPublisher.Converters
import
type_converters
...
@@ -110,7 +110,7 @@ class View(App.Management.Tabs, Base):
...
@@ -110,7 +110,7 @@ class View(App.Management.Tabs, Base):
'''
'''
RESPONSE
.
redirect
(
URL1
+
'/manage'
)
RESPONSE
.
redirect
(
URL1
+
'/manage'
)
def
tpURL
(
self
):
return
self
.
id
def
tpURL
(
self
):
return
self
.
getId
()
def
manage_options
(
self
):
def
manage_options
(
self
):
"""Return a manage option data structure for me instance
"""Return a manage option data structure for me instance
...
@@ -189,6 +189,9 @@ class PropertySheet(Traversable, Persistent, Implicit):
...
@@ -189,6 +189,9 @@ class PropertySheet(Traversable, Persistent, Implicit):
self
.
id
=
id
self
.
id
=
id
self
.
_md
=
md
or
{}
self
.
_md
=
md
or
{}
def
getId
(
self
):
return
self
.
id
def
xml_namespace
(
self
):
def
xml_namespace
(
self
):
# Return a namespace string usable as an xml namespace
# Return a namespace string usable as an xml namespace
# for this property set.
# for this property set.
...
@@ -630,7 +633,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
...
@@ -630,7 +633,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
def
__bobo_traverse__
(
self
,
REQUEST
,
name
=
None
):
def
__bobo_traverse__
(
self
,
REQUEST
,
name
=
None
):
for
propset
in
self
.
__propsets__
():
for
propset
in
self
.
__propsets__
():
if
propset
.
id
==
name
:
if
propset
.
getId
()
==
name
:
return
propset
.
__of__
(
self
)
return
propset
.
__of__
(
self
)
return
getattr
(
self
,
name
)
return
getattr
(
self
,
name
)
...
@@ -653,7 +656,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
...
@@ -653,7 +656,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
def
get
(
self
,
name
,
default
=
None
):
def
get
(
self
,
name
,
default
=
None
):
for
propset
in
self
.
__propsets__
():
for
propset
in
self
.
__propsets__
():
if
propset
.
id
==
name
or
propset
.
xml_namespace
()
==
name
:
if
propset
.
getId
()
==
name
or
propset
.
xml_namespace
()
==
name
:
return
propset
.
__of__
(
self
)
return
propset
.
__of__
(
self
)
return
default
return
default
...
@@ -672,7 +675,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
...
@@ -672,7 +675,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
def
delPropertySheet
(
self
,
name
):
def
delPropertySheet
(
self
,
name
):
result
=
[]
result
=
[]
for
propset
in
self
.
aq_parent
.
__propsets__
:
for
propset
in
self
.
aq_parent
.
__propsets__
:
if
propset
.
id
!=
name
and
propset
.
xml_namespace
()
!=
name
:
if
propset
.
getId
()
!=
name
and
propset
.
xml_namespace
()
!=
name
:
result
.
append
(
propset
)
result
.
append
(
propset
)
self
.
parent
.
__propsets__
=
tuple
(
result
)
self
.
parent
.
__propsets__
=
tuple
(
result
)
...
...
lib/python/OFS/SimpleItem.py
View file @
56ea1fc9
...
@@ -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.7
8 2000/06/12 19:49:48 shane
Exp $'''
$Id: SimpleItem.py,v 1.7
9 2000/09/05 20:52:47 brian
Exp $'''
__version__
=
'$Revision: 1.7
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
9
$'
[
11
:
-
2
]
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
,
App
.
Undo
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
,
App
.
Undo
import
AccessControl.Role
,
AccessControl
.
Owned
,
App
.
Common
import
AccessControl.Role
,
AccessControl
.
Owned
,
App
.
Common
...
@@ -123,12 +123,25 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
...
@@ -123,12 +123,25 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
def
manage_beforeDelete
(
self
,
item
,
container
):
pass
def
manage_beforeDelete
(
self
,
item
,
container
):
pass
def
manage_afterClone
(
self
,
item
):
pass
def
manage_afterClone
(
self
,
item
):
pass
# The name of this object and the name used to traverse to thie
# Direct use of the 'id' attribute is deprecated - use getId()
# object in a URL:
id
=
''
id
=
''
getId__roles__
=
None
def
getId
(
self
):
"""Return the id of the object as a string. This method
should be used in preference to accessing an id attribute
of an object directly. The getId method is public."""
name
=
getattr
(
self
,
'id'
,
None
)
if
callable
(
name
):
return
name
()
if
name
is
not
None
:
return
name
if
hasattr
(
self
,
'__name__'
):
return
self
.
__name__
raise
AttributeError
,
'This object has no id'
# Alias id to __name__, which will make tracebacks a good bit nicer:
# Alias id to __name__, which will make tracebacks a good bit nicer:
__name__
=
ComputedAttribute
(
lambda
self
:
self
.
id
)
__name__
=
ComputedAttribute
(
lambda
self
:
self
.
getId
()
)
# Name, relative to SOFTWARE_URL of icon used to display item
# Name, relative to SOFTWARE_URL of icon used to display item
# in folder listings.
# in folder listings.
...
@@ -164,10 +177,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
...
@@ -164,10 +177,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
if
callable
(
title
):
if
callable
(
title
):
title
=
title
()
title
=
title
()
if
title
:
return
title
if
title
:
return
title
id
=
self
.
id
return
self
.
getId
()
if
callable
(
id
):
id
=
id
()
return
id
def
title_and_id
(
self
):
def
title_and_id
(
self
):
"""
"""
...
@@ -178,9 +188,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
...
@@ -178,9 +188,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
title
=
self
.
title
title
=
self
.
title
if
callable
(
title
):
if
callable
(
title
):
title
=
title
()
title
=
title
()
id
=
self
.
id
id
=
self
.
getId
()
if
callable
(
id
):
id
=
id
()
return
title
and
(
"%s (%s)"
%
(
title
,
id
))
or
id
return
title
and
(
"%s (%s)"
%
(
title
,
id
))
or
id
def
this
(
self
):
def
this
(
self
):
...
@@ -189,9 +197,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
...
@@ -189,9 +197,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
def
tpURL
(
self
):
def
tpURL
(
self
):
# My URL as used by tree tag
# My URL as used by tree tag
url
=
self
.
id
return
self
.
getId
()
if
hasattr
(
url
,
'im_func'
):
url
=
url
()
return
url
def
tpValues
(
self
):
def
tpValues
(
self
):
# My sub-objects as used by the tree tag
# My sub-objects as used by the tree tag
...
@@ -326,8 +332,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
...
@@ -326,8 +332,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
ob
=
ob
.
aq_parent
ob
=
ob
.
aq_parent
stat
=
marshal
.
loads
(
self
.
manage_FTPstat
(
REQUEST
))
stat
=
marshal
.
loads
(
self
.
manage_FTPstat
(
REQUEST
))
if
callable
(
self
.
id
):
id
=
self
.
id
()
id
=
self
.
getId
()
else
:
id
=
self
.
id
return
marshal
.
dumps
((
id
,
stat
))
return
marshal
.
dumps
((
id
,
stat
))
def
__len__
(
self
):
def
__len__
(
self
):
...
...
lib/python/OFS/Traversable.py
View file @
56ea1fc9
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
##############################################################################
##############################################################################
'''This module implements a mix-in for traversable objects.
'''This module implements a mix-in for traversable objects.
$Id: Traversable.py,v 1.
4 2000/08/15 17:52:53 ev
an Exp $'''
$Id: Traversable.py,v 1.
5 2000/09/05 20:52:47 bri
an Exp $'''
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
Acquisition
import
Acquisition
...
@@ -128,7 +128,7 @@ class Traversable:
...
@@ -128,7 +128,7 @@ class Traversable:
later, for example in a copy/paste operation. getPhysicalRoot()
later, for example in a copy/paste operation. getPhysicalRoot()
and getPhysicalPath() are designed to operate together.
and getPhysicalPath() are designed to operate together.
'''
'''
path
=
(
self
.
id
,)
path
=
(
self
.
getId
()
,)
p
=
getattr
(
self
,
'aq_inner'
,
None
)
p
=
getattr
(
self
,
'aq_inner'
,
None
)
if
p
is
not
None
:
if
p
is
not
None
:
...
...
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