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
5826fe16
Commit
5826fe16
authored
Nov 10, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added PUT.
parent
8295a577
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
4 deletions
+58
-4
lib/python/OFS/Document.py
lib/python/OFS/Document.py
+8
-1
lib/python/OFS/Folder.py
lib/python/OFS/Folder.py
+50
-3
No files found.
lib/python/OFS/Document.py
View file @
5826fe16
"""Document object"""
"""Document object"""
__version__
=
'$Revision: 1.2
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
6
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
from
Globals
import
HTML
,
HTMLFile
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
...
@@ -80,6 +80,13 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__,
...
@@ -80,6 +80,13 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__,
def
validRoles
(
self
):
def
validRoles
(
self
):
return
self
.
aq_parent
.
validRoles
()
return
self
.
aq_parent
.
validRoles
()
PUT__roles__
=
'manage'
,
def
PUT
(
self
,
BODY
,
REQUEST
):
'handle PUT requests'
self
.
munge
(
BODY
)
return
'OK'
default_html
=
"""<!--#var standard_html_header-->
default_html
=
"""<!--#var standard_html_header-->
<H2><!--#var title_or_id--> <!--#var document_title--></H2>
<H2><!--#var title_or_id--> <!--#var document_title--></H2>
<P>This is the <!--#var document_id--> Document in
<P>This is the <!--#var document_id--> Document in
...
...
lib/python/OFS/Folder.py
View file @
5826fe16
"""Folder object
"""Folder object
$Id: Folder.py,v 1.1
5 1997/11/07 16:12:29
jim Exp $"""
$Id: Folder.py,v 1.1
6 1997/11/10 14:53:13
jim Exp $"""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
from
Globals
import
HTMLFile
from
Globals
import
HTMLFile
...
@@ -13,6 +13,9 @@ from Document import DocumentHandler
...
@@ -13,6 +13,9 @@ from Document import DocumentHandler
from
AccessControl.User
import
UserFolderHandler
from
AccessControl.User
import
UserFolderHandler
from
AccessControl.Role
import
RoleManager
from
AccessControl.Role
import
RoleManager
import
SimpleItem
import
SimpleItem
from
string
import
rfind
,
lower
from
content_types
import
content_type
,
find_binary
,
text_type
import
Image
class
FolderHandler
:
class
FolderHandler
:
"""Folder object handler"""
"""Folder object handler"""
...
@@ -104,7 +107,51 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
...
@@ -104,7 +107,51 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
except
:
pass
except
:
pass
return
r
return
r
def
__getitem__
(
self
,
key
):
# Hm, getattr didn't work, maybe this is a put:
r
=
PUTer
(
self
,
key
)
return
r
class
PUTer
:
'Temporary objects to handle PUT to non-existent images or documents'
def
__init__
(
self
,
parent
,
key
):
self
.
_parent
=
parent
self
.
_key
=
key
def
__str__
(
self
):
return
self
.
_key
PUT__roles__
=
'manage'
,
def
PUT
(
self
,
REQUEST
,
BODY
):
' '
name
=
self
.
_key
try
:
type
=
REQUEST
[
'CONTENT_TYPE'
]
except
KeyError
:
type
=
''
if
not
type
:
dot
=
rfind
(
name
,
'.'
)
suf
=
dot
>
0
and
lower
(
name
[
dot
+
1
:])
or
''
if
suf
:
try
:
type
=
content_type
[
suf
]
except
KeyError
:
if
find_binary
(
BODY
)
>=
0
:
type
=
'application/x-%s'
%
suf
else
:
type
=
text_type
(
BODY
)
else
:
if
find_binary
(
BODY
)
>=
0
:
raise
'Bad Request'
,
'Could not determine file type'
else
:
type
=
text_type
(
BODY
)
__traceback_info__
=
suf
,
dot
,
name
,
type
if
lower
(
type
)
==
'text/html'
:
return
self
.
_parent
.
manage_addDocument
(
name
,
''
,
BODY
,
REQUEST
=
REQUEST
)
i
=
Image
.
Image
()
i
.
_init
(
name
,
BODY
,
type
)
i
.
title
=
''
i
.
_setRoles
(
'A'
,[])
self
.
_parent
.
_setObject
(
name
,
i
)
return
'OK'
def
subclass
(
c
,
super
):
def
subclass
(
c
,
super
):
...
...
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