1. Michael Talin
  2. moin-2.0

Commits

Thomas Waldmann  committed 3d9bdca Merge

merged default into namespaces branch

  • Participants
  • Parent commits 1ac84f1, 553bf17
  • Branches namespaces

Comments (0)

Files changed (13)

File MoinMoin/__init__.py

View file
  • Ignore whitespace
 
 import sys
 if sys.hexversion < 0x2060000:
-    sys.exit("{0} requires Python 2.6 or greater.\n".format(project))
+    sys.exit("%s requires Python 2.6 or greater.\n" % project)
 
 
 from MoinMoin.util.version import Version

File MoinMoin/apps/frontend/views.py

View file
  • Ignore whitespace
 
 
 class UserSettingsOptionsForm(Form):
-    # TODO: if the checkbox in the form is checked, we get key: u'1' in the
-    # form data and all is fine. if it is not checked, the key is not present
-    # in the form data and flatland assigns None to the attribute (not False).
-    # If moin detects the None, it thinks this has not been set and uses its
-    # builtin defaults (for some True, for some others False). Makes
-    # edit_on_doubleclick malfunctioning (because its default is True).
     name = 'usersettings_options'
     mailto_author = Checkbox.using(label=L_('Publish my email (not my wiki homepage) in author info'))
     edit_on_doubleclick = Checkbox.using(label=L_('Open editor on double click'))

File MoinMoin/constants/keys.py

View file
  • Ignore whitespace
 USEROBJ_ATTRS = [
     # User objects proxy these attributes of the UserProfile objects:
     NAME, DISABLED, ITEMID, DISPLAY_NAME, ENC_PASSWORD, EMAIL, OPENID,
-    MAILTO_AUTHOR, SHOW_COMMENTS, RESULTS_PER_PAGE, EDIT_ON_DOUBLECLICK,
+    MAILTO_AUTHOR, SHOW_COMMENTS, RESULTS_PER_PAGE, EDIT_ON_DOUBLECLICK, SCROLL_PAGE_AFTER_EDIT,
     EDIT_ROWS, THEME_NAME, LOCALE, TIMEZONE, SUBSCRIBED_ITEMS, QUICKLINKS,
     CSS_URL,
 ]

File MoinMoin/items/blog.py

View file
  • Ignore whitespace
 from flask import current_app as app
 
 from whoosh.query import Term, And, Prefix, DateRange
+from whoosh.sorting import FunctionFacet
 
 from MoinMoin.i18n import L_
 from MoinMoin.themes import render_template
 from MoinMoin.forms import OptionalText, Tags, DateTime
 from MoinMoin.storage.middleware.protecting import AccessDenied
-from MoinMoin.constants.keys import NAME, NAME_EXACT, WIKINAME, ITEMTYPE, PTIME, TAGS
+from MoinMoin.constants.keys import NAME, NAME_EXACT, WIKINAME, ITEMTYPE, MTIME, PTIME, TAGS
 from MoinMoin.items import Item, Default, register, BaseMetaForm
 
 
                  Term(ITEMTYPE, ITEMTYPE_BLOG_ENTRY),
                  # Only sub items of this item
                  Prefix(NAME_EXACT, prefix),
-                 # Filter out those items that do not have a PTIME meta or PTIME is in the future.
-                 DateRange(PTIME, start=None, end=datetime.utcfromtimestamp(current_timestamp)),
                 ]
         if tag:
             terms.append(Term(TAGS, tag))
         query = And(terms)
-        revs = flaskg.storage.search(query, sortedby=[PTIME], reverse=True, limit=None)
+
+        def ptime_sort_key(searcher, docnum):
+            """
+            Compute the publication time key for blog entries sorting.
+
+            If PTIME is not defined, we use MTIME.
+            """
+            fields = searcher.stored_fields(docnum)
+            ptime = fields.get(PTIME, fields[MTIME])
+            return ptime
+        ptime_sort_facet = FunctionFacet(ptime_sort_key)
+
+        revs = flaskg.storage.search(query, sortedby=ptime_sort_facet, reverse=True, limit=None)
         blog_entry_items = [Item.create(rev.meta[NAME], rev_id=rev.revid) for rev in revs]  # XXX BROKEN - meta[NAME] is a list of names now
         return render_template('blog/main.html',
                                item_name=self.name,

File MoinMoin/templates/blog/utils.html

View file
  • Ignore whitespace
         </div>
     {% endif %}
     <div class="moin-blog-entry-info">
-        {% set publish_time = entry_item.meta['ptime'] %}
-        {% if publish_time %}
-            {{ _("Published on") }} {{ entry_item.meta['ptime']|datetimeformat }}
+        {% set publication_time = entry_item.meta['ptime'] or entry_item.meta['mtime'] %}
+        {% if publication_time %}
+            {{ _("Published on") }} {{ publication_time|datetimeformat }}
             {{ _("by") }} {{ utils.editor_info(entry_item.meta) }}
         {% else %}
             {{ _("Not published yet.") }}

File MoinMoin/templates/destroy.html

View file
  • Ignore whitespace
 {% import "forms.html" as forms %}
 {% extends theme("show.html") %}
 
-{% set title = _("DESTROY COMPLETE item '%(item_name)s'", item_name=item.name) %}
+{% set title = _("DESTROY COMPLETE ITEM '%(item_name)s'", item_name=item.name) %}
 
 {% block content %}
 {% if rev_id == None %}

File MoinMoin/templates/modify.html

View file
  • Ignore whitespace
 {% endblock %}
 
 {% block options_for_javascript %}
-{%- if user.edit_on_doubleclick -%}
+{%- if user.scroll_page_after_edit -%}
     <br id="moin-scroll-page-after-edit" />
 {%- endif %}
 {% endblock %}

File MoinMoin/themes/foobar/static/css/common.css

View file
  • Ignore whitespace
 h4{font-size:1em;margin:1em 0;border-bottom:2px solid #ccc;padding-bottom:2px}
 h5{font-size:.8333333333333334em;margin:1.2em 0;border-bottom:1px solid #ccc;padding-bottom:1px}
 h6{font-size:.6944444444444444em;margin:1.44em 0;border-bottom:1px solid #ccc;padding-bottom:1px}
-a.permalink{display:none;cursor:pointer;margin-left:.1em;color:#616161;}
-a.permalink:hover{color:#000}
-h1:hover .permalink,h2:hover .permalink,h3:hover .permalink,h4:hover .permalink,h5:hover .permalink,h6:hover .permalink{display:inline;text-decoration:none}
+a.moin-permalink{display:none;cursor:pointer;margin-left:.1em;color:#808080;}
+a.moin-permalink:hover.moin-permalink{color:#ff2727}
+h1:hover .moin-permalink,h2:hover .moin-permalink,h3:hover .moin-permalink,h4:hover .moin-permalink,h5:hover .moin-permalink,h6:hover .moin-permalink{display:inline;text-decoration:none}
 hr{background-color:#000;border:0;margin:.9em 0;height:1px;}
 hr.moin-hr1{height:2px}
 hr.moin-hr2{height:3px}

File MoinMoin/themes/foobar/static/css/stylus/main.styl

View file
  • Ignore whitespace
         border-bottom heading_underline_thickness solid border_color
         padding-bottom heading_underline_thickness
 
-// special style for heading with mouseover permalinks
-a.permalink
+// headings with mouseover permalinks
+a.moin-permalink
     display none
     cursor pointer
     margin-left 0.1em
-    color footer_color
-    &:hover
-        color font_color
+    color nonexistent_link_color
+    &:hover.moin-permalink
+        color nonexistent_hover_color
 
-h1:hover .permalink,
-h2:hover .permalink,
-h3:hover .permalink,
-h4:hover .permalink,
-h5:hover .permalink,
-h6:hover .permalink
+h1:hover .moin-permalink,
+h2:hover .moin-permalink,
+h3:hover .moin-permalink,
+h4:hover .moin-permalink,
+h5:hover .moin-permalink,
+h6:hover .moin-permalink
     display inline
     text-decoration none
 

File MoinMoin/themes/modernized/static/css/common.css

View file
  • Ignore whitespace
 .moin-item-overlay-ul:hover,.moin-item-overlay-lr:hover{opacity:.8;filter:alpha;background-color:#eef1f6;color:#1f9ae0}
 div.moin-item-wrapper,div.moin-item-wrapper > div,div.moin-item-wrapper > div > p:first-child,div.moin-item-wrapper > div > p:last-child{margin:0}
 div.moin-item-wrapper > div >  p:first-child ~ p:last-child{margin-top:1em}
-.moin-permalink{display:none;cursor:pointer;font-size:80%;margin-left:3px}
-a.moin-permalink{color:#939393}
-a:hover.moin-permalink{color:#1f62ad}
+a.moin-permalink{display:none;cursor:pointer;margin-left:.1em;color:#939393;}
+a.moin-permalink:hover.moin-permalink{color:#1f62ad}
 h1:hover .moin-permalink,h2:hover .moin-permalink,h3:hover .moin-permalink,h4:hover .moin-permalink,h5:hover .moin-permalink,h6:hover .moin-permalink{display:inline;text-decoration:none}
 @media print{html{font-family:serif;font-size:12pt;width:100%}
 body,#moin-page,#moin-page,#moin-content-data{margin:0;padding:0}

File MoinMoin/themes/modernized/static/css/stylus/main.styl

View file
  • Ignore whitespace
 div.moin-item-wrapper > div >  p:first-child ~ p:last-child
     margin-top 1em
 
-.moin-permalink
+// headings with mouseover permalinks
+a.moin-permalink
     display none
     cursor pointer
-    font-size 80%
-    margin-left 3px
-
-a.moin-permalink
+    margin-left .1em
     color nonexistent_link_color
-
-a:hover.moin-permalink
-    color nonexistent_hover_color
+    &:hover.moin-permalink
+        color nonexistent_hover_color
 
 h1:hover .moin-permalink,
 h2:hover .moin-permalink,

File docs/devel/development.rst

View file
  • Ignore whitespace
 Development
 ===========
 
-Project Organisation
-====================
-We mainly use IRC and the wiki for communication, documentation and planning.
+Useful Resources
+================
 
-IRC channels on chat.freenode.net:
+IRC channels on chat.freenode.net (quick communication and discussion):
 
-* #moin-dev (core development topics)
-* #moin (user support, extensions)
+* #moin-dev  (core development topics)
+* #moin  (user support, extensions)
 
 Wikis:
 
-* http://moinmo.in/
+* http://moinmo.in/  (production wiki, using moin 1.9)
+* http://test.moinmo.in/  (test wiki, using moin 2)
 
-Documentation:
+Documentation (installation, configuration, user docs, api reference):
 
 * http://readthedocs.org/docs/moin-20/en/latest/
 
-Issue tracker:
+Issue tracker (bugs, proposals, todo):
 
 * http://bitbucket.org/thomaswaldmann/moin-2.0/issues
 
-Code Repositories:
+Code Repositories (using Mercurial DVCS):
 
-* http://hg.moinmo.in/moin/2.0 - main repository
-* http://bitbucket.org/thomaswaldmann/moin-2.0 - bitbucket mirror for your
-  convenience, simplifying forking and contributing
+* http://hg.moinmo.in/moin/2.0  (main repository)
+* http://bitbucket.org/thomaswaldmann/moin-2.0  (bitbucket mirror for your
+  convenience, simplifying forking and contributing)
 
-We use Mercurial DVCS for distributed version control.
+Code review (get feedback about code changes):
 
-If you are not using Mercurial, you can still submit patches.
-In that case, open an issue in the issue tracker and attach the patch there.
+* http://codereview.appspot.com/
 
-Code review:
+Pastebin (temporary stuff - do not use for code reviews, do not use from issue
+tracker or for any long-term needed stuff):
 
-Please use http://codereview.appspot.com/ for getting feedback on moin-related
-code, especially if you want to contribute or publish that code.
+* http://rn0.ru/
 
-If you are using a local mercurial repository/workdir, you can very easily
-upload your uncommitted workdir state to codereview using their "upload.py".
 
-Then just ask on the IRC channel for review and provide the codereview URL.
+Typical development workflow
+============================
+
+This is the typical workflow for non-trivial changes and developers that likely
+want to contribute more than one change:
+
+* create your own development environment (only once):
+
+  - create a google account (if you don't have one already, it's free), so you
+    can use codereview.appspot.com
+  - create a bitbucket account (if you don't have one already, it's free)
+  - clone ("fork") the main repository on bitbucket, so you have your own bb
+    repo to publish your work
+  - clone your own bb repo to your local development machine
+  - do a development install from your local repo - read the moin2 install docs
+    for detailled instructions.
+  - join #moin-dev IRC channel and stay there whenever possible
+
+* find some stuff to work on:
+
+  - look at the issue tracker to find some stuff you can solve
+  - in case you want to work on some (non-trivial) new issue or idea that is
+    not on the issue tracker yet, first create an issue there with a detailled
+    description of it
+  - discuss with / get feedback from other developers on the #moin-dev IRC
+    channel
+
+* work on the stuff:
+
+  - to avoid double work, add a comment on the issue tracker that you are
+    working on that issue
+  - work in your local repo on your local development machine (make sure you
+    work in the right branch)
+  - concentrate on one issue / one topic, create a clean set of changes (that
+    means not doing more than needed to fix the issue, but also it means fixing
+    the issue completely and everywhere)
+  - write good, clean, easy-to-understand code.
+  - obey PEP-8
+  - do not fix or change unrelated stuff while working, but rather create new
+    issues on the tracker, so it's not forgotten
+  - regularly run the unit tests ("make test"), the amount of failing tests
+    shall not increase due to your changes
+  - if you fix something that had no test, first try to write a (correct, but
+    still failing) test for it, then fix the code and see the test not failing
+    any more
+  - if you implement new functionality, write tests for it first, then
+    implement it
+  - do an own review of your changes. Use hg diff, hg status - read everything
+    you changed - slowly, looking for stuff that can be improved. Fix
+    everything you find that way before requesting feedback from others.
+  - get feedback from other developers about your changes:
+   
+    + put them on codereview (just run python upload.py in your local repo -
+      if it is not first upload, reuse the same ID to update the already
+      existing codereview)
+    + post the codereview URL to #moin-dev IRC channel asking for review
+    + if you want to get feedback on non-code stuff, either use the issue
+      tracker or a pastebin (only use pastebins for temporary stuff)
+  - repeat until everybody is happy with it
+  - do some final testing - practically and using the unit tests
+  - commit your changes to your local repo, use a meaningful commit comment
+
+* publish your stuff and request it being merged:
+
+  - push the changeset to your public bitbucket repo
+  - create a pull request to request that your changes get pulled into the
+    main repository
+  - optionally, tell about it on the IRC channel
+  - if you fixed an issue from the issue tracker, make sure the issue gets
+    closed after your fix has been merged.
+
+
+Alternate contribution workflows
+================================
+If the above workflow looks like overkill (e.g. for simple changes) or you
+can't work with the tools we usually use, you can also do it like this:
+
+* find an existing issue on the issue tracker about the issue you were fixing
+  (or create a new one), make sure to give (or update) all the details, like:
+
+  - precise version number / changeset hashes of the original code your patch
+    is based on
+  - precise description of the issue, how to reproduce it, tracebacks, ...
+  - why your fix is correct / how you tested it
+* create a patch using the diff tool, attach patch.txt to the issue:
+
+    diff -urN originalcodetree/ modifiedcodetree/ > patch.txt
+
+* if you fixed an issue from the issue tracker, make sure the issue gets
+  closed after your fix has been committed to the main repo.
+
+For trivial fixes (like typos), you can also try just grabbing a developer
+on IRC, telling filename, line number and get it fixed by him.
+
+Note: if developers find that the required changes are not that simple or are
+potentially causing other issues, codereview or other parts of the full
+workflow might be needed.
+
 
 MoinMoin architecture
 =====================

File docs/user/markdown.rst

View file
  • Ignore whitespace
+===============
+Markdown Markup
+===============
+