-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @@allow_upload view, which returns a JSON string to indicate if F…
…ile or Image uploads are allowed in the current container.
- Loading branch information
Showing
5 changed files
with
63 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
from Products.Five.browser import BrowserView | ||
import json | ||
|
||
|
||
class AllowedTypesInContext(BrowserView): | ||
|
||
def __call__(self): | ||
"""Return JSON structure with all allowed content type ids from the | ||
current container. | ||
""" | ||
|
||
self.request.response.setHeader( | ||
'Content-Type', 'application/json; charset=utf-8' | ||
) | ||
allowed_types = [t.getId() for t in self.context.allowedContentTypes()] | ||
return json.dumps({'allowed_types': allowed_types}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters