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
0a8597bc
Commit
0a8597bc
authored
May 08, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New permission machinery with new getstate.
New UI-resizing interface.
parent
66f54717
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
38 deletions
+39
-38
lib/python/OFS/Document.py
lib/python/OFS/Document.py
+39
-38
No files found.
lib/python/OFS/Document.py
View file @
0a8597bc
"""Document object"""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
...
...
@@ -49,26 +49,21 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
(
'Change permissions'
,
[
'manage_access'
]),
(
'Change/upload data'
,
[
'manage_edit'
,
'manage_upload'
,
'PUT'
]),
(
'Change proxy roles'
,
[
'manage_proxyForm'
,
'manage_proxy'
]),
(
'View'
,
[
'__call__'
,]),
(
'Shared permission'
,
[
''
,]),
(
'View'
,
[
'__call__'
,
''
]),
)
__state_names__
=
(
HTML
.
__state_names__
+
(
'title'
,
'_proxy_roles'
)
+
tuple
(
reduce
(
lambda
a
,
b
:
a
+
b
,
map
(
lambda
permission
:
map
(
lambda
name
:
name
+
'__roles__'
,
permission
[
1
]
),
__ac_permissions__
)
))
)
__call____roles__
=
'Manager'
,
'Shared'
_state_name
=
{
'raw'
:
1
,
'globals'
:
1
,
'__name__'
:
1
,
'_vars'
:
1
}.
has_key
def
__getstate__
(
self
):
r
=
{}
state_name
=
self
.
_state_name
for
k
,
v
in
self
.
__dict__
.
items
():
if
state_name
(
k
)
or
k
[
-
11
:]
==
'_Permission'
or
k
[
-
9
:]
==
"__roles__"
:
r
[
k
]
=
v
return
r
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
""" """
kw
[
'document_id'
]
=
self
.
id
...
...
@@ -141,6 +136,28 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
manage
=
manage_main
=
manage_editDocument
=
manage_editForm
manage_proxyForm
=
HTMLFile
(
'documentProxy'
,
globals
())
_size_changes
=
{
'Bigger'
:
(
5
,
5
),
'Smaller'
:
(
-
5
,
-
5
),
'Narrower'
:
(
0
,
-
5
),
'Wider'
:
(
0
,
5
),
'Taller'
:
(
5
,
0
),
'Shorter'
:
(
-
5
,
0
),
}
def
_er
(
self
,
data
,
title
,
SUBMIT
,
dtpref_cols
,
dtpref_rows
,
REQUEST
):
dr
,
dc
=
self
.
_size_changes
[
SUBMIT
]
rows
=
max
(
1
,
atoi
(
dtpref_rows
)
+
dr
)
cols
=
max
(
40
,
atoi
(
dtpref_cols
)
+
dc
)
e
=
'Friday, 31-Dec-99 23:59:59 GMT'
resp
=
REQUEST
[
'RESPONSE'
]
resp
.
setCookie
(
'dtpref_rows'
,
str
(
rows
),
path
=
'/'
,
expires
=
e
)
resp
.
setCookie
(
'dtpref_cols'
,
str
(
cols
),
path
=
'/'
,
expires
=
e
)
return
self
.
manage_main
(
self
,
REQUEST
,
title
=
title
,
__str__
=
data
,
dtpref_cols
=
cols
,
dtpref_rows
=
rows
)
def
manage_edit
(
self
,
data
,
title
,
SUBMIT
=
'Change'
,
dtpref_cols
=
'50'
,
dtpref_rows
=
'20'
,
REQUEST
=
None
):
"""
...
...
@@ -153,24 +170,9 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
the data gets checked for DTML errors and is saved.
"""
self
.
_validateProxy
(
REQUEST
)
if
SUBMIT
==
'Smaller'
:
rows
=
atoi
(
dtpref_rows
)
-
5
cols
=
atoi
(
dtpref_cols
)
-
5
e
=
'Friday, 31-Dec-99 23:59:59 GMT'
resp
=
REQUEST
[
'RESPONSE'
]
resp
.
setCookie
(
'dtpref_rows'
,
str
(
rows
),
path
=
'/'
,
expires
=
e
)
resp
.
setCookie
(
'dtpref_cols'
,
str
(
cols
),
path
=
'/'
,
expires
=
e
)
return
self
.
manage_main
(
self
,
REQUEST
,
title
=
title
,
__str__
=
data
,
dtpref_cols
=
cols
,
dtpref_rows
=
rows
)
if
SUBMIT
==
'Bigger'
:
rows
=
atoi
(
dtpref_rows
)
+
5
cols
=
atoi
(
dtpref_cols
)
+
5
e
=
'Friday, 31-Dec-99 23:59:59 GMT'
resp
=
REQUEST
[
'RESPONSE'
]
resp
.
setCookie
(
'dtpref_rows'
,
str
(
rows
),
path
=
'/'
,
expires
=
e
)
resp
.
setCookie
(
'dtpref_cols'
,
str
(
cols
),
path
=
'/'
,
expires
=
e
)
return
self
.
manage_main
(
self
,
REQUEST
,
title
=
title
,
__str__
=
data
,
dtpref_cols
=
cols
,
dtpref_rows
=
rows
)
if
self
.
_size_changes
.
has_key
(
SUBMIT
):
return
self
.
_er
(
data
,
title
,
SUBMIT
,
dtpref_cols
,
dtpref_rows
,
REQUEST
)
self
.
title
=
title
self
.
munge
(
data
)
if
REQUEST
:
return
MessageDialog
(
...
...
@@ -189,7 +191,6 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
message
=
'Your changes have been saved'
,
action
=
'manage_main'
)
PUT__roles__
=
'Manager'
,
def
PUT
(
self
,
BODY
,
REQUEST
):
"""
replaces the contents of the document with the BODY of an HTTP PUT request.
...
...
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