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
27c7808e
Commit
27c7808e
authored
Mar 14, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some string assumptions in favor of callable()
parent
2c15c9ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+12
-8
No files found.
lib/python/OFS/SimpleItem.py
View file @
27c7808e
...
...
@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
$Id: SimpleItem.py,v 1.6
6 1999/11/03 14:37:38
brian Exp $'''
__version__
=
'$Revision: 1.6
6
$'
[
11
:
-
2
]
$Id: SimpleItem.py,v 1.6
7 2000/03/14 17:30:31
brian Exp $'''
__version__
=
'$Revision: 1.6
7
$'
[
11
:
-
2
]
import
regex
,
sys
,
Globals
,
App
.
Management
,
Acquisition
from
webdav.Resource
import
Resource
...
...
@@ -140,28 +140,32 @@ class Item(Base, Resource, CopySource, App.Management.Tabs,
manage_options
=
()
def
title_or_id
(
self
,
st
=
type
(
''
)
):
def
title_or_id
(
self
):
"""
Utility that returns the title if it is not blank and the id
otherwise.
"""
title
=
self
.
title
if
type
(
title
)
is
not
st
:
title
=
title
()
if
callable
(
title
):
title
=
title
()
if
title
:
return
title
id
=
self
.
id
if
type
(
id
)
is
not
st
:
id
=
id
()
if
callable
(
id
):
id
=
id
()
return
id
def
title_and_id
(
self
,
st
=
type
(
''
)
):
def
title_and_id
(
self
):
"""
Utility that returns the title if it is not blank and the id
otherwise. If the title is not blank, then the id is included
in parens.
"""
title
=
self
.
title
if
type
(
title
)
is
not
st
:
title
=
title
()
if
callable
(
title
):
title
=
title
()
id
=
self
.
id
if
type
(
id
)
is
not
st
:
id
=
id
()
if
callable
(
id
):
id
=
id
()
return
title
and
(
"%s (%s)"
%
(
title
,
id
))
or
id
def
this
(
self
):
...
...
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