diff --git a/.coveragerc b/.coveragerc index aac9c0b..f692946 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,7 @@ [run] -source = wiki -omit = wiki/tests/* -branch = 1 +source = pinax +omit = pinax/wiki/conf.py,pinax/wiki/tests/*,pinax/wiki/admin.py,pinax/wiki/migrations/* +branch = true + +[report] +omit = pinax/wiki/conf.py,pinax/wiki/tests/*,pinax/wiki/admin.py,pinax/wiki/migrations/* diff --git a/.gitignore b/.gitignore index 544df4f..439570f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,45 @@ -build -dist -.coverage -.tox -MANIFEST -*.pyc -*.egg-info +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg *.egg -docs/_build/ +*.eggs + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ diff --git a/.travis.yml b/.travis.yml index 86c1f0c..af2d7b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,28 @@ language: python +sudo: false python: - - 2.7 + - "2.7" + - "3.2" + - "3.3" + - "3.4" + - "3.5" env: - - DJANGO=https://github.com/django/django/tarball/master - - DJANGO=Django==1.6.5 + - DJANGO=1.7 + - DJANGO=1.8 + - DJANGO=1.9 +matrix: + exclude: + - python: "3.2" + env: DJANGO=1.9 + - python: "3.3" + env: DJANGO=1.9 + - python: "3.5" + env: DJANGO=1.7 install: - - pip install $DJANGO flake8 coverage coveralls - - pip install -e . + - pip install tox coveralls script: - - flake8 --max-line-length=125 --max-complexity=10 --statistics --benchmark wiki - - coverage run setup.py test - - coverage report -after_success: coveralls + - tox -e py${TRAVIS_PYTHON_VERSION//[.]/}-$DJANGO +after_success: + - coveralls notifications: - irc: - channels: - - "chat.freenode.net#pinax" - on_success: change - on_failure: change - use_notice: true + slack: pinax:TMipYjcCCRxrKQFXk8I9cHLS diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 9837fe9..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/{{ app_name }}.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/{{ app_name }}.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/{{ app_name }}" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/{{ app_name }}" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - make -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." \ No newline at end of file diff --git a/docs/changelog.rst b/docs/changelog.rst deleted file mode 100644 index df7a909..0000000 --- a/docs/changelog.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. _changelog: - -CHANGELOG -========= - -0.1 ---- diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 9986cdf..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,37 +0,0 @@ -from __future__ import unicode_literals - -import os -import sys - - -extensions = [] -templates_path = [] -source_suffix = ".rst" -master_doc = "index" -project = "pinax-wiki" -copyright_holder = "James Tauber and contributors" -copyright = "2014, {0}".format(copyright_holder) -exclude_patterns = ["_build"] -pygments_style = "sphinx" -html_theme = "default" -htmlhelp_basename = "{0}doc".format(project) -latex_documents = [( - "index", - "{0}.tex".format(project), - "{0} Documentation".format(project), - "Pinax", - "manual" -),] -man_pages = [( - "index", - project, - "{0} Documentation".format(project), - ["Pinax"], - 1 -),] - -sys.path.insert(0, os.pardir) -m = __import__("wiki") - -version = m.__version__ -release = version diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 334fba4..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -==================== -pinax-wiki -==================== - -Easily add a wiki to a Django project. - - -Contents -======== - -.. toctree:: - :maxdepth: 2 - - installation - changelog diff --git a/docs/installation.rst b/docs/installation.rst deleted file mode 100644 index 8810c5e..0000000 --- a/docs/installation.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. _installation: - -============ -Installation -============ - -* Install the development version:: - - pip install pinax-wiki - -* Add ``wiki`` to your ``INSTALLED_APPS`` setting:: - - INSTALLED_APPS = ( - # ... - "wiki", - # ... - ) - - -.. _dependencies: - -Dependencies -============ - diff --git a/makemigrations.py b/makemigrations.py new file mode 100644 index 0000000..f1d99f5 --- /dev/null +++ b/makemigrations.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +import os +import sys + +import django + +from django.conf import settings + + +DEFAULT_SETTINGS = dict( + INSTALLED_APPS=[ + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sites", + "wiki", + "wiki.tests" + ], + DATABASES={ + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + } + }, + SITE_ID=1, + ROOT_URLCONF="wiki.tests.urls", + SECRET_KEY="notasecret", +) + + +def run(*args): + if not settings.configured: + settings.configure(**DEFAULT_SETTINGS) + + django.setup() + + parent = os.path.dirname(os.path.abspath(__file__)) + sys.path.insert(0, parent) + + django.core.management.call_command( + "makemigrations", + "pinax_wiki", + *args + ) + + +if __name__ == "__main__": + run(*sys.argv[1:]) diff --git a/pinax/__init__.py b/pinax/__init__.py new file mode 100644 index 0000000..ef3b678 --- /dev/null +++ b/pinax/__init__.py @@ -0,0 +1,2 @@ +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) # noqa diff --git a/pinax/wiki/__init__.py b/pinax/wiki/__init__.py new file mode 100644 index 0000000..4367791 --- /dev/null +++ b/pinax/wiki/__init__.py @@ -0,0 +1,5 @@ +import pkg_resources + + +default_app_config = "pinax.wiki.apps.AppConfig" +__version__ = pkg_resources.get_distribution("pinax-wiki").version diff --git a/pinax/wiki/apps.py b/pinax/wiki/apps.py new file mode 100644 index 0000000..c556781 --- /dev/null +++ b/pinax/wiki/apps.py @@ -0,0 +1,14 @@ +import importlib + +from django.apps import AppConfig as BaseAppConfig +from django.utils.translation import ugettext_lazy as _ + + +class AppConfig(BaseAppConfig): + + name = "pinax.wiki" + label = "pinax_wiki" + verbose_name = _("Pinax Wiki") + + def ready(self): + importlib.import_module("pinax.wiki.receivers") diff --git a/wiki/binders.py b/pinax/wiki/binders.py similarity index 71% rename from wiki/binders.py rename to pinax/wiki/binders.py index efdcace..0a01f77 100644 --- a/wiki/binders.py +++ b/pinax/wiki/binders.py @@ -13,15 +13,15 @@ def bind_to_model_name(self): @property def index_url_name(self): - return "{0}_wiki_index".format(self.bind_to_model_name) + return "{0}_pinax_wiki_index".format(self.bind_to_model_name) @property def page_url_name(self): - return "{0}_wiki_page".format(self.bind_to_model_name) + return "{0}_pinax_wiki_page".format(self.bind_to_model_name) @property def edit_url_name(self): - return "{0}_wiki_edit".format(self.bind_to_model_name) + return "{0}_pinax_wiki_edit".format(self.bind_to_model_name) def get_object(self, **kwargs): return self.bind_to_model._default_manager.get(**{ @@ -52,21 +52,21 @@ def lookup(self, *args, **kwargs): @property def index_url_name(self): - return "wiki_index" + return "pinax_wiki_index" @property def page_url_name(self): - return "wiki_page" + return "pinax_wiki_page" @property def edit_url_name(self): - return "wiki_edit" + return "pinax_wiki_edit" def edit_url(self, wiki, slug): - return reverse("wiki_edit", kwargs={"slug": slug}) + return reverse(self.edit_url_name, kwargs={"slug": slug}) def page_url(self, wiki, slug): - return reverse("wiki_page", kwargs={"slug": slug}) + return reverse(self.page_url_name, kwargs={"slug": slug}) def page_edit_url(self, wiki, slug): - return reverse("wiki_edit", kwargs={"slug": slug}) + return reverse(self.edit_url_name, kwargs={"slug": slug}) diff --git a/wiki/conf.py b/pinax/wiki/conf.py similarity index 82% rename from wiki/conf.py rename to pinax/wiki/conf.py index b78e064..24714cf 100644 --- a/wiki/conf.py +++ b/pinax/wiki/conf.py @@ -1,8 +1,9 @@ from __future__ import absolute_import +import importlib + from django.conf import settings # noqa from django.core.exceptions import ImproperlyConfigured -from django.utils import importlib from appconf import AppConf @@ -24,11 +25,14 @@ def load_path_attr(path): class WikiAppConf(AppConf): BINDERS = [ - "wiki.binders.DefaultBinder" + "pinax.wiki.binders.DefaultBinder" ] IP_ADDRESS_META_FIELD = "HTTP_X_FORWARDED_FOR" - HOOKSET = "wiki.hooks.WikiDefaultHookset" - PARSE = "wiki.parsers.creole_wikiword_parse" + HOOKSET = "pinax.wiki.hooks.WikiDefaultHookset" + PARSE = "pinax.wiki.parsers.creole_wikiword_parse" + + class Meta: + prefix = "pinax_wiki" def configure_binders(self, value): binders = [] diff --git a/wiki/forms.py b/pinax/wiki/forms.py similarity index 100% rename from wiki/forms.py rename to pinax/wiki/forms.py diff --git a/wiki/hooks.py b/pinax/wiki/hooks.py similarity index 79% rename from wiki/hooks.py rename to pinax/wiki/hooks.py index 22df9c4..52ef203 100644 --- a/wiki/hooks.py +++ b/pinax/wiki/hooks.py @@ -1,6 +1,3 @@ -from .conf import settings - - class WikiDefaultHookset(object): def can_create_page(self, wiki, user): @@ -19,7 +16,8 @@ def can_view_page(self, page, user): class HookProxy(object): def __getattr__(self, attr): - return getattr(settings.WIKI_HOOKSET, attr) + from django.conf import settings + return getattr(settings.PINAX_WIKI_HOOKSET, attr) hookset = HookProxy() diff --git a/wiki/models.py b/pinax/wiki/models.py similarity index 89% rename from wiki/models.py rename to pinax/wiki/models.py index 3a32cc4..63eff77 100644 --- a/wiki/models.py +++ b/pinax/wiki/models.py @@ -7,7 +7,10 @@ from django.utils import timezone from django.contrib.auth.models import User -from django.contrib.contenttypes.generic import GenericForeignKey +try: + from django.contrib.contenttypes.fields import GenericForeignKey +except ImportError: + from django.contrib.contenttypes.generic import GenericForeignKey from django.contrib.contenttypes.models import ContentType from .conf import settings @@ -50,7 +53,7 @@ class Revision(models.Model): content = models.TextField(help_text="Use markdown to mark up your text") content_html = models.TextField() message = models.TextField(blank=True, help_text="Leave a helpful message about your change") - created_ip = models.IPAddressField() + created_ip = models.GenericIPAddressField() created_at = models.DateTimeField(default=timezone.now) created_by = models.ForeignKey(User, related_name="revisions_created") media = models.ManyToManyField("MediaFile", blank=True, related_name="revisions") @@ -87,7 +90,7 @@ class MediaFile(models.Model): file = models.FileField(upload_to=uuid_filename) def download_url(self): - return reverse("wiki_file_download", args=[self.pk, os.path.basename(self.filename)]) + return reverse("pinax_wiki_file_download", args=[self.pk, os.path.basename(self.filename)]) def __unicode__(self): return self.filename diff --git a/wiki/parsers.py b/pinax/wiki/parsers.py similarity index 77% rename from wiki/parsers.py rename to pinax/wiki/parsers.py index 0f2f5af..6efa87a 100644 --- a/wiki/parsers.py +++ b/pinax/wiki/parsers.py @@ -1,11 +1,11 @@ -import creole +from __future__ import unicode_literals -from creole.html_emitter import HtmlEmitter +import creole from .utils import binders_map, object_slug -class PinaxWikiHtmlEmitter(HtmlEmitter): +class PinaxWikiHtmlEmitter(creole.HtmlEmitter): def __init__(self, wiki, root, link_rules=None): self.wiki = wiki @@ -20,13 +20,12 @@ def link_emit(self, node): m = self.link_rules.addr_re.match(target) if m: if m.group('extern_addr'): - return u'%s' % ( - self.attr_escape(target), inside) + return '{}'.format(self.attr_escape(target), inside) elif m.group('inter_wiki'): raise NotImplementedError slug = object_slug(self.wiki) page_url = binders_map()[slug].page_url(self.wiki, target) - return u'{1}'.format(self.attr_escape(page_url), inside) + return '{}'.format(self.attr_escape(page_url), inside) def creole_parse(wiki, text): diff --git a/wiki/receivers.py b/pinax/wiki/receivers.py similarity index 92% rename from wiki/receivers.py rename to pinax/wiki/receivers.py index 66592a7..31572f3 100644 --- a/wiki/receivers.py +++ b/pinax/wiki/receivers.py @@ -16,6 +16,6 @@ def handle_object_save(sender, **kwargs): ) -for binder in settings.WIKI_BINDERS: +for binder in settings.PINAX_WIKI_BINDERS: if binder.bind_to_model: post_save.connect(handle_object_save, sender=binder.bind_to_model) diff --git a/wiki/templatetags/__init__.py b/pinax/wiki/templatetags/__init__.py similarity index 100% rename from wiki/templatetags/__init__.py rename to pinax/wiki/templatetags/__init__.py diff --git a/wiki/templatetags/wiki_tags.py b/pinax/wiki/templatetags/pinax_wiki_tags.py similarity index 100% rename from wiki/templatetags/wiki_tags.py rename to pinax/wiki/templatetags/pinax_wiki_tags.py diff --git a/wiki/tests/__init__.py b/pinax/wiki/tests/__init__.py similarity index 100% rename from wiki/tests/__init__.py rename to pinax/wiki/tests/__init__.py diff --git a/wiki/tests/models.py b/pinax/wiki/tests/models.py similarity index 100% rename from wiki/tests/models.py rename to pinax/wiki/tests/models.py diff --git a/wiki/tests/tests.py b/pinax/wiki/tests/tests.py similarity index 100% rename from wiki/tests/tests.py rename to pinax/wiki/tests/tests.py diff --git a/wiki/tests/urls.py b/pinax/wiki/tests/urls.py similarity index 81% rename from wiki/tests/urls.py rename to pinax/wiki/tests/urls.py index 1477a9c..583a2e0 100644 --- a/wiki/tests/urls.py +++ b/pinax/wiki/tests/urls.py @@ -6,5 +6,5 @@ urlpatterns = patterns( "", - (r"^", include("wiki.urls")), + (r"^", include("pinax.wiki.urls")), ) diff --git a/pinax/wiki/urls.py b/pinax/wiki/urls.py new file mode 100644 index 0000000..efebab4 --- /dev/null +++ b/pinax/wiki/urls.py @@ -0,0 +1,20 @@ +import os + +from django.conf.urls import patterns, url + +from .conf import settings +from .views import index, page, edit, file_download, file_upload + +urlpatterns = patterns( + "", + url(r"^file-download/(\d+)/([^/]+)$", file_download, name="pinax_wiki_file_download"), + url(r"^file-upload/$", file_upload, name="pinax_wiki_file_upload") +) + +for binder in settings.PINAX_WIKI_BINDERS: + urlpatterns += patterns( + "", + url(os.path.join(binder.root, r"$"), index, {"binder": binder}, name=binder.index_url_name), + url(os.path.join(binder.root, r"(?P[^/]+)/$"), page, {"binder": binder}, name=binder.page_url_name), + url(os.path.join(binder.root, r"(?P[^/]+)/edit/$"), edit, {"binder": binder}, name=binder.edit_url_name), + ) diff --git a/wiki/utils.py b/pinax/wiki/utils.py similarity index 100% rename from wiki/utils.py rename to pinax/wiki/utils.py diff --git a/wiki/views.py b/pinax/wiki/views.py similarity index 91% rename from wiki/views.py rename to pinax/wiki/views.py index 6a4bf4b..f07397b 100644 --- a/wiki/views.py +++ b/pinax/wiki/views.py @@ -5,7 +5,10 @@ from django.views import static from django.views.decorators.http import require_POST -from account.decorators import login_required +try: + from account.decorators import login_required +except ImportError: + from django.contrib.auth.decorators import login_required from .conf import settings from .forms import RevisionForm @@ -28,7 +31,7 @@ def page(request, slug, binder, *args, **kwargs): if not hookset.can_view_page(page, request.user): raise Http404() rev = page.revisions.latest() - return render(request, "wiki/page.html", {"revision": rev, "can_edit": hookset.can_edit_page(page, request.user)}) + return render(request, "pinax/wiki/page.html", {"revision": rev, "can_edit": hookset.can_edit_page(page, request.user)}) except Page.DoesNotExist: return redirect(binder.edit_url(wiki, slug)) @@ -64,7 +67,7 @@ def edit(request, slug, binder, *args, **kwargs): else: form = RevisionForm(revision=rev) - return render(request, "wiki/edit.html", { + return render(request, "pinax/wiki/edit.html", { "form": form, "page": page, "revision": rev, diff --git a/runtests.py b/runtests.py index 91e802e..8dd48fb 100644 --- a/runtests.py +++ b/runtests.py @@ -12,8 +12,8 @@ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", - "wiki", - "wiki.tests" + "pinax.wiki", + "pinax.wiki.tests" ], DATABASES={ "default": { @@ -22,7 +22,7 @@ } }, SITE_ID=1, - ROOT_URLCONF="wiki.tests.urls", + ROOT_URLCONF="pinax.wiki.tests.urls", SECRET_KEY="notasecret", ) @@ -31,9 +31,7 @@ def runtests(*test_args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) - # Compatibility with Django 1.7's stricter initialization - if hasattr(django, "setup"): - django.setup() + django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) @@ -41,14 +39,14 @@ def runtests(*test_args): try: from django.test.runner import DiscoverRunner runner_class = DiscoverRunner - test_args = ["wiki.tests"] + if not test_args: + test_args = ["pinax.wiki.tests"] except ImportError: from django.test.simple import DjangoTestSuiteRunner runner_class = DjangoTestSuiteRunner test_args = ["tests"] - failures = runner_class( - verbosity=1, interactive=True, failfast=False).run_tests(test_args) + failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures) diff --git a/setup.py b/setup.py index 4154b02..1396ffe 100644 --- a/setup.py +++ b/setup.py @@ -11,22 +11,21 @@ def read(*parts): setup( - author="", - author_email="", - description="", + author="Pinax Team", + author_email="team@pinaxproject.com", + description="a wiki app for Django sites", name="pinax-wiki", long_description=read("README.rst"), - version=__import__("wiki").__version__, + version="0.2.0", url="http://pinax-wiki.rtfd.org/", license="MIT", packages=find_packages(), tests_require=[ - "Django>=1.4", + "Django>=1.7", ], install_requires=[ - "django-appconf>=0.6", - "django-user-accounts>=1.0c9", - "creole>=1.2" + "django-appconf>=1.0.1", + "python-creole>=1.3.1" ], test_suite="runtests.runtests", classifiers=[ diff --git a/tox.ini b/tox.ini index 14b30f5..08b7825 100644 --- a/tox.ini +++ b/tox.ini @@ -1,20 +1,100 @@ +[flake8] +ignore = E265,E501 +max-line-length = 100 +max-complexity = 10 +exclude = pinax/wiki/migrations/* + [tox] envlist = - py27-1.6, py27-master + py27-1.7, py27-1.8, py27-1.9, + py32-1.7, py32-1.8, + py33-1.7, py33-1.8, + py34-1.7, py34-1.8, py34-1.9, + py35-1.8, py35-1.9, [testenv] deps = - coverage == 3.6 -commands = coverage run setup.py test + flake8 == 2.5.0 + coverage == 4.0.2 +usedevelop = True +setenv = + LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=en_US.UTF-8 +commands = + flake8 pinax + coverage run setup.py test + +[testenv:py27-1.7] +basepython = python2.7 +deps = + {[testenv]deps} + Django<1.8 -[testenv:py27-1.6] +[testenv:py27-1.8] basepython = python2.7 deps = {[testenv]deps} - Django == 1.6.5 + Django<1.9 -[testenv:py27-master] +[testenv:py27-1.9] basepython = python2.7 deps = {[testenv]deps} - https://github.com/django/django/tarball/master + https://github.com/django/django/tarball/stable/1.9.x + +[testenv:py32-1.7] +basepython = python3.2 +deps = + flake8 == 2.5.0 + coverage == 3.7.1 + Django<1.8 + +[testenv:py32-1.8] +basepython = python3.2 +deps = + flake8 == 2.5.0 + coverage == 3.7.1 + Django<1.9 + +[testenv:py33-1.7] +basepython = python3.3 +deps = + {[testenv]deps} + Django<1.8 + +[testenv:py33-1.8] +basepython = python3.3 +deps = + {[testenv]deps} + Django<1.9 + +[testenv:py34-1.7] +basepython = python3.4 +deps = + {[testenv]deps} + Django<1.8 + +[testenv:py34-1.8] +basepython = python3.4 +deps = + {[testenv]deps} + Django<1.9 + +[testenv:py34-1.9] +basepython = python3.4 +deps = + {[testenv]deps} + https://github.com/django/django/tarball/stable/1.9.x + +[testenv:py35-1.8] +basepython = python3.5 +deps = + {[testenv]deps} + Django<1.9 + +[testenv:py35-1.9] +basepython = python3.5 +deps = + {[testenv]deps} + https://github.com/django/django/tarball/stable/1.9.x diff --git a/wiki/__init__.py b/wiki/__init__.py deleted file mode 100644 index 0af191f..0000000 --- a/wiki/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# following PEP 386 -__version__ = "0.1.3" diff --git a/wiki/urls.py b/wiki/urls.py deleted file mode 100644 index f0ae757..0000000 --- a/wiki/urls.py +++ /dev/null @@ -1,20 +0,0 @@ -import os - -from django.conf.urls import patterns, url - -from .conf import settings - - -urlpatterns = patterns( - "wiki.views", - url(r"^file-download/(\d+)/([^/]+)$", "file_download", name="wiki_file_download"), - url(r"^file-upload/$", "file_upload", name="wiki_file_upload") -) - -for binder in settings.WIKI_BINDERS: - urlpatterns += patterns( - "wiki.views", - url(os.path.join(binder.root, r"$"), "index", {"binder": binder}, name=binder.index_url_name), - url(os.path.join(binder.root, r"(?P[^/]+)/$"), "page", {"binder": binder}, name=binder.page_url_name), - url(os.path.join(binder.root, r"(?P[^/]+)/edit/$"), "edit", {"binder": binder}, name=binder.edit_url_name), - )