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$
__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
getUtility
from
zope.component
import
queryMultiAdapter
from
zope.component
import
queryUtility
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.interfaces
import
IContainerNamesContainer
from
zope.container.interfaces
import
INameChooser
from
zope.event
import
notify
from
zope.exceptions.interfaces
import
UserError
from
zope.interface
import
implements
from
zope.lifecycleevent
import
ObjectCreatedEvent
from
zope.publisher.interfaces
import
IPublishTraverse
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
OFS.SimpleItem
import
SimpleItem
...
...
@@ -51,7 +48,8 @@ from OFS.SimpleItem import SimpleItem
from
Products.Five
import
BrowserView
from
Products.Five.browser.pagetemplatefile
import
ViewPageTemplateFile
class
BasicAdding
(
BrowserView
):
class
Adding
(
BrowserView
):
implements
(
IAdding
,
IPublishTraverse
)
def
add
(
self
,
content
):
...
...
@@ -80,7 +78,7 @@ class BasicAdding(BrowserView):
# Invoke the name chooser even when we have a
# name. It'll do useful things with it like converting
# the incoming unicode to an ASCII string.
name
=
chooser
.
chooseName
(
name
,
cont
ainer
)
name
=
chooser
.
chooseName
(
name
,
cont
ent
)
content
.
id
=
name
container
.
_setObject
(
name
,
content
)
...
...
@@ -94,18 +92,12 @@ class BasicAdding(BrowserView):
# XXX this is definitely not right for all or even most uses
# of Five, but can be overridden by an AddView subclass, using
# the class attribute of a zcml:addform directive
return
str
(
getMultiAdapter
((
self
.
context
,
self
.
request
),
name
=
u"absolute_url"
))
+
'/manage_main'
return
absoluteURL
(
self
.
context
,
self
.
request
)
+
'/manage_main'
# set in BrowserView.__init__
request
=
None
context
=
None
def
renderAddButton
(
self
):
warn
(
"The renderAddButton method is deprecated, use nameAllowed"
,
DeprecationWarning
,
2
)
def
publishTraverse
(
self
,
request
,
name
):
"""See zope.publisher.interfaces.IPublishTraverse"""
if
'='
in
name
:
...
...
@@ -127,7 +119,7 @@ class BasicAdding(BrowserView):
factory
=
queryUtility
(
IFactory
,
name
)
if
factory
is
None
:
return
super
(
Basic
Adding
,
self
).
publishTraverse
(
request
,
name
)
return
super
(
Adding
,
self
).
publishTraverse
(
request
,
name
)
return
factory
...
...
@@ -143,11 +135,10 @@ class BasicAdding(BrowserView):
else
:
view_name
=
type_name
if
(
queryMultiAdapter
((
self
,
self
.
request
),
name
=
view_name
)
is
not
None
)
:
if
queryMultiAdapter
((
self
,
self
.
request
),
name
=
view_name
)
is
not
None
:
url
=
"%s/%s=%s"
%
(
getMultiAdapter
((
self
,
self
.
request
),
name
=
u"absolute_url"
),
type_name
,
id
)
absoluteURL
(
self
,
self
.
request
),
type_name
,
id
)
self
.
request
.
response
.
redirect
(
url
)
return
...
...
@@ -162,16 +153,10 @@ class BasicAdding(BrowserView):
self
.
add
(
content
)
self
.
request
.
response
.
redirect
(
self
.
nextURL
())
def
namesAccepted
(
self
):
return
not
IContainerNamesContainer
.
providedBy
(
self
.
context
)
def
nameAllowed
(
self
):
"""Return whether names can be input by the user."""
return
not
IContainerNamesContainer
.
providedBy
(
self
.
context
)
class
Adding
(
BasicAdding
):
menu_id
=
None
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