Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-alpha.3' into stable
Browse files Browse the repository at this point in the history
* release/1.0.0-alpha.3:
  Bump version.
  Added changelog entry, added myself to contributors
  Fix pep8 problems
  Simplify workaround. Change test to make it Kotti specific
  A request cannot be subclassed and then properties added; Added a test and a workaround for this
  Updated the year.
  added test for Request
  Fixed view names
  Remove kotti.includes default
  Add docstrings to ``resources.LocalGroup``.  [ci skip]
  Add docstrings.  [ci skip]
  Order API docs by source.  [ci skip]
  Bump version.
  • Loading branch information
disko committed Jan 13, 2015
2 parents 07f4f37 + 4a51f59 commit f97ccda
Show file tree
Hide file tree
Showing 39 changed files with 83 additions and 15 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Change History
==============

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

- Explicitly implement ``pyramid.interfaces.IRequest`` for
``kotti.request.Request``. This allows add-on packages to use
``config.add_request_method`` (with reify) and
``config.add_request_property`` without breaking the interfaces provided by
the request. Fixes #369

1.0.0-alpha.2 - 2015-01-01
--------------------------

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,4 @@ Contributors
- Fabien Castarède, 2013/08/08
- Natan Žabkar, 2013/08/28
- Ionică Bizău, 2014/04/09
- Ichim Tiberiu, 2015/01/13
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Copyright (c) 2010-2014 Daniel Nouri and Contributors.
Copyright (c) 2010-2015 Daniel Nouri and Contributors.
All Rights Reserved
2 changes: 1 addition & 1 deletion docs/api/kotti.events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kotti.events

.. automodule:: kotti.events
:members:

:member-order: bysource
2 changes: 1 addition & 1 deletion docs/api/kotti.fanstatic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kotti.fanstatic

.. automodule:: kotti.fanstatic
:members:

:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.message

.. automodule:: kotti.message
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.migrate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.migrate

.. automodule:: kotti.migrate
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.populate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.populate

.. automodule:: kotti.populate
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.request.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.request

.. automodule:: kotti.request
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.resources

.. automodule:: kotti.resources
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.security

.. automodule:: kotti.security
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.sqla.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.sqla

.. automodule:: kotti.sqla
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.testing

.. automodule:: kotti.testing
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.tests

.. automodule:: kotti.tests
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.util

.. automodule:: kotti.util
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ kotti.views

.. automodule:: kotti.views
:members:
:member-order: bysource

.. toctree::
:maxdepth: 3
Expand Down
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.cache

.. automodule:: kotti.views.cache
:members:
:member-order: bysource
2 changes: 1 addition & 1 deletion docs/api/kotti.views/kotti.views.edit/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotti.views.edit

.. automodule:: kotti.views.edit
:members:

:member-order: bysource

.. toctree::
:maxdepth: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.edit.actions

.. automodule:: kotti.views.edit.actions
:members:
:member-order: bysource
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.edit.content

.. automodule:: kotti.views.edit.content
:members:
:member-order: bysource
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.edit.default_views

.. automodule:: kotti.views.edit.default_views
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.file

.. automodule:: kotti.views.file
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.form

.. automodule:: kotti.views.form
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.image

.. automodule:: kotti.views.image
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.login.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.login

.. automodule:: kotti.views.login
:members:
:member-order: bysource
2 changes: 1 addition & 1 deletion docs/api/kotti.views/kotti.views.site_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kotti.views.site_setup

.. automodule:: kotti.views.site_setup
:members:

:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.slots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.slots

.. automodule:: kotti.views.slots
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.users

.. automodule:: kotti.views.users
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.util

.. automodule:: kotti.views.util
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.views/kotti.views.view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.views.view

.. automodule:: kotti.views.view
:members:
:member-order: bysource
1 change: 1 addition & 0 deletions docs/api/kotti.workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kotti.workflow

.. automodule:: kotti.workflow
:members:
:member-order: bysource
2 changes: 1 addition & 1 deletion docs/developing/basic/developer-manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ These views are :class:`kotti.views.users.UsersManage`,
:class:`kotti.views.users.UserManage` and
:class:`kotti.views.users.Preferences`. Notice that you should
override them using the standard way, that is, by overriding
``setup_users``, ``setup_user`` or ``prefs`` views. Then you can
``setup-users``, ``setup-user`` or ``prefs`` views. Then you can
override any sub-view used inside them as well as include any logic
for your usecase when it is called, if needed.

Expand Down
1 change: 0 additions & 1 deletion kotti/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def none_factory(**kwargs): # pragma: no cover
'kotti.templates.api': 'kotti.views.util.TemplateAPI',
'kotti.configurators': '',
'pyramid.includes': '',
'kotti.includes': '', # BBB
'kotti.base_includes': ' '.join([
'kotti',
'kotti.events',
Expand Down
4 changes: 4 additions & 0 deletions kotti/request.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# -*- coding: utf-8 -*-

from zope.interface import implementer

from pyramid.decorator import reify
from pyramid.interfaces import IRequest
from pyramid.request import Request as BaseRequest


@implementer(IRequest)
class Request(BaseRequest):
""" Kotti subclasses :class:`pyramid.request.Request` to make additional
attributes / methods available on request objects and override Pyramid's
Expand Down
28 changes: 22 additions & 6 deletions kotti/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@


class ContainerMixin(object, DictMixin):
"""Containers form the API of a Node that's used for subitem
""" Containers form the API of a Node that's used for subitem
access and in traversal.
"""

Expand All @@ -82,7 +82,7 @@ def __delitem__(self, key):

def keys(self):
"""
:result: A list of children names.
:result: children names
:rtype: list
"""

Expand Down Expand Up @@ -131,20 +131,24 @@ def __getitem__(self, path):

@hybrid_property
def children(self):
"""Return *all* child nodes without considering permissions."""
"""
:result: *all* child nodes without considering permissions.
:rtype: list
"""

return self._children

def children_with_permission(self, request, permission='view'):
"""
Return only those children for which the user initiating
the request has the asked permission.
""" Return only those children for which the user initiating the
request has the asked permission.
:param request: current request
:type request: :class:`kotti.request.Request`
:param permission: The permission for which you want the allowed
children
:type permission: str
:result: List of child nodes
:rtype: list
"""
Expand All @@ -156,15 +160,27 @@ def children_with_permission(self, request, permission='view'):


class LocalGroup(Base):
""" Local groups allow the assignment of groups or roles to pricipals
(users or groups) **for a certain context** (i.e. a :class:`Node` in the
content tree).
"""

__tablename__ = 'local_groups'
__table_args__ = (
UniqueConstraint('node_id', 'principal_name', 'group_name'),
)

#: Primary key for the node in the DB
#: (:class:`sqlalchemy.types.Integer`)
id = Column(Integer(), primary_key=True)
#: ID of the node for this assignment
#: (:class:`sqlalchemy.types.Integer`)
node_id = Column(ForeignKey('nodes.id'))
#: Name of the principal (user or group)
#: (:class:`sqlalchemy.types.Unicode`)
principal_name = Column(Unicode(100))
#: Name of the assigned group or role
#: (:class:`sqlalchemy.types.Unicode`)
group_name = Column(Unicode(100))

def __init__(self, node, principal_name, group_name):
Expand Down
2 changes: 1 addition & 1 deletion kotti/templates/view/footer.pt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<hr />
<footer>
<p class="pull-right">&copy; Aliens 2014</p>
<p class="pull-right">&copy; Aliens 2015</p>
</footer>
4 changes: 4 additions & 0 deletions kotti/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# -*- coding: utf-8 -*-

"""
Fixture dependencies
--------------------
.. graphviz::
digraph kotti_fixtures {
Expand Down
11 changes: 11 additions & 0 deletions kotti/tests/test_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class TestExtendingRequest:

def test_it(self):
from kotti.request import Request
from zope.interface import providedBy, implementedBy

req = Request({})
req._set_properties({'marker': 'exists'})

assert providedBy(req) == implementedBy(Request)
assert req.marker == 'exists'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
install_requires.append('ordereddict')

setup(name='Kotti',
version='1.0.0-alpha.2',
version='1.0.0-alpha.3',
description="A high-level, Pythonic web application framework based on Pyramid and SQLAlchemy. It includes an extensible Content Management System called the Kotti CMS.", # noqa
long_description='\n\n'.join([README, AUTHORS, CHANGES]),
classifiers=[
Expand Down

0 comments on commit f97ccda

Please sign in to comment.