Revision: 610
Author: batiste.bieler
Date: Mon Jul 20 23:57:02 2009
Log: Add API documentation
http://code.google.com/p/django-page-cms/source/detail?r=610

Modified:
  /trunk/docs/conf.py
  /trunk/docs/installation.rst
  /trunk/docs/page-api.rst
  /trunk/pages/utils.py

=======================================
--- /trunk/docs/conf.py Mon Jul 20 11:06:47 2009
+++ /trunk/docs/conf.py Mon Jul 20 23:57:02 2009
@@ -20,10 +20,10 @@
  # add these directories to sys.path here. If the directory is relative to  
the
  # documentation root, use os.path.abspath to make it absolute, like shown  
here.

-sys.path.append(os.path.abspath('../'))
-
-import pages
+sys.path.append(os.path.abspath('..'))
+
  from django.conf import settings
+import django
  settings.configure(DEBUG=True, TEMPLATE_DEBUG=True,
      DEFAULT_PAGE_TEMPLATE='index.html',
      PAGE_TAGGING=False,
=======================================
--- /trunk/docs/installation.rst        Mon Jul 20 10:08:13 2009
+++ /trunk/docs/installation.rst        Mon Jul 20 23:57:02 2009
@@ -8,42 +8,40 @@
  If you have any problem installing this CMS, take a look at the example  
application that stands in the example directory.
  This application works out of the box and will certainly help you to get  
started.

-Install instructions step by step
-=================================
-
-For an alternative, step by step installation process, there is this an
-OpenOffice document :  
http://django-page-cms.googlegroups.com/web/gpc-install-instructions.odt
+Step by step installation
+=========================
+
+For a step by step installation there is complete OpenOffice document :  
http://django-page-cms.googlegroups.com/web/gpc-install-instructions.odt

  Install by using pip
  ====================

-The pip install is by far the easiest one. Use this method if you have the  
choice.
-
-use::
+The pip install is the easiest and the recommended installation method.  
Use::

      sudo easy_install pip
      wget -c  
http://django-page-cms.googlecode.com/svn/trunk/requirements/external_apps.txt
      sudo pip install -r external_apps.txt

-Every package listed in the `external_app.txt` should be downloaded and  
installed.
+Every package listed in the ``external_app.txt`` should be downloaded and  
installed.

  Install by using easy_install
  =============================

  On debian linux you can do::

+    sudo easy_install django
      sudo easy_install html5lib
      sudo easy_install django-page-cms

-* Tagging must be installed by hand or with subversion* because the  
available package is not
+* Tagging must be installed by hand or with subversion because the  
available package is not
    compatible with django 1.0.

-* Django-mptt must be installed by hand or with subversion* because the  
available package is not compatible with django 1.0.
+* Django-mptt must be installed by hand or with subversion because the  
available package is not compatible with django 1.0.

  Install by using subversion externals
  =====================================

-You can also use the trunk version of the Django page CMS by using  
subversion externals::
+You can also use the trunk version of the Django Page CMS by using  
subversion externals::


      $ svn pe svn:externals .
@@ -54,7 +52,7 @@
  Urls
  ====

-Take a look in the `example/urls.py` and copy desired URLs in your own  
`urls.py`.
+Take a look in the ``example/urls.py`` and copy desired URLs in your own  
``urls.py``.
  Basically you need to have something like this::

      urlpatterns = patterns('',
@@ -63,10 +61,10 @@
          (r'^admin/(.*)', admin.site.root),
      )

-When you will visit the site the first time (`/pages/`), you will get a  
404 error
+When you will visit the site the first time (``/pages/``), you will get a  
404 error
  because there is no published page. Go to the admin first and create and  
publish some pages.

-You will certainly want to activate the static file serve view in your  
`urls.py` if you are in developement mode::
+You will certainly want to activate the static file serve view in your  
``urls.py`` if you are in developement mode::

      if settings.DEBUG:
          urlpatterns += patterns('',
@@ -78,7 +76,7 @@
  Settings
  ========

-All the Django page CMS specific settings and options are listed and  
explained in the `pages/settings.py` file.
+All the Django page CMS specific settings and options are listed and  
explained in the ``pages/settings.py`` file.

  Django page CMS require several of these settings to be set. They are  
marked in this document with a bold "*must*".

@@ -87,7 +85,7 @@

  Tagging is optional and disabled by default.

-If you want to use it set `PAGE_TAGGING` at `True` into your setting file  
and add it to your installed apps::
+If you want to use it set ``PAGE_TAGGING`` at ``True`` into your setting  
file and add it to your installed apps::

      INSTALLED_APPS = (
          'django.contrib.auth',
@@ -121,15 +119,15 @@
  * http://docs.djangoproject.com/en/dev/ref/settings/#languages
  * http://docs.djangoproject.com/en/dev/ref/settings/#language-code

-This CMS use the `PAGE_LANGUAGES` setting in order to present which  
language are supported by the CMS.
-By default `PAGE_LANGUAGES` value is set to `settings.LANGUAGES` value.
-So you can directly set the `LANGUAGES` setting if you want.
-In any case *you should set* `PAGE_LANGUAGES` or `LANGUAGES`
-yourself because by default the `LANGUAGES` list is big.
-
-Django use `LANGUAGES` setting to set the `request.LANGUAGE_CODE` value  
that is used by this CMS. So if the language you want to support is not  
present in the `LANGUAGES` setting the `request.LANGUAGE_CODE` will not be  
set correctly.
-
-A possible solution is to redefine `settings.LANGUAGES`. For example you  
can do::
+This CMS use the ``PAGE_LANGUAGES`` setting in order to present which  
language are supported by the CMS.
+By default ``PAGE_LANGUAGES`` value is set to ``settings.LANGUAGES`` value.
+So you can directly set the ``LANGUAGES`` setting if you want.
+In any case *you should set* ``PAGE_LANGUAGES`` or ``LANGUAGES``
+yourself because by default the ``LANGUAGES`` list is big.
+
+Django use ``LANGUAGES`` setting to set the ``request.LANGUAGE_CODE``  
value that is used by this CMS. So if the language you want to support is  
not present in the ``LANGUAGES`` setting the ``request.LANGUAGE_CODE`` will  
not be set correctly.
+
+A possible solution is to redefine ``settings.LANGUAGES``. For example you  
can do::

      # Default language code for this installation. All choices can be  
found here:
      # http://www.i18nguy.com/unicode/language-identifiers.html
@@ -158,7 +156,7 @@
  Template context processors and Middlewares
  -------------------------------------------

-You *must* have these context processors into your  
`TEMPLATE_CONTEXT_PROCESSORS` setting::
+You *must* have these context processors into your  
``TEMPLATE_CONTEXT_PROCESSORS`` setting::

      TEMPLATE_CONTEXT_PROCESSORS = (
          'django.core.context_processors.auth',
@@ -170,7 +168,7 @@
          ...
      )

-You *must* have these middleware into your `MIDDLEWARE_CLASSES` setting::
+You *must* have these middleware into your ``MIDDLEWARE_CLASSES`` setting::

      MIDDLEWARE_CLASSES = (
          'django.contrib.sessions.middleware.SessionMiddleware',
@@ -184,16 +182,16 @@
  Default template
  ----------------

-You *must* set `DEFAULT_PAGE_TEMPLATE` to the name of your default CMS  
template::
+You *must* set ``DEFAULT_PAGE_TEMPLATE`` to the name of your default CMS  
template::

      DEFAULT_PAGE_TEMPLATE = 'pages/index.html'

-And you *must* copy the directory `example/templates/pages` into your root  
template directory.
+And you *must* copy the directory ``example/templates/pages`` into your  
root template directory.

  Additional templates
  --------------------

-Optionally you can set `PAGE_TEMPLATES` if you want additional templates  
choices.
+Optionally you can set ``PAGE_TEMPLATES`` if you want additional templates  
choices.
  In the the example application you have actually this::

      PAGE_TEMPLATES = (
@@ -204,7 +202,7 @@
  The sites framework
  -------------------

-If you want to use the  
http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites  
Django sites framework] with django-page-cms, you *must* define the  
`SITE_ID` and `PAGE_USE_SITE_ID` settings and create the appropriate Site  
object into the admin interface::
+If you want to use the  
http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites  
Django sites framework] with django-page-cms, you *must* define the  
``SITE_ID`` and ``PAGE_USE_SITE_ID`` settings and create the appropriate  
Site object into the admin interface::

      PAGE_USE_SITE_ID = True
      SITE_ID = 1
@@ -214,15 +212,15 @@
  Media directory
  ---------------

-The django CMS come with some javascript and CSS files. These files are  
standing in the `pages/media/pages` directory.
+The django CMS come with some javascript and CSS files. These files are  
standing in the ``pages/media/pages`` directory.

  If you don't know how to serve static files with Django please read :

  http://docs.djangoproject.com/en/dev/howto/static-files/


-Django CMS has a special setting called `PAGES_MEDIA_URL` that enable you  
to change
-how the browser will ask for these files in the CMS admin. By default the  
value of `PAGES_MEDIA_URL` is set to ::
+Django CMS has a special setting called ``PAGES_MEDIA_URL`` that enable  
you to change
+how the browser will ask for these files in the CMS admin. By default the  
value of ``PAGES_MEDIA_URL`` is set to ::

      PAGES_MEDIA_URL = getattr(settings, 'PAGES_MEDIA_URL',  
join(settings.MEDIA_URL, 'pages/'))

@@ -239,7 +237,7 @@
      <script type="text/javascript" src="{{ PAGES_MEDIA_URL  
}}javascript/jquery.js"></script>


-That will be rendered by default like this if `MEDIA_URL == '/media/'`::
+That will be rendered by default like this if ``MEDIA_URL == '/media/'``::


      <link rel="stylesheet" type="text/css"  
href="/media/pages/css/pages.css" />
@@ -247,11 +245,11 @@

  You can off course redefine this variable in your setting file if you are  
not happy with this default

-In any case you must at least create a symbolic link or copy the directory  
`pages/media/pages/` into
+In any case you must at least create a symbolic link or copy the directory  
``pages/media/pages/`` into
  your media directory to have a fully functioning administration interface.

  The example application take another approch by directly
-point the `MEDIA_ROOT` of the project on the `page/media` directory::
+point the ``MEDIA_ROOT`` of the project on the ``page/media`` directory::

      # Absolute path to the directory that holds media.
      MEDIA_ROOT = os.path.join(PROJECT_DIR, '../pages/media/')
=======================================
--- /trunk/docs/page-api.rst    Mon Jul 20 11:06:47 2009
+++ /trunk/docs/page-api.rst    Mon Jul 20 23:57:02 2009
@@ -15,3 +15,31 @@
  .. autoclass:: pages.managers.PageManager
     :members:
     :undoc-members:
+
+Content Model
+=============
+
+.. autoclass:: pages.models.Content
+   :members:
+   :undoc-members:
+
+Content Manager
+===============
+
+.. autoclass:: pages.managers.ContentManager
+   :members:
+   :undoc-members:
+
+Utils
+=====
+
+.. automodule:: pages.utils
+   :members:
+   :undoc-members:
+
+Http
+====
+
+.. automodule:: pages.http
+   :members:
+   :undoc-members:
=======================================
--- /trunk/pages/utils.py       Wed Jul  8 04:14:44 2009
+++ /trunk/pages/utils.py       Mon Jul 20 23:57:02 2009
@@ -2,11 +2,8 @@
  """A collection of functions for Page CMS"""
  from django.conf import settings as django_settings
  from django.template import TemplateDoesNotExist
-from django.template.loader_tags import ExtendsNode, ConstantIncludeNode
-from django.template.loader_tags import BlockNode
  from django.template import loader, Context, RequestContext
  from django.http import Http404
-
  from pages import settings
  from pages.http import get_request_mock, get_language_from_request

@@ -27,12 +24,14 @@
          context = {}
      temp.render(RequestContext(request, context))
      plist, blist = [], []
-    placeholders_recursif(temp.nodelist, plist, blist)
+    _placeholders_recursif(temp.nodelist, plist, blist)
      return plist

-def placeholders_recursif(nodelist, plist, blist):
+def _placeholders_recursif(nodelist, plist, blist):
      """Recursively search into a template node list for PlaceholderNode
      node."""
+    # I needed to import make this lazy import to make the doc compile
+    from django.template.loader_tags import BlockNode

      for node in nodelist:


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to