-
-
Notifications
You must be signed in to change notification settings - Fork 104
Add plone.restapi pkg with docs, tests and basic implementation of a read-only API. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
df0607c
Fix buildout.
tisto b6e1e16
Add plone.restapi pkg.
tisto 40cffa4
Clean up pkg.
tisto 309af1d
Add code analysis.
tisto dd2c4df
Pep8.
tisto f05588f
Implement ISerializeToJson adapter.
tisto f790fb0
Add SerializeSiteRootToJson adapter.
tisto db80679
Fix unauthorized on non-published folders.
tisto 19a342a
Add test coverage.
tisto 48cda82
Add notes why we need to wrap the json response into a browser view.
tisto 6f2a17f
Implement an IBeforeTraverseEvent subscriber to set the IAPIRequest i…
tisto 7a34489
Fix the APISiteRootTraverser.
tisto 6b6e36b
Rename test_traversal.
tisto 304643d
Rename *.txt -> *.rst; Add real world generated json data to docs.
tisto b938290
Add json files for tests.
tisto 0de1616
Add test_documentation.py.
tisto f6aa40e
Move src dir one level up.
tisto 848c5a9
Use readthedocs sphinx theme.
tisto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [report] | ||
| omit = | ||
| src/plone.restapi/src/plone/restapi/tests/test_robot |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Changelog | ||
| ========= | ||
|
|
||
| 0.1-dev (unreleased) | ||
| -------------------- | ||
|
|
||
| - Package created using templer | ||
| [] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Note: place names and roles of the people who contribute to this package | ||
| in this file, one to a line, like so: | ||
|
|
||
| - Joe Schmoe, Original Author | ||
| - Bob Slob, contributed monkey patches | ||
| - Jane Main, wrote flibberty module |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .. contents:: | ||
|
|
||
| Introduction | ||
| ============ |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "@context": "http://www.w3.org/ns/hydra/context.jsonld", | ||
| "@id": "http://localhost:55001/plone/front-page", | ||
| "@type": "Resource", | ||
| "contributors": [], | ||
| "creators": [ | ||
| "test_user_1_" | ||
| ], | ||
| "description": "Congratulations! You have successfully installed Plone.", | ||
| "effective": "1969-12-31T00:00:00+01:00", | ||
| "exclude_from_nav": "False", | ||
| "expires": "2499-12-31T00:00:00+01:00", | ||
| "icon": "++resource++plone.dexterity.item.gif", | ||
| "isPrincipiaFolderish": "0", | ||
| "language": "", | ||
| "meta_type": "Dexterity Item", | ||
| "relatedItems": [], | ||
| "rights": "", | ||
| "text": "<p>If you're seeing this instead of the web site you were expecting, the owner of this web site has just installed Plone. Do not contact the Plone Team or the Plone mailing lists about this.</p>", | ||
| "title": "Welcome to Plone" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "@context": "http://www.w3.org/ns/hydra/context.jsonld", | ||
| "@id": "http://localhost:55001/plone/folder1", | ||
| "@type": "Collection", | ||
| "contributors": [], | ||
| "creators": [ | ||
| "test_user_1_" | ||
| ], | ||
| "description": "", | ||
| "effective": "1969-12-31T00:00:00+01:00", | ||
| "exclude_from_nav": "False", | ||
| "expires": "2499-12-31T00:00:00+01:00", | ||
| "icon": "++resource++plone.dexterity.item.gif", | ||
| "isAnObjectManager": "1", | ||
| "isPrincipiaFolderish": "1", | ||
| "language": "", | ||
| "member": [], | ||
| "meta_type": "Dexterity Container", | ||
| "meta_types": [], | ||
| "nextPreviousEnabled": "False", | ||
| "relatedItems": [], | ||
| "rights": "", | ||
| "title": "" | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ Plone Portal Root (A Hydra Collection):: | |
| ] | ||
| } | ||
|
|
||
|
|
||
| - @context: Defines what kind of resource this is and the meaning of the | ||
| terms used within this resource. | ||
| - @id: Unique identifier for resources (IRIs). The @id property can be used to | ||
|
|
@@ -76,6 +75,25 @@ Plone Document (A Hydra Resource):: | |
| "text": "<p>Lorem Ipsum</p>", | ||
| } | ||
|
|
||
| Implementation | ||
| -------------- | ||
|
|
||
| Plone Document: | ||
|
|
||
| .. literalinclude:: _json/document.json | ||
| :language: jsonld | ||
|
|
||
| Plone Folder: | ||
|
|
||
| .. literalinclude:: _json/folder.json | ||
| :language: jsonld | ||
|
|
||
|
|
||
| Plone Portal Root: | ||
|
|
||
| .. literalinclude:: _json/siteroot.json | ||
| :language: json-ld | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both are valid. |
||
|
|
||
|
|
||
| Resource Operations / CRUD | ||
| -------------------------- | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ Contents | |
| .. toctree:: | ||
| :maxdepth: 3 | ||
|
|
||
| hydra | ||
| item | ||
| folder | ||
| site-search | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [templer.local] | ||
| template = plone_basic | ||
|
|
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| from setuptools import setup, find_packages | ||
|
|
||
| version = '0.1' | ||
|
|
||
| long_description = ( | ||
| open('README.rst').read() | ||
| + '\n' + | ||
| 'Contributors\n' | ||
| '============\n' | ||
| + '\n' + | ||
| open('CONTRIBUTORS.rst').read() | ||
| + '\n' + | ||
| open('CHANGES.rst').read() | ||
| + '\n') | ||
|
|
||
| setup(name='plone.restapi', | ||
| version=version, | ||
| description="RESTful API for Plone", | ||
| long_description=long_description, | ||
| # Get more strings from | ||
| # http://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
| classifiers=[ | ||
| "Environment :: Web Environment", | ||
| "Framework :: Plone", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python", | ||
| "Programming Language :: Python :: 2.6", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| ], | ||
| keywords='', | ||
| author='Timo Stollenwerk', | ||
| author_email='tisto@plone.org', | ||
| url='https://github.com/plone/plone.restapi/', | ||
| license='gpl', | ||
| packages=find_packages('src'), | ||
| package_dir={'': 'src'}, | ||
| namespace_packages=['plone', ], | ||
| include_package_data=True, | ||
| zip_safe=False, | ||
| install_requires=[ | ||
| 'setuptools', | ||
| 'plone.validatehook', | ||
| ], | ||
| extras_require={'test': [ | ||
| 'plone.app.contenttypes', | ||
| 'plone.app.testing[robot]>=4.2.2', | ||
| 'requests', | ||
| ]}, | ||
| entry_points=""" | ||
| # -*- Entry points: -*- | ||
| [z3c.autoinclude.plugin] | ||
| target = plone | ||
| """, | ||
| setup_requires=["PasteScript"], | ||
| paster_plugins=["templer.localcommands"], | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this file is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check...