Permalink
Browse files

UPdate the docs a little

  • Loading branch information...
Reed O'Brien
Reed O'Brien committed Feb 13, 2011
1 parent 6c6a227 commit c98561a175d6952293c24dd1a0a2e12727c1eca1
Showing with 32 additions and 10 deletions.
  1. +7 −0 docs/glossary.rst
  2. +2 −1 docs/index.rst
  3. +23 −9 lumin/node.py
View
@@ -20,6 +20,13 @@
<http://docs.repoze.org/colander/null.html>` for more
informration.
+ collection
+ A collection is the moral equivalent of an SQL table.
+
+ context
+ The thing which is traversal finds or id created by a defined factory
+ when using routes.
+
deform
`deform <http://docs.repoze.org/deform/>` is a Python HTML form
generation library.
View
@@ -1,7 +1,7 @@
Documentation for lumin
==================================
-:app:`lumin`, from Vo-*lumin*-ous a head nod to *mongo* in
+:app:`lumin`, from Vo-*lumin*-ous a head nod to *mongo* in
:term:`MongoDB`. :app:`lumin` is a library to facilitate using
:term:`MongoDB` with :term:`Pyramid`, :term:`deform` and
:term:`colander`.
@@ -12,6 +12,7 @@ Documentation for lumin
usage
api/son
+ api/node
glossary
Detailed Change History
View
@@ -116,8 +116,12 @@ def schema(self, schema, bind=True):
def add_form(self):
"""
- :rtype: a tuple consisting of the form and and required static
- resources. For adding a :term:`context`
+ :rtype: a tuple consisting of the form and and required static resources
+
+ This form is for adding a new that does not yet have a
+ :term:`context`. This isn't entirely true. We have generated a
+ context here, but is isn't in the DB yet and it has no data
+ yet. It is essentially a context shell at this point.
"""
buttons = (deform.form.Button(name = "submit",
title = self.button_name
@@ -129,10 +133,11 @@ def add_form(self):
def edit_form(self):
"""
- :rtype: a tuple consisting of the form and and required static
- resources. For editing an existing :term:`context`
+ :rtype: a tuple consisting of the form and and required static resources.
+
+ This form is for editing an existing item represented by this :term:`context`
- TODO: can these to forms be the same form?
+ TODO: can these two forms be the same form?
"""
buttons = (deform.form.Button(name = "submit",
title = "Update"
@@ -143,10 +148,19 @@ def edit_form(self):
return (form, resources)
- def insert(self, doc, title_or_id, increment=True):
+ def insert(self,
+ doc,
+ title_or_id,
+ increment=True,
+ seperator=u'-'):
"""
- Insert the item this context represents into the
+ Insert the item this ``context`` represents into the
:term:`collection`.
+
+ :param doc: A dictionary to be stored in the DB
+ :param title_or_id: a string to be normalized for a URL and used as the _id for the document.
+ :param increment: Whether to increment ``title_or_id`` if it already exists in the DB. **Default: ``True``**
+ :param seperator: carachter to separate ``title_or_id`` incremental id. **Default: ``u"-"``**
"""
ctime = mtime = datetime.datetime.utcnow().strftime(TS_FORMAT)
doc['ctime'] = ctime
@@ -169,7 +183,7 @@ def insert(self, doc, title_or_id, increment=True):
def update(self):
"""
- update the item this ``context`` represents in the
+ Update the item this ``context`` represents in its
:term:`collection`
"""
self.data['mtime'] = datetime.datetime.utcnow().strftime(TS_FORMAT)
@@ -181,7 +195,7 @@ def update(self):
def delete(self, safe=False):
"""
- Remove the entry represented by this context from this
+ Remove the entry represented by this ``context`` from this
:term:`collection`
"""
result = self.collection.remove(self.data["_id"],

0 comments on commit c98561a

Please sign in to comment.