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
5301e7f2
Commit
5301e7f2
authored
Jun 25, 2009
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- resynced Products.Five.browser.adding with zope.app.container.browser.adding
parent
e774bf3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
30 deletions
+15
-30
src/Products/Five/browser/adding.py
src/Products/Five/browser/adding.py
+15
-30
No files found.
src/Products/Five/browser/adding.py
View file @
5301e7f2
...
@@ -23,27 +23,24 @@ $Id$
...
@@ -23,27 +23,24 @@ $Id$
__docformat__
=
'restructuredtext'
__docformat__
=
'restructuredtext'
from
warnings
import
warn
from
zope.app.publisher.browser.menu
import
getMenu
from
zope.browser.interfaces
import
IAdding
from
zope.component
import
getMultiAdapter
from
zope.component
import
getMultiAdapter
from
zope.component
import
getUtility
from
zope.component
import
getUtility
from
zope.component
import
queryMultiAdapter
from
zope.component
import
queryMultiAdapter
from
zope.component
import
queryUtility
from
zope.component
import
queryUtility
from
zope.component.interfaces
import
IFactory
from
zope.component.interfaces
import
IFactory
from
zope.container.constraints
import
checkFactory
,
checkObject
from
zope.container.constraints
import
checkFactory
from
zope.container.constraints
import
checkObject
from
zope.container.i18n
import
ZopeMessageFactory
as
_
from
zope.container.i18n
import
ZopeMessageFactory
as
_
from
zope.container.interfaces
import
IContainerNamesContainer
from
zope.container.interfaces
import
IContainerNamesContainer
from
zope.container.interfaces
import
INameChooser
from
zope.container.interfaces
import
INameChooser
from
zope.event
import
notify
from
zope.event
import
notify
from
zope.exceptions.interfaces
import
UserError
from
zope.interface
import
implements
from
zope.interface
import
implements
from
zope.lifecycleevent
import
ObjectCreatedEvent
from
zope.publisher.interfaces
import
IPublishTraverse
from
zope.publisher.interfaces
import
IPublishTraverse
from
zope.traversing.browser.absoluteurl
import
absoluteURL
from
zope.traversing.browser.absoluteurl
import
absoluteURL
from
zope.exceptions.interfaces
import
UserError
from
zope.lifecycleevent
import
ObjectCreatedEvent
from
zope.browser.interfaces
import
IAdding
from
zope.app.publisher.browser.menu
import
getMenu
from
zExceptions
import
BadRequest
from
zExceptions
import
BadRequest
from
OFS.SimpleItem
import
SimpleItem
from
OFS.SimpleItem
import
SimpleItem
...
@@ -51,7 +48,8 @@ from OFS.SimpleItem import SimpleItem
...
@@ -51,7 +48,8 @@ from OFS.SimpleItem import SimpleItem
from
Products.Five
import
BrowserView
from
Products.Five
import
BrowserView
from
Products.Five.browser.pagetemplatefile
import
ViewPageTemplateFile
from
Products.Five.browser.pagetemplatefile
import
ViewPageTemplateFile
class
BasicAdding
(
BrowserView
):
class
Adding
(
BrowserView
):
implements
(
IAdding
,
IPublishTraverse
)
implements
(
IAdding
,
IPublishTraverse
)
def
add
(
self
,
content
):
def
add
(
self
,
content
):
...
@@ -80,7 +78,7 @@ class BasicAdding(BrowserView):
...
@@ -80,7 +78,7 @@ class BasicAdding(BrowserView):
# Invoke the name chooser even when we have a
# Invoke the name chooser even when we have a
# name. It'll do useful things with it like converting
# name. It'll do useful things with it like converting
# the incoming unicode to an ASCII string.
# the incoming unicode to an ASCII string.
name
=
chooser
.
chooseName
(
name
,
cont
ainer
)
name
=
chooser
.
chooseName
(
name
,
cont
ent
)
content
.
id
=
name
content
.
id
=
name
container
.
_setObject
(
name
,
content
)
container
.
_setObject
(
name
,
content
)
...
@@ -94,18 +92,12 @@ class BasicAdding(BrowserView):
...
@@ -94,18 +92,12 @@ class BasicAdding(BrowserView):
# XXX this is definitely not right for all or even most uses
# XXX this is definitely not right for all or even most uses
# of Five, but can be overridden by an AddView subclass, using
# of Five, but can be overridden by an AddView subclass, using
# the class attribute of a zcml:addform directive
# the class attribute of a zcml:addform directive
return
str
(
getMultiAdapter
((
self
.
context
,
self
.
request
),
return
absoluteURL
(
self
.
context
,
self
.
request
)
+
'/manage_main'
name
=
u"absolute_url"
))
+
'/manage_main'
# set in BrowserView.__init__
# set in BrowserView.__init__
request
=
None
request
=
None
context
=
None
context
=
None
def
renderAddButton
(
self
):
warn
(
"The renderAddButton method is deprecated, use nameAllowed"
,
DeprecationWarning
,
2
)
def
publishTraverse
(
self
,
request
,
name
):
def
publishTraverse
(
self
,
request
,
name
):
"""See zope.publisher.interfaces.IPublishTraverse"""
"""See zope.publisher.interfaces.IPublishTraverse"""
if
'='
in
name
:
if
'='
in
name
:
...
@@ -127,7 +119,7 @@ class BasicAdding(BrowserView):
...
@@ -127,7 +119,7 @@ class BasicAdding(BrowserView):
factory
=
queryUtility
(
IFactory
,
name
)
factory
=
queryUtility
(
IFactory
,
name
)
if
factory
is
None
:
if
factory
is
None
:
return
super
(
Basic
Adding
,
self
).
publishTraverse
(
request
,
name
)
return
super
(
Adding
,
self
).
publishTraverse
(
request
,
name
)
return
factory
return
factory
...
@@ -143,11 +135,10 @@ class BasicAdding(BrowserView):
...
@@ -143,11 +135,10 @@ class BasicAdding(BrowserView):
else
:
else
:
view_name
=
type_name
view_name
=
type_name
if
(
queryMultiAdapter
((
self
,
self
.
request
),
name
=
view_name
)
if
queryMultiAdapter
((
self
,
self
.
request
),
is
not
None
)
:
name
=
view_name
)
is
not
None
:
url
=
"%s/%s=%s"
%
(
url
=
"%s/%s=%s"
%
(
getMultiAdapter
((
self
,
self
.
request
),
name
=
u"absolute_url"
),
absoluteURL
(
self
,
self
.
request
),
type_name
,
id
)
type_name
,
id
)
self
.
request
.
response
.
redirect
(
url
)
self
.
request
.
response
.
redirect
(
url
)
return
return
...
@@ -162,16 +153,10 @@ class BasicAdding(BrowserView):
...
@@ -162,16 +153,10 @@ class BasicAdding(BrowserView):
self
.
add
(
content
)
self
.
add
(
content
)
self
.
request
.
response
.
redirect
(
self
.
nextURL
())
self
.
request
.
response
.
redirect
(
self
.
nextURL
())
def
namesAccepted
(
self
):
return
not
IContainerNamesContainer
.
providedBy
(
self
.
context
)
def
nameAllowed
(
self
):
def
nameAllowed
(
self
):
"""Return whether names can be input by the user."""
"""Return whether names can be input by the user."""
return
not
IContainerNamesContainer
.
providedBy
(
self
.
context
)
return
not
IContainerNamesContainer
.
providedBy
(
self
.
context
)
class
Adding
(
BasicAdding
):
menu_id
=
None
menu_id
=
None
index
=
ViewPageTemplateFile
(
"adding.pt"
)
index
=
ViewPageTemplateFile
(
"adding.pt"
)
...
...
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