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
216279ad
Commit
216279ad
authored
Aug 08, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved property handling.
parent
09848456
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
20 deletions
+52
-20
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+49
-17
lib/python/OFS/properties.dtml
lib/python/OFS/properties.dtml
+3
-3
No files found.
lib/python/OFS/ObjectManager.py
View file @
216279ad
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.
4 1997/08/08 16:54:12
jim Exp $"""
$Id: ObjectManager.py,v 1.
5 1997/08/08 23:03:51
jim Exp $"""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
from
SingleThreadedTransaction
import
Persistent
...
...
@@ -11,8 +11,9 @@ from Globals import ManageHTMLFile,PublicHTMLFile
from
Globals
import
MessageDialog
from
App.Management
import
Management
from
Acquisition
import
Acquirer
from
string
import
find
,
join
fields
from
string
import
find
,
join
,
lower
from
urllib
import
quote
from
DocumentTemplate
import
html_quote
class
ObjectManager
(
Acquirer
,
Management
,
Persistent
):
"""Generic object manager
...
...
@@ -163,7 +164,7 @@ class ObjectManager(Acquirer,Management,Persistent):
for
p
in
self
.
_properties
:
n
=
p
[
'id'
]
try
:
setattr
(
self
,
n
,
REQUEST
[
n
])
except
:
pass
except
:
setattr
(
self
,
n
,
''
)
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
def
manage_delProperties
(
self
,
ids
,
REQUEST
):
...
...
@@ -187,28 +188,56 @@ class ObjectManager(Acquirer,Management,Persistent):
def
_defaultInput
(
self
,
n
,
t
,
v
):
return
'<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
%
(
n
,
t
,
v
)
def
_stringInput
(
self
,
n
,
t
,
v
):
return
(
'<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
%
(
n
,
t
,
html_quote
(
v
)))
def
_booleanInput
(
self
,
n
,
t
,
v
):
if
v
:
v
=
"CHECKET"
else
:
v
=
''
return
(
'<INPUT TYPE= "CHECKBOX" NAME="%s:%s" SIZE="50" %s></TD>'
%
(
n
,
t
,
v
))
def
_selectInput
(
self
,
n
,
t
,
v
):
s
=
[
'<SELECT NAME="%s:%s">'
%
(
n
,
t
)]
map
(
lambda
i
:
s
.
append
(
'<OPTION>%s'
%
i
),
v
)
s
.
append
(
'</SELECT>'
)
return
join
fields
(
s
,
'
\
n
'
)
return
join
(
s
,
'
\
n
'
)
def
_linesInput
(
self
,
n
,
t
,
v
):
try
:
v
=
html_quote
(
join
(
v
,
'
\
n
'
))
except
:
v
=
''
return
(
'<TEXTAREA NAME="%s:lines" ROWS="10" COLS="50">%s</TEXTAREA>'
%
(
n
,
v
))
'<TEXTAREA NAME="%s:lines" ROWS="10" COLS="50">%s</TEXTAREA>'
%
(
n
,
v
))
def
_textInput
(
self
,
n
,
t
,
v
):
return
'<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
%
(
n
,
v
)
_inputMap
=
{
'float'
:
_defaultInput
,
'int'
:
_defaultInput
,
'long'
:
_defaultInput
,
'string'
:
_defaultInput
,
'lines'
:
_linesInput
,
'text'
:
_textInput
,
}
propertyTypes
=
_inputMap
.
keys
()
return
(
'<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
%
(
n
,
html_quote
(
v
)))
_inputMap
=
{
'float'
:
_defaultInput
,
'int'
:
_defaultInput
,
'long'
:
_defaultInput
,
'string'
:
_stringInput
,
'lines'
:
_linesInput
,
'text'
:
_textInput
,
'date'
:
_defaultInput
,
'regex'
:
_stringInput
,
'Regex'
:
_stringInput
,
'regexs'
:
_stringInput
,
'Regexs'
:
_stringInput
,
'tokens'
:
_stringInput
,
'boolean'
:
_booleanInput
,
}
propertyTypes
=
map
(
lambda
key
:
(
lower
(
key
),
key
),
_inputMap
.
keys
())
propertyTypes
.
sort
()
propertyTypes
=
map
(
lambda
key
:
{
'id'
:
key
[
1
],
'selected'
:
key
[
1
]
==
'string'
and
'SELECTED'
or
''
},
propertyTypes
)
def
propertyInputs
(
self
):
imap
=
self
.
_inputMap
...
...
@@ -223,6 +252,9 @@ class ObjectManager(Acquirer,Management,Persistent):
##############################################################################
#
# $Log: ObjectManager.py,v $
# Revision 1.5 1997/08/08 23:03:51 jim
# Improved property handling.
#
# Revision 1.4 1997/08/08 16:54:12 jim
# Changed to allow overriding of acquired attributes.
#
...
...
lib/python/OFS/properties.dtml
View file @
216279ad
...
...
@@ -16,7 +16,7 @@ edit the value and click the "Change Properties" button.
<!--#in propertyInputs mapping-->
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B><!--#var id fmt=spacify--></B></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><!--#var input
fmt=html_quote
--></TD>
<TD ALIGN="LEFT" VALIGN="TOP"><!--#var input--></TD>
</TR>
<!--#/in propertyInputs-->
<!--#/if propertyInputs-->
...
...
@@ -48,8 +48,8 @@ value fields below and then clicking on the "Add Property" button.
<TD ALIGN="LEFT" VALIGN="TOP">Type:</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<SELECT NAME="type">
<!--#in propertyTypes-->
<OPTION
><!--#var __str__
-->
<!--#in propertyTypes
mapping
-->
<OPTION
<!--#var selected-->><!--#var id
-->
<!--#/in propertyTypes-->
</SELECT>
</TD>
...
...
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