~sirn/fanboi2

ref: 98796226802a26b82c888365ad5b9cd331006792 fanboi2/migration d---------
Allow rule override to be scoped.
Add page model and views.

Allow creation of custom pages that may be use to store static content
such as guidelines or deletion policies. There also exists an
"internal pages" that are used for site customization.

Currently two internal pages are available:

* global_css — custom CSS that applies to every page.
* global_appendix — area that appear on top of footer on every page.

Any number of pages may be created.
Add rules system for evaluating rules based on IP address.

The rules system currently support two type of rules:

* Ban — disallow matched IP address to post in a board.
* Override — override board status for a certain IP address.

Each rule may be trigger on/off and may specify active period.
Allow boards to be restricted, locked and archived.

For moderation purpose. Behavior for each status is as follows:

* open — anyone may create new topic and post.
* restricted — nobody can create new topic but may post.
* locked — nobody may create new topic nor post.
* archived — same as locked, but board is no longer shown in the list.

In summary,

+------------+---------------+-----------*----------+
| Status     | Shown in list | New Topic | New Post |
+------------+---------------+-----------*----------+
| open       |      Yes      |    Yes    |    Yes   |
| restricted |      Yes      |    No     |    Yes   |
| locked     |      Yes      |    No     |    No    |
| archived   |      No       |    No     |    No    |
+------------+---------------+-----------*----------+
Use topic_meta for topic metadata retrieval instead of subquery

Since we now allow posts to be deleted and the post may be restored
later, topic metadata such as post count now need to explicitly tracked
somewhere (since we can no longer reuse post.number).
Index naming convention and schema housekeeping.

This commit breaks ability to migrate from existing application to newer
version due to a change in migration ID format. It is highly recommend
to dump the database with data only and restore it to a database, e.g.

    $ pg_dump -T alembic_version -a -Fc > fanboi2.dump
    $ psql template1 -c "DROP DATABASE fanboi2;"
    $ psql template1 -c "CREATE DATABASE fanboi2;"
    $ alembic upgrade c71cae24d111
    $ pg_restore -O -x -a -d fanboi2 fanboi2.dump
    $ alembic upgrade head
Integrate versioned with existing models.
Project directory restructure.

Move resources out of fanboi2 package into its own "assets" directory
in order to make fanboi2 package consist mostly of Python-related
codes.

Sample configuration are also moved to examples/ directory with
a README accordingly.
Merge branch 'feature/sage-post' into develop
Add bumped field to post.

Similar to Topic.posted_at but Topic.bumped_at will query a post that
was last created with Post.bumped flag set to True.
Store user name and display with post.

This name is inherited from board and saved so that when we changed
board settings, old post name don't get changed.
Add topic status, post limit and auto-archiving.

When topic reaches max_posts set within board, its status will now
automatically changed to "archived". When topic is archived, user could
not create any more post on that topic. Two other statuses are "open"
and "locked", the former being default and enables posting and the
latter is like archived, but used when explicitly locked by moderators.
Add script for updating board info.

* Add agreements field to board for displaying posting agreement.
* Add description field for board list.
Add helper functions for datetime handling.

Also make datetime field timezone-aware since we're doing TZ conversion
on display (defaults to Bangkok with UTC as datetime attribute.)
Merge branch 'feature/py3' into develop
Run project through 2to3.
Convert app to Python 3.3, make all tests passed.

* Remove pyramid_zcml usage since it's not compatible with Py3.
* Replace ipaddr with built-in ipaddress (which has the same API).
* Replace all u"string" usage to just "string".
* Change from assertItemsEqual (now deprecated) to assertEqual.
* Replace iteritems() with iter().

Some bugs are also fixed:
* Use TEXT instead of BINARY for storing JSON (JSON is text isn't it?)
* Replace Unicode in Post.body with Text since Unicode is VARCHAR.
Add unique constrait for (topic_id, number) in posts.

As well as write Getting Started guide.
Add post numbering within single topic.

This adds static numbering to post within a thread. This number need to
be persisted since we'll allow displaying posts in range (e.g. 100-200)
instead of paging. ROW_NUMBER() is not used because of SQLite's lack of
support.
Add settings field and store user IP address.

IP address are retrieved from either REMOTE_ADDR or HTTP_X_FORWARDED_FOR
in case of proxying. This value will be used for ident generation if it
is enabled on a board. Settings field is added to board to store flags
such as post limit or enable ident.
Next