Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/local.cfg
.coverage
*.egg-info
*.eggs
/.installed.cfg
*.pyc
/.Python
Expand All @@ -21,4 +22,5 @@ docs/Makefile
docs/make.bat
docs/doctrees
docs/html
htmlcov
bower_components
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Changelog
=========

0.1-dev (unreleased)
--------------------

- Package created using templer
[]
6 changes: 6 additions & 0 deletions CONTRIBUTORS.rst
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
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. contents::

Introduction
============
32 changes: 21 additions & 11 deletions bootstrap.py → bootstrap-buildout.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.

Note that by using --find-links to point to local resources, you can keep
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''

Expand All @@ -59,6 +59,8 @@
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")


options, args = parser.parse_args()
Expand All @@ -75,20 +77,24 @@
from urllib2 import urlopen

ez = {}
exec(urlopen('https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py'
).read(), ez)
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)

if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]

setup_args = dict(to_dir=tmpeggs, download_delay=0)

if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version

ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources
Expand Down Expand Up @@ -128,10 +134,15 @@
_final_parts = '*final-', '*final'

def _final_version(parsed_version):
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True

index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
Expand All @@ -158,8 +169,7 @@ def _final_version(parsed_version):
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s",
repr(cmd)[1:-1])
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

######################################################################
# Import and run buildout
Expand Down
61 changes: 48 additions & 13 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
[buildout]
extends = http://dist.plone.org/release/4.3-latest/versions.cfg
find-links =
http://localhost:3141/root/pypi/+simple/
http://dist.plone.org/release/4.3-latest/
http://dist.plone.org/thirdparty/

#develop = .
extends = http://dist.plone.org/release/4.3.4/versions.cfg
extensions = mr.developer
parts =
instance
test
coverage
report
test-coverage
code-analysis
sphinxbuilder
sphinx-python
templer

[versions]
setuptools = 2.1
zc.buildout = 2.2.1
zope.interface = 4.0.5
develop = .

[instance]
recipe = plone.recipe.zope2instance
Expand All @@ -24,17 +20,51 @@ http-address = 8080
eggs =
Plone
Pillow
# plone.restapi [test]
plone.app.debugtoolbar
plone.restapi [test]

[test]
recipe = zc.recipe.testrunner
eggs = ${instance:eggs}
defaults = ['-s', 'plone.restapi', '--auto-color', '--auto-progress']

[coverage]
recipe = zc.recipe.egg
eggs = coverage
initialization =
include = '--source=${buildout:directory}/src/plone.restapi'
sys.argv = sys.argv[:] + ['run', include, 'bin/test']

[report]
recipe = zc.recipe.egg
eggs = coverage
scripts = coverage=report
initialization =
sys.argv = sys.argv[:] + ['html', '-i']

[test-coverage]
recipe = collective.recipe.template
input = inline:
#!/bin/sh
${buildout:directory}/bin/coverage
${buildout:directory}/bin/report
output = ${buildout:directory}/bin/test-coverage
mode = 755

[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/src

[sphinxbuilder]
recipe = collective.recipe.sphinxbuilder
source = ${buildout:directory}/docs/source
build = ${buildout:directory}/docs
interpreter = ${buildout:directory}/bin/${sphinx-python:interpreter}

[sphinx-python]
recipe = zc.recipe.egg
eggs = sphinx_rtd_theme
interpreter = sphinxPython

[templer]
recipe = zc.recipe.egg
Expand All @@ -44,3 +74,8 @@ eggs =
templer.buildout
templer.plone
templer.dexterity

[versions]
setuptools = 8.3
zc.buildout = 2.3.1
zope.interface = 4.0.5
21 changes: 21 additions & 0 deletions docs/source/_json/document.json
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"
}
24 changes: 24 additions & 0 deletions docs/source/_json/folder.json
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": ""
}
12 changes: 8 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# plone.restapi documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 28 13:04:12 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
Expand All @@ -18,14 +19,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))

# -- General configuration -----------------------------------------------------
# -- General configuration ----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
extensions = ['sphinx_rtd_theme']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -91,7 +92,10 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
#html_theme = 'default'
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
20 changes: 19 additions & 1 deletion docs/source/hydra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will check...

:language: json-ld
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json-ld or jsonld?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are valid.



Resource Operations / CRUD
--------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Contents
.. toctree::
:maxdepth: 3

hydra
item
folder
site-search
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[templer.local]
template = plone_basic

56 changes: 56 additions & 0 deletions setup.py
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"],
)
Loading