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
Show 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"""
"""Document object"""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
...
@@ -49,26 +49,21 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
...
@@ -49,26 +49,21 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
(
'Change permissions'
,
[
'manage_access'
]),
(
'Change permissions'
,
[
'manage_access'
]),
(
'Change/upload data'
,
[
'manage_edit'
,
'manage_upload'
,
'PUT'
]),
(
'Change/upload data'
,
[
'manage_edit'
,
'manage_upload'
,
'PUT'
]),
(
'Change proxy roles'
,
[
'manage_proxyForm'
,
'manage_proxy'
]),
(
'Change proxy roles'
,
[
'manage_proxyForm'
,
'manage_proxy'
]),
(
'View'
,
[
'__call__'
,]),
(
'View'
,
[
'__call__'
,
''
]),
(
'Shared permission'
,
[
''
,]),
)
)
__state_names__
=
(
_state_name
=
{
'raw'
:
1
,
'globals'
:
1
,
'__name__'
:
1
,
'_vars'
:
1
}.
has_key
HTML
.
__state_names__
+
(
'title'
,
'_proxy_roles'
)
+
tuple
(
reduce
(
lambda
a
,
b
:
def
__getstate__
(
self
):
a
+
b
,
r
=
{}
map
(
lambda
permission
:
state_name
=
self
.
_state_name
map
(
lambda
name
:
for
k
,
v
in
self
.
__dict__
.
items
():
name
+
'__roles__'
,
if
state_name
(
k
)
or
k
[
-
11
:]
==
'_Permission'
or
k
[
-
9
:]
==
"__roles__"
:
permission
[
1
]
r
[
k
]
=
v
),
__ac_permissions__
return
r
)
))
)
__call____roles__
=
'Manager'
,
'Shared'
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
def
__call__
(
self
,
client
=
None
,
REQUEST
=
{},
RESPONSE
=
None
,
**
kw
):
""" """
""" """
kw
[
'document_id'
]
=
self
.
id
kw
[
'document_id'
]
=
self
.
id
...
@@ -141,6 +136,28 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
...
@@ -141,6 +136,28 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
manage
=
manage_main
=
manage_editDocument
=
manage_editForm
manage
=
manage_main
=
manage_editDocument
=
manage_editForm
manage_proxyForm
=
HTMLFile
(
'documentProxy'
,
globals
())
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'
,
def
manage_edit
(
self
,
data
,
title
,
SUBMIT
=
'Change'
,
dtpref_cols
=
'50'
,
dtpref_rows
=
'20'
,
REQUEST
=
None
):
dtpref_rows
=
'20'
,
REQUEST
=
None
):
"""
"""
...
@@ -153,24 +170,9 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
...
@@ -153,24 +170,9 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
the data gets checked for DTML errors and is saved.
the data gets checked for DTML errors and is saved.
"""
"""
self
.
_validateProxy
(
REQUEST
)
self
.
_validateProxy
(
REQUEST
)
if
SUBMIT
==
'Smaller'
:
if
self
.
_size_changes
.
has_key
(
SUBMIT
):
rows
=
atoi
(
dtpref_rows
)
-
5
return
self
.
_er
(
data
,
title
,
SUBMIT
,
dtpref_cols
,
dtpref_rows
,
REQUEST
)
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
)
self
.
title
=
title
self
.
title
=
title
self
.
munge
(
data
)
self
.
munge
(
data
)
if
REQUEST
:
return
MessageDialog
(
if
REQUEST
:
return
MessageDialog
(
...
@@ -189,7 +191,6 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
...
@@ -189,7 +191,6 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
message
=
'Your changes have been saved'
,
message
=
'Your changes have been saved'
,
action
=
'manage_main'
)
action
=
'manage_main'
)
PUT__roles__
=
'Manager'
,
def
PUT
(
self
,
BODY
,
REQUEST
):
def
PUT
(
self
,
BODY
,
REQUEST
):
"""
"""
replaces the contents of the document with the BODY of an HTTP PUT 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