mitsuhiko  committed d820478

Simplewiki is now upgraded to latest creoleparser, Genshi and SQLAlchemy

  • Participants
  • Parent commits 08a7ca7

Comments (0)

Files changed (3)

File examples/simplewiki/

             change_note = request.form.get('change_note', '')
             if page is None:
                 page = Page(page_name)
-            revision = Revision(page, text, change_note)
+                session.add(page)
+            session.add(Revision(page, text, change_note))
             return redirect(href(
                     change_note = request.form.get('change_note', '')
                     change_note = 'revert' + (change_note and ': ' +
                                               change_note or '')
-                    revision = Revision(page, old_revision.text,
-                                        change_note)
+                    session.add(Revision(page, old_revision.text,
+                                         change_note))
                     return redirect(href(page_name))

File examples/simplewiki/

 from datetime import datetime
 from sqlalchemy import Table, Column, Integer, String, DateTime, \
      ForeignKey, MetaData, join
-from sqlalchemy.orm import relation, create_session, scoped_session
+from sqlalchemy.orm import relation, create_session, scoped_session, \
+     mapper
 from simplewiki.utils import application, local_manager, parse_creole
     new revisions.  It's also used for the diff system and the revision
+    query = session.query_property()
     def __init__(self, page, text, change_note='', timestamp=None):
         if isinstance(page, (int, long)):
     Represents a simple page without any revisions.  This is for example
     used in the page index where the page contents are not relevant.
+    query = session.query_property()
     def __init__(self, name): = name
     and the ability of SQLAlchemy to map to joins we can combine `Page` and
     `Revision` into one class here.
+    query = session.query_property()
     def __init__(self):
         raise TypeError('cannot create WikiPage instances, use the Page and '
 # setup mappers
-session.mapper(Revision, revision_table)
-session.mapper(Page, page_table, properties=dict(
+mapper(Revision, revision_table)
+mapper(Page, page_table, properties=dict(
     revisions=relation(Revision, backref='page',
-session.mapper(RevisionedPage, join(page_table, revision_table), properties=dict(
+mapper(RevisionedPage, join(page_table, revision_table), properties=dict(
     page_id=[page_table.c.page_id, revision_table.c.page_id],

File examples/simplewiki/

     :license: BSD.
 import difflib
+import creoleparser
 from os import path
 from genshi import Stream
 from genshi.template import TemplateLoader
-from creoleparser import Parser, Creole10
 from werkzeug import BaseRequest, BaseResponse, Local, LocalManager, \
      url_encode, url_quote, redirect, cached_property
 application = local('application')
 # create a new creole parser
-creole_parser = Parser(dialect=Creole10(
-    wiki_links_base_url='',
-    wiki_links_path_func=lambda page_name: href(page_name),
-    wiki_links_space_char='_',
-    no_wiki_monospace=True,
-    use_additions=True
+creole_parser = creoleparser.Parser(
+    dialect=creoleparser.create_dialect(creoleparser.creole10_base,
+        wiki_links_base_url='',
+        wiki_links_path_func=lambda page_name: href(page_name),
+        wiki_links_space_char='_',
+        no_wiki_monospace=True
+    ),
+    method='html'
 def generate_template(template_name, **context):