Skip to content

Commit

Permalink
Merge pull request #2369 from hypothesis/move-i18n-helper
Browse files Browse the repository at this point in the history
Move I18N helpers into h.i18n module
  • Loading branch information
tilgovi committed Jul 17, 2015
2 parents 1c42d14 + 93ce04c commit 9fc9c88
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion h/accounts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import deform
from pyramid.session import check_csrf_token

from h.models import _
from h import i18n
from h.accounts.models import User

_ = i18n.TranslationString

USERNAME_BLACKLIST = None


Expand Down
4 changes: 3 additions & 1 deletion h/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from h.resources import Application
from h.notification.models import Subscriptions
from h.models import _
from h import accounts
from h import i18n
from h.accounts.models import User
from h.accounts.models import Activation
from h.accounts.events import ActivationEvent
Expand All @@ -22,6 +22,8 @@
from h.accounts import schemas
from h import session

_ = i18n.TranslationString


def ajax_form(request, result):
if isinstance(result, httpexceptions.HTTPRedirection):
Expand Down
9 changes: 5 additions & 4 deletions h/claim/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from pyramid import httpexceptions as exc
from pyramid.view import view_config

from . import schemas
from ..models import _
from ..accounts.models import User
from ..accounts.events import LoginEvent
from h import i18n
from h.accounts.models import User
from h.accounts.events import LoginEvent
from h.claim import schemas

_ = i18n.TranslationString

log = logging.getLogger(__name__)

Expand Down
3 changes: 3 additions & 0 deletions h/i18n.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from pyramid.i18n import TranslationStringFactory

TranslationString = TranslationStringFactory('hypothesis')
3 changes: 0 additions & 3 deletions h/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from annotator import annotation, document
from pyramid.i18n import TranslationStringFactory
from pyramid.security import Allow, Authenticated, Everyone, ALL_PERMISSIONS

_ = TranslationStringFactory(__package__)


class Annotation(annotation.Annotation):
def __acl__(self):
Expand Down

0 comments on commit 9fc9c88

Please sign in to comment.