Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2585 from ubernostrum/move-wiki
Browse files Browse the repository at this point in the history
Move wiki app.
  • Loading branch information
groovecoder committed Aug 6, 2014
2 parents f10aa06 + e5741aa commit fed2054
Show file tree
Hide file tree
Showing 161 changed files with 304 additions and 315 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ before_script:
- mysql -e 'create database kuma;'

script:
- coverage run --include=`pwd`/kuma/*,`pwd`/apps/* manage.py test --noinput -v2 actioncounters contentflagging dashboards kuma.demos devmo kpi landing search kuma.users wiki kuma.events
- coverage run --include=`pwd`/kuma/*,`pwd`/apps/* manage.py test --noinput -v2 actioncounters contentflagging dashboards kuma.demos devmo kpi landing search kuma.users kuma.wiki kuma.events

after_success:
- coveralls
Expand Down
5 changes: 2 additions & 3 deletions apps/contentflagging/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@

from sumo.urlresolvers import reverse

from devmo.tests import LocalizingClient
from kuma.demos.models import Submission
from kuma.demos.tests.test_models import save_valid_submission
from devmo.tests import LocalizingClient
from wiki.models import Document

from kuma.wiki.models import Document
from .models import ContentFlag
from .utils import get_ip, get_unique

Expand Down
13 changes: 6 additions & 7 deletions apps/dashboards/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import json
import datetime
import json

from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.http import require_GET

from sumo.utils import paginate

from wiki.models import Document, Revision

from dashboards.forms import RevisionDashboardForm

from kuma.users.helpers import ban_link
from kuma.wiki.models import Document, Revision
from sumo.urlresolvers import reverse
from sumo.utils import paginate, smart_int
from .forms import RevisionDashboardForm
from . import PAGE_SIZE


Expand Down
15 changes: 8 additions & 7 deletions apps/devmo/helpers.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import datetime
import os
import re
import urllib

import bleach
import jinja2
import pytz
from urlobject import URLObject
import os

from django.conf import settings

from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.cache import cache
from django.template import defaultfilters
from django.utils.encoding import force_text
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.contrib.messages.storage.base import LEVEL_TAGS

import bleach
from jingo import register
import jinja2
import pytz
from soapbox.models import Message
from statici18n.utils import get_filename
from django.contrib.staticfiles.storage import staticfiles_storage

from kuma.wiki.models import Document
from sumo.urlresolvers import split_path, reverse
from wiki.models import Document

from .utils import entity_decode


Expand Down
2 changes: 1 addition & 1 deletion apps/kpi/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cronjobs

from kpi.models import Metric, MetricKind, L10N_METRIC_CODE
from wiki.models import Document
from kuma.wiki.models import Document


@cronjobs.register
Expand Down
2 changes: 1 addition & 1 deletion apps/kpi/tests/test_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from kpi.cron import update_l10n_metric
from kpi.models import Metric, L10N_METRIC_CODE
from kpi.tests import metric_kind
from kuma.wiki.tests import document, revision
from sumo.tests import TestCase
from wiki.tests import document, revision


class CronJobTests(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion apps/search/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.db.models.signals import pre_delete
from elasticsearch.exceptions import ConnectionError

from wiki.signals import render_done
from kuma.wiki.signals import render_done

from .signals import render_done_handler, pre_delete_handler

Expand Down
2 changes: 1 addition & 1 deletion apps/search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from sumo.urlresolvers import reverse

from wiki.models import Document
from kuma.wiki.models import Document
from taggit_extras.managers import PrefetchTaggableManager

from .decorators import register_mapping_type
Expand Down
3 changes: 2 additions & 1 deletion apps/search/tests/test_indexes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from nose.tools import eq_, ok_

from django.conf import settings

from elasticsearch.exceptions import RequestError

from wiki.models import Document
from kuma.wiki.models import Document
from search.models import Index, DocumentType
from search.tests import ElasticTestCase
from search.index import get_indexing_es, get_indexes
Expand Down
6 changes: 2 additions & 4 deletions apps/search/tests/test_tasks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from nose.tools import eq_

from search.tests import ElasticTestCase

from wiki.tests import revision

from kuma.wiki.tests import revision
from search.models import DocumentType
from search.tests import ElasticTestCase


class TestLiveIndexing(ElasticTestCase):
Expand Down
3 changes: 1 addition & 2 deletions apps/search/tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from nose.tools import ok_, eq_

from kuma.wiki.models import Document
from search.models import DocumentType
from search.tests import ElasticTestCase

from wiki.models import Document


class DocumentTypeTests(ElasticTestCase):
fixtures = ['test_users.json', 'wiki/documents.json']
Expand Down
2 changes: 1 addition & 1 deletion apps/sumo/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _get_wiki_link(title, locale):
found is False if the document does not exist.
"""
from wiki.models import Document
from kuma.wiki.models import Document
d = get_object_fallback(Document, locale=locale, title=title,
is_template=False)
if d:
Expand Down
2 changes: 1 addition & 1 deletion apps/sumo/urlresolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None,
# See apps/wiki/tests/test_middleware.py for a test exercising this hack.
if url.startswith('/docs/'):
# HACK: Import here, because otherwise it's a circular reference
from wiki.models import DocumentZone
from kuma.wiki.models import DocumentZone
# Work out a current locale, from some source.
zone_locale = locale
if not zone_locale:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n %}

{% block breadcrumbs %}
<div class="breadcrumbs">
Expand All @@ -10,7 +11,7 @@
{% endblock %}

{% block content %}
<p>{% trans object_name=object_name %}Are you sure you want to censor the selected {{ object_name }} objects? This cannot be reversed.{% endtrans %}</p>
<p>{% blocktrans %}Are you sure you want to censor the selected {{ object_name }} objects? This cannot be reversed.{% endblocktrans %}</p>
<ul>
{% for obj in queryset %}
<li>{{ obj }}</li>
Expand Down
2 changes: 1 addition & 1 deletion kuma/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from waffle import switch_is_active

from devmo.models import ModelBase
from kuma.wiki.models import Revision
from sumo.models import LocaleField
from wiki.models import Revision

from .helpers import gravatar_url
from .tasks import send_welcome_email
Expand Down
3 changes: 1 addition & 2 deletions kuma/users/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from nose.tools import eq_, ok_
from nose.plugins.attrib import attr

from kuma.wiki.tests import revision
from sumo.tests import TestCase
from wiki.tests import revision

from ..models import UserBan, UserProfile
from . import profile

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions apps/wiki/admin.py → kuma/wiki/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from sumo.urlresolvers import reverse

from access.decorators import login_required, permission_required
from wiki.decorators import check_readonly
from wiki.models import (Document, DocumentZone, DocumentTag, Revision,
EditorToolbar, Attachment, AttachmentRevision)
from .decorators import check_readonly
from .models import (Document, DocumentZone, DocumentTag, Revision,
EditorToolbar, Attachment, AttachmentRevision)


def dump_selected_documents(self, request, queryset):
Expand Down
5 changes: 2 additions & 3 deletions apps/wiki/badges.py → kuma/wiki/badges.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from django.db.models.signals import post_save

import waffle

from badger.utils import get_badge
import waffle

from wiki.models import Revision
from .models import Revision


# Machine-awarded badges defined here
Expand Down
2 changes: 2 additions & 0 deletions apps/wiki/constants.py → kuma/wiki/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import re

import bleach
from tower import ugettext_lazy as _lazy

from django.conf import settings


ALLOWED_TAGS = bleach.ALLOWED_TAGS + [
'div', 'span', 'p', 'br', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'pre', 'code', 'cite',
Expand Down
9 changes: 3 additions & 6 deletions apps/wiki/content.py → kuma/wiki/content.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# coding=utf-8
from collections import defaultdict
import re
import urllib
from urllib import urlencode
from urlparse import urlparse
from collections import defaultdict

from xml.sax.saxutils import quoteattr

import html5lib
from html5lib.filters._base import Filter as html5lib_Filter
from pyquery import PyQuery as pq

import newrelic.agent
from pyquery import PyQuery as pq

from tower import ugettext as _

from sumo.urlresolvers import reverse

from .utils import locale_and_slug_from_path


Expand Down Expand Up @@ -371,7 +368,7 @@ def __init__(self, source, base_url):
self.base_url_parsed = urlparse(base_url)

def __iter__(self):
from wiki.models import Document
from kuma.wiki.models import Document

input = html5lib_Filter.__iter__(self)

Expand Down
4 changes: 2 additions & 2 deletions apps/wiki/cron.py → kuma/wiki/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import cronjobs

from wiki import tasks
from wiki.models import Document
from . import tasks
from .models import Document
from search.models import DocumentType


Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions apps/wiki/events.py → kuma/wiki/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from devmo.helpers import add_utm
from tidings.events import InstanceEvent
from sumo.urlresolvers import reverse
from wiki.helpers import revisions_unified_diff
from wiki.models import Document
from .helpers import revisions_unified_diff
from .models import Document


log = logging.getLogger('mdn.wiki.events')
Expand Down
File renamed without changes.
20 changes: 10 additions & 10 deletions apps/wiki/feeds.py → kuma/wiki/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import datetime
import json
import urllib

import validate_jsonp

from django.conf import settings
Expand All @@ -14,9 +15,8 @@

from sumo.urlresolvers import reverse
from kuma.users.models import UserProfile

from wiki.helpers import diff_table, tag_diff_table, compare_url, colorize_diff
from wiki.models import Document, Revision, AttachmentRevision
from .helpers import diff_table, tag_diff_table, compare_url, colorize_diff
from .models import Document, Revision, AttachmentRevision


MAX_FEED_ITEMS = getattr(settings, 'MAX_FEED_ITEMS', 500)
Expand Down Expand Up @@ -64,7 +64,7 @@ def item_author_link(self, document):

def item_link(self, document):
return self.request.build_absolute_uri(
reverse('wiki.views.document', locale=document.locale,
reverse('kuma.wiki.views.document', locale=document.locale,
args=(document.slug,)))

def item_categories(self, document):
Expand Down Expand Up @@ -118,7 +118,7 @@ def write(self, outfile, encoding):
# Linkify the tags used in the feed item
categories = dict(
(x, request.build_absolute_uri(
reverse('wiki.views.list_documents',
reverse('kuma.wiki.views.list_documents',
kwargs={'tag': x})))
for x in item['categories']
)
Expand Down Expand Up @@ -154,7 +154,7 @@ def get_object(self, request, format, tag=None, category=None):
reverse('wiki.tag', args=(tag,)))
else:
self.link = self.request.build_absolute_uri(
reverse('wiki.views.list_documents'))
reverse('kuma.wiki.views.list_documents'))

def items(self):
locale = ((self.request.GET.get('all_locales', False) is False)
Expand All @@ -177,12 +177,12 @@ def get_object(self, request, format, tag=None):
if tag:
self.title = _('MDN documents for %s review' % tag)
self.link = self.request.build_absolute_uri(
reverse('wiki.views.list_documents_for_review',
reverse('kuma.wiki.views.list_documents_for_review',
args=(tag,)))
else:
self.title = _('MDN documents for review')
self.link = self.request.build_absolute_uri(
reverse('wiki.views.list_documents_for_review'))
reverse('kuma.wiki.views.list_documents_for_review'))
return tag

def items(self, tag=None):
Expand All @@ -208,7 +208,7 @@ def get_object(self, request, format, tag=None):
self.locale)
# TODO: Need an HTML / dashboard version of this feed
self.link = self.request.build_absolute_uri(
reverse('wiki.views.list_documents'))
reverse('kuma.wiki.views.list_documents'))

def items(self):
return (Document.objects
Expand Down Expand Up @@ -357,7 +357,7 @@ def item_description(self, item):

def item_link(self, item):
return self.request.build_absolute_uri(
reverse('wiki.views.document', locale=item.document.locale,
reverse('kuma.wiki.views.document', locale=item.document.locale,
args=(item.document.slug,)))

def item_pubdate(self, item):
Expand Down

0 comments on commit fed2054

Please sign in to comment.