Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.4' into stable
Browse files Browse the repository at this point in the history
* release/1.0.0-alpha.4: (34 commits)
  Bump version.
  Also use new requirements in the scaffold.
  Add a changenote.  [ci skip]
  Update all requirements except alembic to their latest versions.
  Added a paragraph in the developer manual about registering views for context
  Also test counter increase when blacklist has names with numbers
  Improve title_to_name handling of numbers in titles
  Added changelog entry for restricting add views
  Everybody loves badges, let's have them all!  [ci skip]
  Try to add coveralls to Travis config.
  CHANGES.txt: Add note about Docker support (#245)
  README.rst: Link to Pyramid and SQLAlchemy
  README.rst: Add PyPI badge; moved badges to top
  Bootstrap isn't called "Twitter Bootstrap" for a while now.  [ci skip]
  README.rst: Wrap long line
  Move Docker section to the bottom, as it's labelled "experimental".  [ci skip]
  README.rst: Add link to installation instructions
  Add instructions for Docker
  Add Kotti itself to requirements.  This resolves #373.
  Added a paragraph in the developer manual about registering views for context
  ...
  • Loading branch information
disko committed Jan 29, 2015
2 parents f97ccda + 0679302 commit 97c0ffb
Show file tree
Hide file tree
Showing 17 changed files with 292 additions and 52 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: python
sudo: false
python:
- "2.6"
- "2.7"
Expand All @@ -7,14 +8,17 @@ env:
- KOTTI_TEST_DB_STRING=mysql+oursql://root@localhost:3306/kotti_testing
- KOTTI_TEST_DB_STRING=sqlite://
install:
- pip install "pip==1.3.1" # fix issue with fanstatic==1.0a
- pip install -e . -r requirements.txt
- travis_retry pip install "pip==1.3.1" # fix issue with fanstatic==1.0a
- travis_retry pip install -e . -r requirements.txt --use-mirrors
- python setup.py dev
- pip install psycopg2 oursql
- travis_retry pip install psycopg2 oursql python-coveralls
before_script:
- psql -c 'create database kotti_testing;' -U postgres
- mysql -e 'create database kotti_testing;'
script: py.test --runslow --tb=native --cov=kotti --cov-report=term-missing
script:
- py.test --runslow --tb=native --cov=kotti --cov-report=term-missing
after_success:
- coveralls
notifications:
irc: "irc.freenode.org#kotti"
email: false
16 changes: 16 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Change History
==============

1.0.0-alpha.4 - 2015-01-29
--------------------------

- Added experimental Docker support. See #374.

- Allow restricting *add views* to specific contexts. This allows third party
developers to register new content types that are addable in specific
type of contexts, by specifying ``context=SomeContentType`` in their
*add view* registration and having ``type_info.addable=['SomeContentType']``
in the type info.

- For documents with duplicate titles that end in a number, append a counter
instead of incrementing their number. Fixes #245

- Update all requirements (except alembic) to their latest respective versions.

1.0.0-alpha.3 - 2015-01-13
--------------------------

Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------
# This is a Dockerfile to build an Ubuntu 14.04 Docker image with
# Kotti
#
# Use a command like:
# docker build -t <user>/kotti .
# --------------------------------------------------------------------------

FROM orchardup/python:2.7
MAINTAINER Marc Abramowitz <marc@marc-abramowitz.com> (@msabramo)

RUN pip install -r https://raw.github.com/Kotti/Kotti/stable/requirements.txt
ADD app.ini .

EXPOSE 5000

CMD ["pserve", "app.ini", "host=0.0.0.0"]
93 changes: 82 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,38 @@
Kotti
=====

Kotti is a high-level, Pythonic web application framework based on Pyramid and SQLAlchemy.
|pypi|_
|downloads_month|_
|license|_
|build status stable|_

.. |pypi| image:: https://img.shields.io/pypi/v/Kotti.svg?style=flat-square
.. _pypi: https://pypi.python.org/pypi/Kotti/

.. |downloads_month| image:: https://img.shields.io/pypi/dm/Kotti.svg?style=flat-square
.. _downloads_month: https://pypi.python.org/pypi/Kotti/

.. |license| image:: https://img.shields.io/pypi/l/Kotti.svg?style=flat-square
.. _license: http://www.repoze.org/LICENSE.txt

.. |build status stable| image:: https://img.shields.io/travis/Kotti/Kotti/stable.svg?style=flat-square
.. _build status stable: http://travis-ci.org/Kotti/Kotti

Kotti is a high-level, Pythonic web application framework based on Pyramid_ and SQLAlchemy_.
It includes an extensible Content Management System called the Kotti CMS (see below).
|build status|_

Kotti is most useful when you are developing applications that

- have complex security requirements,
- use workflows, and/or
- work with hierarchical data.

Built on top of a number of *best-of-breed* software components, most notably Pyramid_ and SQLAlchemy_, Kotti introduces only a few concepts of its own, thus hopefully keeping the learning curve flat for the developer.
Built on top of a number of *best-of-breed* software components,
most notably Pyramid_ and SQLAlchemy_,
Kotti introduces only a few concepts of its own,
thus hopefully keeping the learning curve flat for the developer.


.. |build status| image:: https://secure.travis-ci.org/Kotti/Kotti.png?branch=stable
.. _build status: http://travis-ci.org/Kotti/Kotti
.. _Pyramid: http://docs.pylonsproject.org/projects/pyramid/dev/
.. _SQLAlchemy: http://www.sqlalchemy.org/

Expand All @@ -32,7 +50,7 @@ Its **main features** are:

- **WYSIWYG editor**: includes a rich text editor

- **Responsive design**: Kotti builds on `Twitter Bootstrap`_, which
- **Responsive design**: Kotti builds on `Bootstrap`_, which
looks good both on desktop and mobile

- **Templating**: you can extend the CMS with your own look & feel
Expand All @@ -50,14 +68,67 @@ Its **main features** are:

.. _Kotti's demo page: http://kottidemo.danielnouri.org/
.. _Plone: http://plone.org/
.. _Twitter Bootstrap: http://twitter.github.com/bootstrap/
.. _Bootstrap: http://getbootstrap.com/

License
=======

Kotti is offered under the BSD-derived `Repoze Public License <http://repoze.org/license.html>`_.

Install
=======

See `installation instructions`_.

.. _installation instructions: http://kotti.readthedocs.org/en/latest/first_steps/installation.html

Support and Documentation
=========================

`Click here to access Kotti's full documentation <http://kotti.readthedocs.org/>`_
Read Kotti's extensive `documentation <http://kotti.readthedocs.org/>`_ on `Read the Docs <https://readthedocs.org/>`_.

License
=======
If you have questions or need help, you can post on our `mailing list / forum <http://groups.google.com/group/kotti>`_ or join us on IRC: `#kotti on irc.freenode.net <irc://irc.freenode.net/#kotti>`_.

Kotti is offered under the BSD-derived `Repoze Public License <http://repoze.org/license.html>`_.
If you think you found a bug, open an issue on or `Github bugtracker <https://github.com/Kotti/Kotti/issues>`_.

Development
===========

|build status master|_
|coveralls|_
|codacy|_

.. requirements need to be upgraded before we shoff off
|requires.io|_
|gh_forks|_
|gh_stars|_

Kotti is actively developed and maintained.
We adhere to `high quality coding standards`_, have an extensive test suite with `high coverage`_ and use `continuous integration`_.

Contributions are always welcome, read our `contribution guidelines`_ and visit our `Github repository`_.

.. |build status master| image:: https://img.shields.io/travis/Kotti/Kotti/master.svg?style=flat-square
.. _build status master: http://travis-ci.org/Kotti/Kotti
.. _continuous integration: http://travis-ci.org/Kotti/Kotti

.. |requires.io| image:: https://img.shields.io/requires/github/Kotti/Kotti.svg?style=flat-square
.. _requires.io: https://requires.io/github/Kotti/Kotti/requirements/?branch=master

.. |gh_forks| image:: https://img.shields.io/github/forks/Kotti/Kotti.svg?style=flat-square
.. _gh_forks: https://github.com/Kotti/Kotti/network

.. |gh_stars| image:: https://img.shields.io/github/stars/Kotti/Kotti.svg?style=flat-square
.. _gh_stars: https://github.com/Kotti/Kotti/stargazers

.. |coveralls| image:: https://img.shields.io/coveralls/Kotti/Kotti.svg?style=flat-square
.. _coveralls: https://coveralls.io/r/Kotti/Kotti
.. _high coverage: https://coveralls.io/r/Kotti/Kotti

.. |codacy| image:: https://img.shields.io/codacy/ad44331fcd904d338c074f2ca3e6a810.svg?style=flat-square
.. _codacy: https://www.codacy.com/public/disko/Kotti
.. _high quality coding standards: https://www.codacy.com/public/disko/Kotti

.. _contribution guidelines: http://kotti.readthedocs.org/en/latest/contributing.html
.. _Github repository: https://github.com/Kotti/Kotti
6 changes: 6 additions & 0 deletions docs/developing/basic/developer-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Document content type serves as an example here:
self.body = body
self.mime_type = mime_type
The ``add_view`` parameter of the ``type_info`` attribute is the name of a view
that can be used to construct a ``Document`` instance. This view has to be
available for all content types specified in ``addable_to`` parameter. See the
section below and the :ref:`adding-forms-and-a-view` section in the tutorial on
how to define a view restricted to a specific context.

You can configure the list of active content types in Kotti by
modifying the :ref:`kotti.available_types` setting.

Expand Down
14 changes: 13 additions & 1 deletion docs/first_steps/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ It is recommended to install Kotti inside a virtualenv:
virtualenv mysite
cd mysite
bin/pip install -r https://raw.github.com/Kotti/Kotti/stable/requirements.txt
bin/pip install [--pre] Kotti
This will install the latest released version of Kotti and all its requirements into your virtualenv.

Expand Down Expand Up @@ -60,6 +59,19 @@ Kotti includes support for PostgreSQL, MySQL and SQLite (tested regularly), and
The default use of SQLite makes initial development easy.
Although SQLite may prove to be adequate for some deployments, Kotti is flexible for installation of your choice of database during development or at deployment.

Installation using Docker (experimental)
----------------------------------------

This assumes that you already have Docker_ installed:

.. parsed-literal::
docker pull kotti/kotti
docker run -i -t -p 5000:5000 kotti/kotti
This should get you a running Kotti instance on port 5000.

.. _other SQL databases: http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
.. _Paste Deploy: http://pythonpaste.org/deploy/#the-config-file
.. _Docker: http://docker.io/
21 changes: 12 additions & 9 deletions docs/first_steps/tut-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ Things to note here:

- ``Poll`` derives from :class:`kotti.resources.Content`, which is the common base class for all content types.

- ``Poll`` declares a sqla.Column ``id``, which is required to hook it up with SQLAlchemy's inheritance.
- ``Poll`` declares a :class:`sqlalchemy.Column <sqlalchemy.schema>` ``id``, which is required to hook it up with SQLAlchemy's inheritance.

- The type_info class attribute does essential configuration.
- The ``type_info`` class attribute does essential configuration.
We refer to name and title, two properties already defined as part of
``Content``, our base class.
The ``add_view`` defines the name of the add view, which we'll come to in a second. Finally, ``addable_to`` defines which content types we can add ``Poll`` items to.
The ``add_view`` defines the name of the add view, which we'll come to in a second.
Finally, ``addable_to`` defines which content types we can add ``Poll`` items to.

- We do not need to define any additional sqlaColumn() properties, as the title
- We do not need to define any additional :class:`sqlalchemy.Column <sqlalchemy.schema>` properties, as the ``title``
is the only property we need for this content type.

We'll add another content class to hold the choices for the poll.
Expand Down Expand Up @@ -79,14 +80,16 @@ Notable differences are:

- The ``type_info`` defines the title, the ``add_view`` view, and that choices may only be added *into* ``Poll`` items, with the line ``addable_to=[u'Poll']``.

.. _adding-forms-and-a-view:

Adding Forms and a View
-----------------------

Views (including forms) are typically put into a module called ``views``.
The Kotti scaffolding further separates this into ``view`` and ``edit`` files inside a ``views`` directory.

Open the file at ``kotti_mysite/kotti_mysite/views/edit.py``.
It already contains code for the `CustomContent` sample content type.
It already contains code for the ``CustomContent`` sample content type.
We will take advantage of the imports already there.

.. code-block:: python
Expand Down Expand Up @@ -169,11 +172,11 @@ Add this to ``views/edit.py``:
Using the ``AddFormView`` and ``EditFormView`` base classes from Kotti, these forms are simple to define.
We associate the schemas defined above, setting them as the schema_factory for each form, and we specify the content types to be added by each.
We associate the schemas defined above, setting them as the ``schema_factory`` for each form, and we specify the content types to be added by each.

We use ``@view_config`` to add our views to the application.
This takes advantage of a ``config.scan()`` call in ``__init__.py`` discussed below.
Notice that we can declare `permission`, `context`, and a `template` for each form, along with its `name`.
Notice that we can declare ``permission``, ``context``, and a ``template`` for each form, along with its ``name``.

Wiring up the Content Types and Forms
-------------------------------------
Expand All @@ -197,9 +200,9 @@ Open ``__init__.py`` and modify the ``kotti_configure`` method so that the
...
Here, we've added our two content types to the site's available_types, a global
Here, we've added our two content types to the site's ``available_types``, a global
registry.
We also removed the CustomContent content type included with the scaffolding.
We also removed the ``CustomContent`` content type included with the scaffolding.

Notice the ``includeme`` method at the bottom of ``__init__.py``.
It includes the call to ``config.scan()`` that we mentioned above while discussing the ``@view_config`` statements in our views.
Expand Down
2 changes: 1 addition & 1 deletion kotti/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class subscribe(object):
from kotti.events import ObjectInsert
from kotti.events import subscribe
from kotti.resurces import Document
from kotti.resources import Document
@subscribe()
def on_all_events(event):
Expand Down
10 changes: 5 additions & 5 deletions kotti/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def children_with_permission(self, request, permission='view'):


class LocalGroup(Base):
""" Local groups allow the assignment of groups or roles to pricipals
""" Local groups allow the assignment of groups or roles to principals
(users or groups) **for a certain context** (i.e. a :class:`Node` in the
content tree).
"""
Expand Down Expand Up @@ -227,10 +227,10 @@ class Node(Base, ContainerMixin, PersistentACLMixin):
#: Name of the node as used in the URL
#: (:class:`sqlalchemy.types.Unicode`)
name = Column(Unicode(50), nullable=False)
#: Title of the node, e.g. as shown in serach results
#: Title of the node, e.g. as shown in search results
#: (:class:`sqlalchemy.types.Unicode`)
title = Column(Unicode(100))
#: Annotations can be used to store arbitray data in a nested dictionary
#: Annotations can be used to store arbitrary data in a nested dictionary
#: (:class:`kotti.sqla.NestedMustationDict`)
annotations = Column(NestedMutationDict.as_mutable(JsonType))
#: The path can be used to efficiently filter for child objects
Expand Down Expand Up @@ -376,8 +376,8 @@ def addable(self, context, request):
:rtype: Boolean
"""

if view_permitted(context, request, self.add_view):
return context.type_info.name in self.addable_to
if context.type_info.name in self.addable_to:
return view_permitted(context, request, self.add_view)
else:
return False

Expand Down
2 changes: 1 addition & 1 deletion kotti/scaffolds/package/+package+/views/edit.py_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ class CustomContentAddForm(AddFormView):
@view_config(name='edit', context=CustomContent, permission='edit',
renderer='kotti:templates/edit/node.pt')
class CustomContentEditForm(EditFormView):
""" Form to edit existing calendars. """
""" Form to edit existing CustomContent objects. """

schema_factory = CustomContentSchema
1 change: 0 additions & 1 deletion kotti/scaffolds/package/requirements.txt

This file was deleted.

0 comments on commit 97c0ffb

Please sign in to comment.