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
a1fea6ff
Commit
a1fea6ff
authored
Jul 10, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged fixes for deleting of class attribute _owner and missing name
attrs on submit buttons.
parent
a593fea8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
lib/python/AccessControl/Owned.py
lib/python/AccessControl/Owned.py
+17
-11
lib/python/AccessControl/owner.dtml
lib/python/AccessControl/owner.dtml
+3
-3
No files found.
lib/python/AccessControl/Owned.py
View file @
a1fea6ff
...
...
@@ -85,8 +85,8 @@
__doc__
=
'''Support for owned objects
$Id: Owned.py,v 1.
4 2000/06/16 19:42:04 srichter
Exp $'''
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
$Id: Owned.py,v 1.
5 2000/07/10 13:23:15 brian
Exp $'''
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
Globals
,
urlparse
,
SpecialUsers
,
ExtensionClass
,
string
from
AccessControl
import
getSecurityManager
...
...
@@ -99,6 +99,9 @@ def ownableFilter(self,
_owner
=
aq_get
(
self
,
'_owner'
,
None
,
1
)
return
_owner
is
not
UnownableOwner
# Marker to use as a getattr default.
_mark
=
ownableFilter
class
Owned
(
ExtensionClass
.
Base
):
__ac_permissions__
=
(
...
...
@@ -158,10 +161,8 @@ class Owned(ExtensionClass.Base):
def
changeOwnership
(
self
,
user
,
aq_get
=
aq_get
,
None
=
None
,
):
"""Change the ownership to the given user.
If possible, make the ownership acquired.
"""
"""Change the ownership to the given user, make the
ownership acquired if possible."""
new
=
ownerInfo
(
user
)
if
new
is
None
:
return
# Special user!
...
...
@@ -169,7 +170,9 @@ class Owned(ExtensionClass.Base):
if
old
==
new
:
return
if
hasattr
(
self
,
'_owner'
):
# See if there is an _owner in the instance. If it is a
# class attribute we leave it alone.
if
self
.
__dict__
.
get
(
'_owner'
,
_mark
)
is
not
_mark
:
# Hm, maybe we can acquire ownership
del
self
.
_owner
self
.
changeOwnership
(
user
)
...
...
@@ -198,7 +201,6 @@ class Owned(ExtensionClass.Base):
raise
'Unauthorized'
,
(
'manage_takeOwnership was called from an invalid context'
)
self
.
changeOwnership
(
security
.
getUser
())
RESPONSE
.
redirect
(
REQUEST
[
'HTTP_REFERER'
])
...
...
@@ -215,13 +217,17 @@ class Owned(ExtensionClass.Base):
else
:
if
old
is
None
:
return
new
=
aq_get
(
aq_parent
(
self
),
'_owner'
,
None
,
1
)
if
old
is
new
:
del
self
.
_owner
if
old
is
new
and
(
self
.
__dict__
.
get
(
'_owner'
,
_mark
)
is
not
_mark
):
del
self
.
_owner
if
RESPONSE
is
not
None
:
RESPONSE
.
redirect
(
REQUEST
[
'HTTP_REFERER'
])
def
_deleteOwnershipAfterAdd
(
self
):
if
hasattr
(
self
,
'_owner'
):
# Only delete _owner if it is an instance attribute.
if
self
.
__dict__
.
get
(
'_owner'
,
_mark
)
is
not
_mark
:
del
self
.
_owner
for
object
in
self
.
objectValues
():
...
...
@@ -251,7 +257,7 @@ class Owned(ExtensionClass.Base):
return
None
if
_owner
is
UnownableOwner
:
# We want to acquire Unownable o
e
nership!
# We want to acquire Unownable o
w
nership!
return
self
.
_deleteOwnershipAfterAdd
()
else
:
# Otherwise change the ownership
...
...
lib/python/AccessControl/owner.dtml
View file @
a1fea6ff
...
...
@@ -18,10 +18,10 @@
<form
action=
"manage_changeOwnershipType"
>
<dtml-if
explicit
>
<input
type=
"hidden"
name=
"explicit"
value=
""
>
<input
type=
"submit"
value=
"Make ownership implicit (acquired)"
>
<input
name=
"submit"
type=
"submit"
value=
"Make ownership implicit (acquired)"
>
<dtml-else>
<input
type=
"hidden"
name=
"explicit"
value=
"y"
>
<input
type=
"submit"
value=
"Make ownership explicit"
>
<input
name=
"submit"
type=
"submit"
value=
"Make ownership explicit"
>
</dtml-if>
</form>
</dtml-if>
...
...
@@ -33,7 +33,7 @@
<dtml-if
userCanTakeOwnership
>
<form
action=
"manage_takeOwnership"
>
<input
type=
"submit"
value=
"Take ownership"
>
<input
name=
"submit"
type=
"submit"
value=
"Take ownership"
>
</form>
</dtml-if>
...
...
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