Skip to content

Commit

Permalink
cleanup: pep8, decorators, et al, pimped README
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Jul 30, 2015
1 parent ecb5efd commit 35a85a6
Show file tree
Hide file tree
Showing 25 changed files with 454 additions and 271 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
2.1.20 (unreleased)
-------------------

- Nothing changed yet.
- Cleanup: PEP8, decorators for zca, et al. Also pimped the README.
[jensens]


2.1.19 (2015-07-29)
Expand Down
141 changes: 111 additions & 30 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,50 +1,124 @@
Overview
========

A collection of generally useful vocabularies.
A collection of generally useful vocabularies for Plone.

It is implemented using ``zope.schema.vocabulary``.
Intended to be used as a base and example for custom vocabularies.


Common Named Vocabularies
=========================

* plone.app.vocabularies.AvailableContentLanguages
* plone.app.vocabularies.SupportedContentLanguages
* plone.app.vocabularies.Roles
* plone.app.vocabularies.Groups
* plone.app.vocabularies.AllowedContentTypes
* plone.app.vocabularies.AllowableContentTypes
* plone.app.vocabularies.PortalTypes
* plone.app.vocabularies.ReallyUserFriendlyTypes
* plone.app.vocabularies.UserFriendlyTypes
* plone.app.vocabularies.Skins
* plone.app.vocabularies.Workflows
* plone.app.vocabularies.WorkflowStates
* plone.app.vocabularies.WorkflowTransitions
* plone.app.vocabularies.AvailableEditors
* plone.app.vocabularies.Keywords
* plone.app.vocabularies.SyndicationFeedTypes
* plone.app.vocabularies.SyndicatableFeedItems
* plone.app.vocabularies.Users
* plone.app.vocabularies.Catalog


Date/Time Related Vocabularies
==============================
Languages
---------

``plone.app.vocabularies.AvailableContentLanguages``
all known languages

``plone.app.vocabularies.SupportedContentLanguages``
currently configured/supported content languages for the portal


Users, Groups, Security
-----------------------

``plone.app.vocabularies.Users``
user of the portal (searchable)

``plone.app.vocabularies.Groups``
groups of the portal (searchable)

``plone.app.vocabularies.Roles``
all possible roles in the portal

Text Input Field
----------------

``plone.app.vocabularies.AllowedContentTypes``
Configured allowed mime-types (text/\*) for text input fields

``plone.app.vocabularies.AllowableContentTypes``
All possible mime types (text/\*) for text input fields

``plone.app.vocabularies.AvailableEditors``
Configured WYSIWIG editors


Portal Types
------------

``plone.app.vocabularies.PortalTypes``
All portal-types installed in the portal

``plone.app.vocabularies.ReallyUserFriendlyTypes``
Static filtered list of portal-types.
Filter is a list of portal_type ids (strings) defined at ``plone.app.vocabularies.types.BAD_TYPES``.

``plone.app.vocabularies.UserFriendlyTypes``
Portal types filtered as 'user friendly' by the Types Tool.


Workflows
---------

``plone.app.vocabularies.Workflows``
All installed workflows

``plone.app.vocabularies.WorkflowStates``
All titles of workflow states - for any workflow installed

``plone.app.vocabularies.WorkflowTransitions``
All titles of workflow transitions - for any workflow installed


Syndication/ Feeds
------------------

``plone.app.vocabularies.SyndicationFeedTypes``
Configured allowed feed types

``plone.app.vocabularies.SyndicatableFeedItems``
Folders or Collections on the first two navigation levels (depth=2) relative to the site root.
Value is UID of the Folder or Collection, term is title of it
(searchable)


Catalog
-------

``plone.app.vocabularies.Keywords``
All Subjects aka Tags aka Keywords used by the portals content


``plone.app.vocabularies.Catalog``
Generic queryable catalog


Theme
-----

``plone.app.vocabularies.Skins``
Themes/ skins available in the portal.


Date/Time Related
-----------------

``plone.app.vocabularies.Timezones``
all timezones provided by ``pytz``
all timezones provided by `pytz <http://pythonhosted.org/pytz/>`_

``plone.app.vocabularies.CommonTimezones``
common timezones provided by ``pytz``. This are those
a user would choose from and is not too much confused.
common timezones provided by 'pytz'.
This are those a user would choose from and is not too much confused.

``plone.app.vocabularies.AvailableTimezones``
timezones configured in the portal.

``plone.app.vocabularies.Weekdays``
the seven weekdays in fullname. Value is the day number start counting
at zero on monday. Title of the term is an i18n messagestring in
``plonelocales`` namespace, so it translates.
the seven weekdays in fullname.
Value is the day number start counting at zero on monday.
Title of the term is an i18n messagestring in ``plonelocales`` namespace, so it translates.

``plone.app.vocabularies.WeekdaysAbbr``
same as above but with 3 character abbreviations.
Expand All @@ -58,3 +132,10 @@ Date/Time Related Vocabularies
``plone.app.vocabularies.MonthAbbr``
same as above but with 3 character abbreviations.


Source Code
===========

Contributors please read the document `Process for Plone core's development <http://docs.plone.org/develop/plone-coredev/index.html>`_

Sources are at the `Plone code repository hosted at Github <https://github.com/plone/plone.app.vocabularies>`_.
8 changes: 2 additions & 6 deletions plone/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
__import__('pkg_resources').declare_namespace(__name__)
8 changes: 2 additions & 6 deletions plone/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
__import__('pkg_resources').declare_namespace(__name__)
9 changes: 5 additions & 4 deletions plone/app/vocabularies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from zope.interface import implements
from zope.interface import directlyProvides
# -*- coding: utf-8 -*-
from plone.app.vocabularies.interfaces import ISlicableVocabulary
from zope.interface import directlyProvides
from zope.interface import implementer


@implementer(ISlicableVocabulary)
class SlicableVocabulary(object):
"""
A tokenized voacabulary in which the results can be sliced.
A tokenized vocabulary in which the results can be sliced.
This class does not implement a complete vocabulary. Instead you use
this class as a mixin to your vocabulary class.
This mixin class expects to be used with something resembling
a SimpleVocabulary. It accesses internal members like _terms
"""
implements(ISlicableVocabulary)

def __init__(self, terms=[], *interfaces):
self._terms = terms
Expand Down
12 changes: 6 additions & 6 deletions plone/app/vocabularies/actions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# -*- coding:utf-8 -*-
from zope.interface import implements
from Products.CMFCore.utils import getToolByName
from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary

from Products.CMFCore.utils import getToolByName


@implementer(IVocabularyFactory)
class ActionCategoriesVocabulary(object):
"""Provides an actions categories vocabulary"""

implements(IVocabularyFactory)

def __call__(self, context):
portal_actions = getToolByName(context, 'portal_actions')

Expand All @@ -22,7 +20,9 @@ def __call__(self, context):
portal = context.portal_url.getPortalObject()
categories = portal.portal_actions.objectIds()
categories.sort()
return SimpleVocabulary([SimpleTerm(cat, title=cat) for cat in categories])
return SimpleVocabulary(
[SimpleTerm(cat, title=cat) for cat in categories]
)


ActionCategoriesVocabularyFactory = ActionCategoriesVocabulary()
Loading

0 comments on commit 35a85a6

Please sign in to comment.