Commits

Anonymous committed 5b03910

major: transifex application renamed to txcommon

Having both the project directory and our common application
called 'transifex' is a bad idea. Python deployments might try
to import the app and import the project itself due to PYTHON_PATH
order.

  • Participants
  • Parent commits 34465c7
  • Tags 0.5-rc1

Comments (0)

Files changed (39)

build-tools/SPECS/transifex.spec.in

 %{_datadir}/%{name}/simplelock
 %{_datadir}/%{name}/site_media
 %{_datadir}/%{name}/templates
-%{_datadir}/%{name}/transifex
+%{_datadir}/%{name}/txcommon
 %{_datadir}/%{name}/translations
 %{_datadir}/%{name}/txcollections
 %dir %{_datadir}/%{name}/vcs

projects/handlers/types/intltool.py

 from projects.handlers.types import pot
-from transifex.log import logger
+from txcommon.log import logger
 
 
 class IntltoolHandler(pot.POTHandler):

projects/handlers/types/pot.py

 from translations.lib.types.pot import POTManager
-from transifex.log import logger
+from txcommon.log import logger
 
 class POTHandler:
     """

projects/models.py

 from txcollections.models import Collection, CollectionRelease
 from translations.models import POFile
 from vcs.models import Unit
-from transifex.log import (logger, log_model)
+from txcommon.log import (logger, log_model)
 from projects.handlers import get_trans_handler
 
 

projects/views.py

 
 from projects.models import Project, Component
 from projects.forms import ProjectForm, ComponentForm, UnitForm
-from transifex.log import logger
+from txcommon.log import logger
 from actionlog.models import (log_addition, log_change, log_deletion)
 from translations.lib.types.pot import FileFilterError
 from translations.models import (POFile, POFileLock)
 from translations.models import POFile
 from languages.models import Language
-from transifex.decorators import perm_required_with_403
+from txcommon.decorators import perm_required_with_403
 
 # Feeds
 
     'pagination',
     'contact_form',
     # Transifex specific apps:
-    'transifex',
+    'txcommon',
     'vcs',
     'translations',
     'languages',

transifex/__init__.py

-version_info = (0, 5, 0, 'alpha', 0)
-
-_verpart = ''
-if version_info[3] != 'final':
-    _verpart = version_info[3]
-
-version = '.'.join(str(v) for v in version_info[:3]) + _verpart
-
-del _verpart

transifex/decorators.py

-# -*- coding: utf-8 -*-
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-
-def user_passes_test_with_403(test_func, login_url=None):
-    """
-    Decorator for views that checks that the user passes the given test.
-    
-    Users that fail the test will be given a 403 error.
-    """
-    def _dec(view_func):
-        def _checklogin(request, *args, **kwargs):
-            if test_func(request.user):
-                return view_func(request, *args, **kwargs)
-            else:
-                resp = render_to_response('403.html', context_instance=RequestContext(request))
-                resp.status_code = 403
-                return resp
-        _checklogin.__doc__ = view_func.__doc__
-        _checklogin.__dict__ = view_func.__dict__
-        return _checklogin
-    return _dec
-
-def perm_required_with_403(perm):
-    """
-    Decorator for views that checks whether a user has a particular permissions
-    enabled, rendering a 403 page as necessary.
-
-    """
-    return user_passes_test_with_403(lambda u: u.has_perm(perm))

transifex/fixtures/sample_data.json

-[
-  {
-    "pk": 9, 
-    "model": "projects.project", 
-    "fields": {
-      "feed": "", 
-      "description": "Avant Window Navigator (Awn) is a dock-like bar which sits at the bottom of the screen. (bzr)", 
-      "created": "2008-10-09 00:00:00", 
-      "long_description_html": "", 
-      "tags": "", 
-      "enabled": true, 
-      "modified": "2009-03-09 20:17:18", 
-      "slug": "awn", 
-      "maintainers": [], 
-      "collections": [
-        2
-      ], 
-      "hidden": false, 
-      "homepage": "http://launchpad.net/awn", 
-      "long_description": "", 
-      "name": "Avant Window Navigator"
-    }
-  }, 
-  {
-    "pk": 10, 
-    "model": "projects.project", 
-    "fields": {
-      "feed": "", 
-      "description": "Yet another testing module! (cvs)", 
-      "created": "2008-10-16 00:00:00", 
-      "long_description_html": "", 
-      "tags": "", 
-      "enabled": true, 
-      "modified": "2009-03-09 20:16:57", 
-      "slug": "switchdesk", 
-      "maintainers": [], 
-      "collections": [
-        2
-      ], 
-      "hidden": false, 
-      "homepage": "", 
-      "long_description": "", 
-      "name": "Switchdesk"
-    }
-  }, 
-  {
-    "pk": 19, 
-    "model": "projects.project", 
-    "fields": {
-      "feed": "", 
-      "description": "Tools for certain user account management tasks (hg)", 
-      "created": "2009-02-13 18:46:14", 
-      "long_description_html": "", 
-      "tags": "", 
-      "enabled": true, 
-      "modified": "2009-03-09 20:16:32", 
-      "slug": "usermode", 
-      "maintainers": [
-        2
-      ], 
-      "collections": [
-        1
-      ], 
-      "hidden": false, 
-      "homepage": "", 
-      "long_description": "", 
-      "name": "Usermode"
-    }
-  }, 
-  {
-    "pk": 20, 
-    "model": "projects.project", 
-    "fields": {
-      "feed": "", 
-      "description": "Desktop Effects (git)", 
-      "created": "2009-03-09 20:14:18", 
-      "long_description_html": "", 
-      "tags": "gui,graphics", 
-      "enabled": true, 
-      "modified": "2009-03-09 20:16:16", 
-      "slug": "desktop-effects", 
-      "maintainers": [], 
-      "collections": [
-        1
-      ], 
-      "hidden": false, 
-      "homepage": "", 
-      "long_description": "", 
-      "name": "desktop-effects"
-    }
-  }, 
-  {
-    "pk": 8, 
-    "model": "projects.project", 
-    "fields": {
-      "feed": "", 
-      "description": "Desktop Input Method configuration tool (svn)", 
-      "created": "2008-10-08 00:00:00", 
-      "long_description_html": "<p>Desktop Input Method configuration tool\n</p>", 
-      "tags": "", 
-      "enabled": true, 
-      "modified": "2009-03-09 20:15:53", 
-      "slug": "im-chooser", 
-      "maintainers": [], 
-      "collections": [], 
-      "hidden": false, 
-      "homepage": "https://fedorahosted.org/im-chooser", 
-      "long_description": "Desktop Input Method configuration tool", 
-      "name": "im-chooser"
-    }
-  }, 
-  {
-    "pk": 5, 
-    "model": "projects.component", 
-    "fields": {
-      "slug": "02", 
-      "description": "This is the branch that blah blah.", 
-      "releases": [], 
-      "created": "2008-10-09 00:00:00", 
-      "enabled": true, 
-      "i18n_type": "INTLTOOL", 
-      "file_filter": "po/.*", 
-      "modified": "2009-03-09 20:17:18", 
-      "long_description": "", 
-      "project": 9, 
-      "long_description_html": "", 
-      "full_name": "awn.02", 
-      "hidden": false, 
-      "allows_submission": false, 
-      "source_lang": "en", 
-      "unit": 5, 
-      "name": "0.2 branch"
-    }
-  }, 
-  {
-    "pk": 6, 
-    "model": "projects.component", 
-    "fields": {
-      "slug": "head", 
-      "description": "", 
-      "releases": [
-        2
-      ], 
-      "created": "2008-10-16 00:00:00", 
-      "enabled": true, 
-      "i18n_type": "POT", 
-      "file_filter": "po/.*", 
-      "modified": "2009-03-09 20:16:57", 
-      "long_description": "", 
-      "project": 10, 
-      "long_description_html": "", 
-      "full_name": "switchdesk.head", 
-      "hidden": false, 
-      "allows_submission": false, 
-      "source_lang": "en", 
-      "unit": 6, 
-      "name": "HEAD"
-    }
-  }, 
-  {
-    "pk": 15, 
-    "model": "projects.component", 
-    "fields": {
-      "slug": "master", 
-      "description": "", 
-      "releases": [
-        1
-      ], 
-      "created": "2009-03-09 20:14:46", 
-      "enabled": true, 
-      "i18n_type": "POT", 
-      "file_filter": ".*", 
-      "modified": "2009-03-09 20:16:16", 
-      "long_description": "", 
-      "project": 20, 
-      "long_description_html": "", 
-      "full_name": "desktop-effects.master", 
-      "hidden": false, 
-      "allows_submission": false, 
-      "source_lang": "en", 
-      "unit": 15, 
-      "name": "Master branch"
-    }
-  }, 
-  {
-    "pk": 4, 
-    "model": "projects.component", 
-    "fields": {
-      "slug": "trunk", 
-      "description": "Top of project devel", 
-      "releases": [
-        1
-      ], 
-      "created": "2008-10-08 00:00:00", 
-      "enabled": true, 
-      "i18n_type": "INTLTOOL", 
-      "file_filter": "po/.*", 
-      "modified": "2009-03-09 20:15:58", 
-      "long_description": "", 
-      "project": 8, 
-      "long_description_html": "", 
-      "full_name": "im-chooser.trunk", 
-      "hidden": false, 
-      "allows_submission": false, 
-      "source_lang": "en", 
-      "unit": 4, 
-      "name": "Trunk"
-    }
-  }, 
-  {
-    "pk": 14, 
-    "model": "projects.component", 
-    "fields": {
-      "slug": "tip", 
-      "description": "", 
-      "releases": [], 
-      "created": "2009-02-14 23:29:03", 
-      "enabled": true, 
-      "i18n_type": "INTLTOOL", 
-      "file_filter": "po/.*", 
-      "modified": "2009-03-09 20:16:32", 
-      "long_description": "", 
-      "project": 19, 
-      "long_description_html": "", 
-      "full_name": "usermode.tip", 
-      "hidden": false, 
-      "allows_submission": false, 
-      "source_lang": "en", 
-      "unit": 14, 
-      "name": "tip"
-    }
-  }, 
-  {
-    "pk": 1, 
-    "model": "txcollections.collection", 
-    "fields": {
-      "description": "Fedora, the Linux distribution", 
-      "created": "2008-11-10 00:00:00", 
-      "long_description_html": "", 
-      "tags": "fedora distribution", 
-      "enabled": true, 
-      "modified": "2008-11-10 18:48:13", 
-      "slug": "fedora", 
-      "hidden": false, 
-      "homepage": "http://fedoraproject.org/", 
-      "long_description": "", 
-      "name": "Fedora"
-    }
-  }, 
-  {
-    "pk": 2, 
-    "model": "txcollections.collection", 
-    "fields": {
-      "description": "The GNOME Desktop and development platform", 
-      "created": "2008-11-19 00:00:00", 
-      "long_description_html": "", 
-      "tags": "desktop", 
-      "enabled": true, 
-      "modified": "2008-11-19 23:51:40", 
-      "slug": "gnome", 
-      "hidden": false, 
-      "homepage": "http://gnome.org/", 
-      "long_description": "", 
-      "name": "GNOME"
-    }
-  }, 
-  {
-    "pk": 1, 
-    "model": "txcollections.collectionrelease", 
-    "fields": {
-      "long_description_html": "", 
-      "description": "The 10th release of Fedora", 
-      "created": "2008-11-21 00:00:00", 
-      "release_date": "2008-11-25 00:00:00", 
-      "enabled": true, 
-      "modified": "2008-11-21 02:51:39", 
-      "collection": 1, 
-      "slug": "10", 
-      "stringfreeze_date": "2008-09-11 00:00:00", 
-      "hidden": false, 
-      "homepage": "http://fedoraproject.org/wiki/Releases/10", 
-      "long_description": "", 
-      "develfreeze_date": "2008-10-28 00:00:00", 
-      "name": "Fedora 10"
-    }
-  }, 
-  {
-    "pk": 2, 
-    "model": "txcollections.collectionrelease", 
-    "fields": {
-      "long_description_html": "", 
-      "description": "The 2.24 GNOME release", 
-      "created": "2008-11-21 00:00:00", 
-      "release_date": null, 
-      "enabled": true, 
-      "modified": "2008-11-21 02:54:45", 
-      "collection": 2, 
-      "slug": "2-24", 
-      "stringfreeze_date": null, 
-      "hidden": false, 
-      "homepage": "", 
-      "long_description": "", 
-      "develfreeze_date": null, 
-      "name": "GNOME 2.24"
-    }
-  }, 
-  {
-    "pk": 5, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "", 
-      "name": "awn.02", 
-      "last_checkout": "2009-02-16 21:02:01", 
-      "created": "2008-10-09 00:00:00", 
-      "root": "http://bazaar.launchpad.net/~awn-core/awn/0.2/", 
-      "modified": "2009-03-09 20:17:18", 
-      "branch": "0.2", 
-      "type": "bzr"
-    }
-  }, 
-  {
-    "pk": 15, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "", 
-      "name": "desktop-effects.master", 
-      "last_checkout": null, 
-      "created": "2009-03-09 20:14:46", 
-      "root": "git://git.fedorahosted.org/git/desktop-effects.git", 
-      "modified": "2009-03-09 20:16:16", 
-      "branch": "master", 
-      "type": "git"
-    }
-  }, 
-  {
-    "pk": 7, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "", 
-      "name": "fedora-web.master", 
-      "last_checkout": "2009-02-16 20:02:06", 
-      "created": "2009-02-11 22:06:55", 
-      "root": "git://git.fedorahosted.org/git/fedora-websites.git", 
-      "modified": "2009-02-16 20:02:06", 
-      "branch": "master", 
-      "type": "git"
-    }
-  }, 
-  {
-    "pk": 4, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "", 
-      "name": "im-chooser.trunk", 
-      "last_checkout": "2009-02-16 20:02:43", 
-      "created": "2008-10-08 00:00:00", 
-      "root": "http://svn.fedorahosted.org/svn/im-chooser", 
-      "modified": "2009-03-09 20:15:58", 
-      "branch": "trunk", 
-      "type": "svn"
-    }
-  }, 
-  {
-    "pk": 6, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "http://cvs.fedoraproject.org/viewvc/switchdesk/?root=elvis", 
-      "name": "switchdesk.head", 
-      "last_checkout": "2009-02-16 19:36:04", 
-      "created": "2008-10-16 00:00:00", 
-      "root": ":pserver:anonymous@cvs.fedoraproject.org:/cvs/elvis/switchdesk", 
-      "modified": "2009-03-09 20:16:57", 
-      "branch": "HEAD", 
-      "type": "cvs"
-    }
-  }, 
-  {
-    "pk": 14, 
-    "model": "vcs.unit", 
-    "fields": {
-      "web_frontend": "", 
-      "name": "usermode.tip", 
-      "last_checkout": "2009-02-16 20:58:34", 
-      "created": "2009-02-14 23:29:03", 
-      "root": "http://hg.fedorahosted.org/hg/usermode", 
-      "modified": "2009-03-09 20:16:32", 
-      "branch": "tip", 
-      "type": "hg"
-    }
-  }, 
-  {
-    "pk": 1, 
-    "model": "sites.site", 
-    "fields": {
-      "domain": "example.com", 
-      "name": "example.com"
-    }
-  } 
-]

transifex/fixtures/sample_site.json

-[
-  {
-    "pk": 1, 
-    "model": "sites.site", 
-    "fields": {
-      "domain": "localhost", 
-      "name": "Transifex"
-    }
-  }
-]

transifex/fixtures/sample_users.json

-[
-  {
-    "pk": 80, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_logentry", 
-      "name": "Can add log entry", 
-      "content_type": 26
-    }
-  }, 
-  {
-    "pk": 81, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_logentry", 
-      "name": "Can change log entry", 
-      "content_type": 26
-    }
-  }, 
-  {
-    "pk": 82, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_logentry", 
-      "name": "Can delete log entry", 
-      "content_type": 26
-    }
-  }, 
-  {
-    "pk": 1, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_logentry", 
-      "name": "Can add log entry", 
-      "content_type": 1
-    }
-  }, 
-  {
-    "pk": 2, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_logentry", 
-      "name": "Can change log entry", 
-      "content_type": 1
-    }
-  }, 
-  {
-    "pk": 3, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_logentry", 
-      "name": "Can delete log entry", 
-      "content_type": 1
-    }
-  }, 
-  {
-    "pk": 7, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_group", 
-      "name": "Can add group", 
-      "content_type": 3
-    }
-  }, 
-  {
-    "pk": 13, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_message", 
-      "name": "Can add message", 
-      "content_type": 5
-    }
-  }, 
-  {
-    "pk": 4, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_permission", 
-      "name": "Can add permission", 
-      "content_type": 2
-    }
-  }, 
-  {
-    "pk": 10, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_user", 
-      "name": "Can add user", 
-      "content_type": 4
-    }
-  }, 
-  {
-    "pk": 8, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_group", 
-      "name": "Can change group", 
-      "content_type": 3
-    }
-  }, 
-  {
-    "pk": 14, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_message", 
-      "name": "Can change message", 
-      "content_type": 5
-    }
-  }, 
-  {
-    "pk": 5, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_permission", 
-      "name": "Can change permission", 
-      "content_type": 2
-    }
-  }, 
-  {
-    "pk": 11, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_user", 
-      "name": "Can change user", 
-      "content_type": 4
-    }
-  }, 
-  {
-    "pk": 9, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_group", 
-      "name": "Can delete group", 
-      "content_type": 3
-    }
-  }, 
-  {
-    "pk": 15, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_message", 
-      "name": "Can delete message", 
-      "content_type": 5
-    }
-  }, 
-  {
-    "pk": 6, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_permission", 
-      "name": "Can delete permission", 
-      "content_type": 2
-    }
-  }, 
-  {
-    "pk": 12, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_user", 
-      "name": "Can delete user", 
-      "content_type": 4
-    }
-  }, 
-  {
-    "pk": 16, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_comment", 
-      "name": "Can add comment", 
-      "content_type": 6
-    }
-  }, 
-  {
-    "pk": 20, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_commentflag", 
-      "name": "Can add comment flag", 
-      "content_type": 7
-    }
-  }, 
-  {
-    "pk": 19, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "can_moderate", 
-      "name": "Can moderate comments", 
-      "content_type": 6
-    }
-  }, 
-  {
-    "pk": 17, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_comment", 
-      "name": "Can change comment", 
-      "content_type": 6
-    }
-  }, 
-  {
-    "pk": 21, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_commentflag", 
-      "name": "Can change comment flag", 
-      "content_type": 7
-    }
-  }, 
-  {
-    "pk": 18, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_comment", 
-      "name": "Can delete comment", 
-      "content_type": 6
-    }
-  }, 
-  {
-    "pk": 22, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_commentflag", 
-      "name": "Can delete comment flag", 
-      "content_type": 7
-    }
-  }, 
-  {
-    "pk": 23, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_contenttype", 
-      "name": "Can add content type", 
-      "content_type": 8
-    }
-  }, 
-  {
-    "pk": 24, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_contenttype", 
-      "name": "Can change content type", 
-      "content_type": 8
-    }
-  }, 
-  {
-    "pk": 25, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_contenttype", 
-      "name": "Can delete content type", 
-      "content_type": 8
-    }
-  }, 
-  {
-    "pk": 38, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_association", 
-      "name": "Can add association", 
-      "content_type": 13
-    }
-  }, 
-  {
-    "pk": 35, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_nonce", 
-      "name": "Can add nonce", 
-      "content_type": 12
-    }
-  }, 
-  {
-    "pk": 41, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_userassociation", 
-      "name": "Can add user association", 
-      "content_type": 14
-    }
-  }, 
-  {
-    "pk": 44, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_userpasswordqueue", 
-      "name": "Can add user password queue", 
-      "content_type": 15
-    }
-  }, 
-  {
-    "pk": 39, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_association", 
-      "name": "Can change association", 
-      "content_type": 13
-    }
-  }, 
-  {
-    "pk": 36, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_nonce", 
-      "name": "Can change nonce", 
-      "content_type": 12
-    }
-  }, 
-  {
-    "pk": 42, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_userassociation", 
-      "name": "Can change user association", 
-      "content_type": 14
-    }
-  }, 
-  {
-    "pk": 45, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_userpasswordqueue", 
-      "name": "Can change user password queue", 
-      "content_type": 15
-    }
-  }, 
-  {
-    "pk": 40, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_association", 
-      "name": "Can delete association", 
-      "content_type": 13
-    }
-  }, 
-  {
-    "pk": 37, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_nonce", 
-      "name": "Can delete nonce", 
-      "content_type": 12
-    }
-  }, 
-  {
-    "pk": 43, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_userassociation", 
-      "name": "Can delete user association", 
-      "content_type": 14
-    }
-  }, 
-  {
-    "pk": 46, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_userpasswordqueue", 
-      "name": "Can delete user password queue", 
-      "content_type": 15
-    }
-  }, 
-  {
-    "pk": 26, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_flatpage", 
-      "name": "Can add flat page", 
-      "content_type": 9
-    }
-  }, 
-  {
-    "pk": 27, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_flatpage", 
-      "name": "Can change flat page", 
-      "content_type": 9
-    }
-  }, 
-  {
-    "pk": 28, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_flatpage", 
-      "name": "Can delete flat page", 
-      "content_type": 9
-    }
-  }, 
-  {
-    "pk": 62, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_language", 
-      "name": "Can add language", 
-      "content_type": 21
-    }
-  }, 
-  {
-    "pk": 63, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_language", 
-      "name": "Can change language", 
-      "content_type": 21
-    }
-  }, 
-  {
-    "pk": 64, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_language", 
-      "name": "Can delete language", 
-      "content_type": 21
-    }
-  }, 
-  {
-    "pk": 68, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_component", 
-      "name": "Can add component", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 65, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_project", 
-      "name": "Can add project", 
-      "content_type": 22
-    }
-  }, 
-  {
-    "pk": 69, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_component", 
-      "name": "Can change component", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 66, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_project", 
-      "name": "Can change project", 
-      "content_type": 22
-    }
-  }, 
-  {
-    "pk": 71, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "clear_cache", 
-      "name": "Can clear cache", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 70, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_component", 
-      "name": "Can delete component", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 67, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_project", 
-      "name": "Can delete project", 
-      "content_type": 22
-    }
-  }, 
-  {
-    "pk": 72, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "refresh_stats", 
-      "name": "Can refresh statistics", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 73, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "submit_file", 
-      "name": "Can submit file", 
-      "content_type": 23
-    }
-  }, 
-  {
-    "pk": 29, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_session", 
-      "name": "Can add session", 
-      "content_type": 10
-    }
-  }, 
-  {
-    "pk": 30, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_session", 
-      "name": "Can change session", 
-      "content_type": 10
-    }
-  }, 
-  {
-    "pk": 31, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_session", 
-      "name": "Can delete session", 
-      "content_type": 10
-    }
-  }, 
-  {
-    "pk": 32, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_site", 
-      "name": "Can add site", 
-      "content_type": 11
-    }
-  }, 
-  {
-    "pk": 33, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_site", 
-      "name": "Can change site", 
-      "content_type": 11
-    }
-  }, 
-  {
-    "pk": 34, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_site", 
-      "name": "Can delete site", 
-      "content_type": 11
-    }
-  }, 
-  {
-    "pk": 47, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_tag", 
-      "name": "Can add tag", 
-      "content_type": 16
-    }
-  }, 
-  {
-    "pk": 50, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_taggeditem", 
-      "name": "Can add tagged item", 
-      "content_type": 17
-    }
-  }, 
-  {
-    "pk": 48, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_tag", 
-      "name": "Can change tag", 
-      "content_type": 16
-    }
-  }, 
-  {
-    "pk": 51, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_taggeditem", 
-      "name": "Can change tagged item", 
-      "content_type": 17
-    }
-  }, 
-  {
-    "pk": 49, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_tag", 
-      "name": "Can delete tag", 
-      "content_type": 16
-    }
-  }, 
-  {
-    "pk": 52, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_taggeditem", 
-      "name": "Can delete tagged item", 
-      "content_type": 17
-    }
-  }, 
-  {
-    "pk": 56, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_pofile", 
-      "name": "Can add PO file", 
-      "content_type": 19
-    }
-  }, 
-  {
-    "pk": 59, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_pofilelock", 
-      "name": "Can add Lock", 
-      "content_type": 20
-    }
-  }, 
-  {
-    "pk": 57, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_pofile", 
-      "name": "Can change PO file", 
-      "content_type": 19
-    }
-  }, 
-  {
-    "pk": 60, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_pofilelock", 
-      "name": "Can change Lock", 
-      "content_type": 20
-    }
-  }, 
-  {
-    "pk": 58, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_pofile", 
-      "name": "Can delete PO file", 
-      "content_type": 19
-    }
-  }, 
-  {
-    "pk": 61, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_pofilelock", 
-      "name": "Can delete Lock", 
-      "content_type": 20
-    }
-  }, 
-  {
-    "pk": 74, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_collection", 
-      "name": "Can add collection", 
-      "content_type": 24
-    }
-  }, 
-  {
-    "pk": 77, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_collectionrelease", 
-      "name": "Can add release", 
-      "content_type": 25
-    }
-  }, 
-  {
-    "pk": 75, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_collection", 
-      "name": "Can change collection", 
-      "content_type": 24
-    }
-  }, 
-  {
-    "pk": 78, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_collectionrelease", 
-      "name": "Can change release", 
-      "content_type": 25
-    }
-  }, 
-  {
-    "pk": 76, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_collection", 
-      "name": "Can delete collection", 
-      "content_type": 24
-    }
-  }, 
-  {
-    "pk": 79, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_collectionrelease", 
-      "name": "Can delete release", 
-      "content_type": 25
-    }
-  }, 
-  {
-    "pk": 53, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "add_unit", 
-      "name": "Can add unit", 
-      "content_type": 18
-    }
-  }, 
-  {
-    "pk": 54, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "change_unit", 
-      "name": "Can change unit", 
-      "content_type": 18
-    }
-  }, 
-  {
-    "pk": 55, 
-    "model": "auth.permission", 
-    "fields": {
-      "codename": "delete_unit", 
-      "name": "Can delete unit", 
-      "content_type": 18
-    }
-  }, 
-  {
-    "pk": 1, 
-    "model": "auth.user", 
-    "fields": {
-      "username": "diegobz", 
-      "first_name": "", 
-      "last_name": "", 
-      "is_active": true, 
-      "is_superuser": true, 
-      "is_staff": true, 
-      "last_login": "2009-03-10 04:37:26", 
-      "groups": [], 
-      "user_permissions": [], 
-      "password": "sha1$014b8$e3d7f39cca57ea255dd4d9ef12aaad583a18060c", 
-      "email": "diegobz@gmail.com", 
-      "date_joined": "2009-03-10 03:57:16"
-    }
-  }, 
-  {
-    "pk": 2, 
-    "model": "auth.user", 
-    "fields": {
-      "username": "guest", 
-      "first_name": "Guest", 
-      "last_name": "", 
-      "is_active": true, 
-      "is_superuser": false, 
-      "is_staff": false, 
-      "last_login": "2009-03-10 04:38:55", 
-      "groups": [], 
-      "user_permissions": [
-        73, 
-        59, 
-        61
-      ], 
-      "password": "sha1$081e1$c248827aaa6d0d5b9348ef0baed8c0ab8409b937", 
-      "email": "guest@example.com", 
-      "date_joined": "2008-09-28 03:05:40"
-    }
-  }, 
-  {
-    "pk": 3, 
-    "model": "auth.user", 
-    "fields": {
-      "username": "editor", 
-      "first_name": "Editor", 
-      "last_name": "", 
-      "is_active": true, 
-      "is_superuser": true, 
-      "is_staff": false, 
-      "last_login": "2009-03-10 04:38:14", 
-      "groups": [], 
-      "user_permissions": [
-        68, 
-        65, 
-        69, 
-        66, 
-        71, 
-        70, 
-        67, 
-        72, 
-        73, 
-        59, 
-        61
-      ], 
-      "password": "sha1$64577$32984acfb7a036a3ac457332e61df0de73aa4e93", 
-      "email": "editor@example.com", 
-      "date_joined": "2008-09-28 03:05:40"
-    }
-  }
-]

transifex/log/__init__.py

-import logging
-from django.db.models import get_app
-from django.db.models.signals import *
-from django.conf import settings
-
-"""
-Standard logging facilities for Transifex applications.
-
-To use the common logger, use something like the following::
-
-  from transifex.log import logger
-  logger.debug("foo")
-"""
-
-DEFAULT_LOG_LEVEL = logging.INFO
-
-log_level = getattr(settings, 'LOG_LEVEL', DEFAULT_LOG_LEVEL)
-
-# Define a common logger for all Tx apps.
-_logger = logging.getLogger('tx')
-_hdlr = logging.StreamHandler()
-_formatter = logging.Formatter(
-    '[%(asctime)s %(name)s %(levelname)s] %(message)s')
-_hdlr.setFormatter(_formatter)
-_logger.addHandler(_hdlr)
-_logger.setLevel(log_level)
-
-
-def log_model(model):
-    """
-    Register standard receivers for a model with a 'name' attribute.
-
-    Called after the declaration of a model in ``models.py``. Eg.:
-    
-    >>> from transifex.log import log_model
-    >>> from django import models
-    >>> class Person(models.Model):
-    ...     pass
-    >>> log_model(Person)
-
-    """
-
-    from transifex.log.receivers import (post_save_named, post_delete_named)
-    if model:
-        #logger.debug("Registered logging for model %s" % model.__name__)
-        post_save.connect(post_save_named, sender=model)
-        post_delete.connect(post_delete_named, sender=model)
-
-# We still require logger to be a module-level variable
-logger = _logger

transifex/log/receivers.py

-
-"""
-Logging receivers for signals by models, etc.
-""" 
-
-def model_named(sender, message='', **kwargs):
-    """
-    Receive signals for objects with a .name attribute.
-    """
-    from transifex.log import logger
-    obj = kwargs['instance']
-    logger.debug("%(msg)s %(obj)s %(name)s" %
-                 {'msg': message,
-                  'obj': sender.__name__,
-                  'name': getattr(obj, 'name', '')})
-
-def pre_save_named(sender, **kwargs):
-    model_named(sender, message='About to save:', **kwargs)
-
-def post_save_named(sender, **kwargs):
-    model_named(sender, message='Saved:', **kwargs)
-
-def pre_delete_named(sender, **kwargs):
-    model_named(sender, message='About to delete:', **kwargs)
-
-def post_delete_named(sender, **kwargs):
-    model_named(sender, message='Deleted:', **kwargs)

transifex/templates/common_homelink.html

-{% load i18n %}
-<a href="{% url home %}" title="{% trans "Go to start page" %}">{% firstof text _("Home") %}</a>

transifex/templates/common_render_metacount.html

-<sup class="entry_metalink" title="{{ countable|title }}">{{ count }}</sup>

transifex/templates/form_as_table_rows.html

-{% load i18n %}
-{% load tx-common %}
-{% if form %}
-    {% for field in form %}
-    <tr>
-    <th>{{ field.label }}: {% if field.field.required %}<span class="required">*</span>{% endif %}</th>
-    <td>
-        <p class="fieldp">{{ field }}</p>
-        {% if field.errors %}<p class="fielderrors">{% for error in field.errors %}{{ error }}{% endfor %}</p>{% endif %}
-    </td>
-    <td><p class="helptext">{{ field.help_text }}</p></td>
-    </tr>
-    {% endfor %}
-{% endif %}

transifex/templatetags/__init__.py

Empty file removed.

transifex/templatetags/search_filters.py

-from django import template
-from django.conf import settings
-from django.template import Node, TemplateSyntaxError
-from django.utils.safestring import mark_safe
-from django.utils.datastructures import SortedDict
-from itertools import ifilter, takewhile
-import re
-
-register = template.Library()
-
-SETTINGS_PREFIX = 'SEARCH_'
-SETTINGS_DEFAULTS = {
-    'CONTEXT_WORDS': 10,
-    'IGNORE_CASE': True,
-    'WORD_BOUNDARY': False,
-    'HIGHLIGHT_CLASS': "highlight"
-}
-
-def get_setting(name):
-    return getattr(settings, SETTINGS_PREFIX + name, SETTINGS_DEFAULTS[name])
-
-def searchexcerpt(text, phrases, context_words=None, ignore_case=None, word_boundary=None):
-    if isinstance(phrases, basestring):
-        phrases = [phrases]
-    if context_words is None:
-        context_words = get_setting('CONTEXT_WORDS')
-    if ignore_case is None:
-        ignore_case = get_setting('IGNORE_CASE')
-    if word_boundary is None:
-        word_boundary = get_setting('WORD_BOUNDARY')
-    
-    phrases = map(re.escape, phrases)
-    flags = ignore_case and re.I or 0
-    exprs = [re.compile(r"^%s$" % p, flags) for p in phrases]
-    whitespace = re.compile(r'\s+')
-    
-    re_template = word_boundary and r"\b(%s)\b" or r"(%s)"
-    pieces = re.compile(re_template % "|".join(phrases), flags).split(text)
-    matches = {}
-    word_lists = []
-    index = {}
-    for i, piece in enumerate(pieces):
-        word_lists.append(whitespace.split(piece))
-        if i % 2:
-            index[i] = expr = ifilter(lambda e: e.match(piece), exprs).next()
-            matches.setdefault(expr, []).append(i)
-    
-    def merge(lists):
-        merged = []
-        for words in lists:
-            if merged:
-                merged[-1] += words[0]
-                del words[0]
-            merged.extend(words)
-        return merged
-    
-    i = 0
-    merged = []
-    for j in map(min, matches.itervalues()):
-        merged.append(merge(word_lists[i:j]))
-        merged.append(word_lists[j])
-        i = j + 1
-    merged.append(merge(word_lists[i:]))
-    
-    output = []
-    for i, words in enumerate(merged):
-        omit = None
-        if i == len(merged) - 1:
-            omit = slice(max(1, 2 - i) * context_words + 1, None)
-        elif i == 0:
-            omit = slice(-context_words - 1)
-        elif not i % 2:
-            omit = slice(context_words + 1, -context_words - 1)
-        if omit and words[omit]:
-            words[omit] = ["..."]
-        output.append(" ".join(words))
-    
-    return dict(original=text, excerpt="".join(output), hits=len(index))
-
-class FunctionProxyNode(Node):
-    def __init__(self, nodelist, args, variable_name=None):
-        self.nodelist = nodelist
-        self.args = args
-        self.variable_name = variable_name
-    
-    def render(self, context):
-        args = [arg.resolve(context) for arg in self.args]
-        text = self.nodelist.render(context)
-        value = self.get_value(text, *args)
-        if self.variable_name:
-            context[self.variable_name] = value
-            return ""
-        else:
-            return self.string_value(value)
-    
-    def get_value(self, *args):
-        raise NotImplementedError
-    
-    def string_value(self, value):
-        return value
-
-class SearchContextNode(FunctionProxyNode):
-    def get_value(self, *args):
-        return searchexcerpt(*args)
-    
-    def string_value(self, value):
-        return value['excerpt']
-
-@register.tag(name='searchexcerpt')
-def searchexcerpt_tag(parser, token):
-    """
-        {% searchexcerpt search_terms [context_words] [ignore_case] [word_boundary] [as name] %}
-        ...text...
-        {% endsearchexcerpt %}
-    """
-    bits = list(token.split_contents())
-    if not 3 <= len(bits) <= 8:
-        usage = searchexcerpt_tag.__doc__.strip()
-        raise TemplateSyntaxError("%r expected usage: %s" % (bits[0], usage))
-    
-    if len(bits) > 4 and bits[-2] == "as":
-        args, name = bits[1:-2], bits[-1]
-    else:
-        args, name = bits[1:], None
-    
-    nodelist = parser.parse(('endsearchexcerpt',))
-    parser.delete_first_token()
-    return SearchContextNode(nodelist, map(parser.compile_filter, args), name)
-
-@register.filter(name='searchexcerpt')
-def searchexcerpt_filter(value, arg):
-    return searchexcerpt(value, arg)['excerpt']
-searchexcerpt_filter.is_safe = True
-
-def highlight(text, phrases, ignore_case=None, word_boundary=None, class_name=None):
-    if isinstance(phrases, basestring):
-        phrases = [phrases]
-    if ignore_case is None:
-        ignore_case = get_setting('IGNORE_CASE')
-    if word_boundary is None:
-        word_boundary = get_setting('WORD_BOUNDARY')
-    if class_name is None:
-        class_name = get_setting('HIGHLIGHT_CLASS')
-        
-    phrases = map(re.escape, phrases)
-    flags = ignore_case and re.I or 0
-    re_template = word_boundary and r"\b(%s)\b" or r"(%s)"
-    expr = re.compile(re_template % "|".join(phrases), flags)
-    template = '<span class="%s">%%s</span>' % class_name
-    matches = []
-    
-    def replace(match):
-        matches.append(match)
-        return template % match.group(0)
-    
-    highlighted = mark_safe(expr.sub(replace, text))
-    count = len(matches)
-    return dict(original=text, highlighted=highlighted, hits=count)
-
-class HighlightNode(FunctionProxyNode):
-    def get_value(self, *args):
-        return highlight(*args)
-    
-    def string_value(self, value):
-        return value['highlighted']
-
-@register.tag(name='highlight')
-def highlight_tag(parser, token):
-    """
-        {% highlight search_terms [ignore_case] [word_boundary] [class_name] [as name] %}
-        ...text...
-        {% endhighlight %}
-    """
-    bits = list(token.split_contents())
-    if not 2 <= len(bits) <= 7:
-        usage = highlight_tag.__doc__.strip()
-        raise TemplateSyntaxError("%r expected usage: %s" % (bits[0], usage))
-    
-    if len(bits) > 3 and bits[-2] == "as":
-        args, name = bits[1:-2], bits[-1]
-    else:
-        args, name = bits[1:], None
-    
-    nodelist = parser.parse(('endhighlight',))
-    parser.delete_first_token()
-    return HighlightNode(nodelist, map(parser.compile_filter, args), name)
-
-@register.filter(name='highlight')
-def highlight_filter(value, arg):
-    return highlight(value, arg)['highlighted']
-
-def hits(text, phrases, ignore_case=None, word_boundary=None):
-    if isinstance(phrases, basestring):
-        phrases = [phrases]
-    if ignore_case is None:
-        ignore_case = get_setting('IGNORE_CASE')
-    if word_boundary is None:
-        word_boundary = get_setting('WORD_BOUNDARY')    
-
-    phrases = map(re.escape, phrases)
-    flags = ignore_case and re.I or 0
-    re_template = word_boundary and r"\b(%s)\b" or r"(%s)"
-    expr = re.compile(re_template % "|".join(phrases), flags)
-    return len(expr.findall(text))
-
-class HitsNode(FunctionProxyNode):
-    def get_value(self, *args):
-        return hits(*args)
-    
-    def string_value(self, value):
-        return "%d" % value
-
-@register.tag(name='hits')
-def hits_tag(parser, token):
-    """
-        {% hits search_terms [ignore_case] [word_boundary] [as name] %}
-        ...text...
-        {% endhits %}
-    """
-    bits = list(token.split_contents())
-    if not 2 <= len(bits) <= 6:
-        usage = hits_tag.__doc__.strip()
-        raise TemplateSyntaxError("%r expected usage: %s" % (bits[0], usage))
-    
-    if len(bits) > 3 and bits[-2] == "as":
-        args, name = bits[1:-2], bits[-1]
-    else:
-        args, name = bits[1:], None
-    
-    nodelist = parser.parse(('endhits',))
-    parser.delete_first_token()
-    return HitsNode(nodelist, map(parser.compile_filter, args), name)
-
-@register.filter(name='hits')
-def hits_filter(value, arg):
-    return hits(value, arg)
-hits.is_safe = True

transifex/templatetags/tx-common.py

-import re
-from django import template
-from django.template.defaultfilters import stringfilter
-from django.utils.safestring import mark_safe
-from django.utils.html import conditional_escape
-
-import transifex
-
-register = template.Library()
-
-@register.inclusion_tag("common_render_metacount.html")
-def render_metacount(list, countable):
-    """
-    Return meta-style link rendered as superscript to count something.
-    
-    For example, with list=['a', 'b'] and countable='boxes' return
-    the HTML for "2 boxes".
-    """
-    count = len(list)
-    if count > 1:
-        return {'count': count,
-                'countable': countable}
-
-@register.inclusion_tag("common_homelink.html")
-def homelink(text="Home"):
-    """Return a link to the homepage."""
-    return {'text': text}
-
-@register.simple_tag
-def txversion():
-    """Return the version of Transifex"""
-    return transifex.version
-
-# Forms
-
-@register.inclusion_tag("form_as_table_rows.html")
-def form_as_table_rows(form):
-    """
-    Create a form using HTML table rows.
-    """
-    return {"form": form}
-
-
-# Email Munger by cootetom
-# http://www.djangosnippets.org/snippets/1284/
-
-@register.filter
-@stringfilter
-def mungify(email, text=None, autoescape=None):
-    text = text or email
-    
-    if autoescape:
-        email = conditional_escape(email)
-        text = conditional_escape(text)
-
-    emailArrayContent = ''
-    textArrayContent = ''
-    r = lambda c: '"' + str(ord(c)) + '",'
-
-    for c in email: emailArrayContent += r(c)
-    for c in text: textArrayContent += r(c)
-
-    result = """<script>
-                var _tyjsdf = [%s], _qplmks = [%s];
-                document.write('<a href="&#x6d;&#97;&#105;&#x6c;&#000116;&#111;&#x3a;');
-                for(_i=0;_i<_tyjsdf.length;_i++){document.write('&#'+_tyjsdf[_i]+';');}
-                document.write('">');
-                for(_i=0;_i<_qplmks.length;_i++){document.write('&#'+_qplmks[_i]+';');}
-                document.write('</a>');
-                </script>""" % (re.sub(r',$', '', emailArrayContent),
-                                re.sub(r',$', '', textArrayContent))
-    
-    return mark_safe(result)
-
-mungify.needs_autoescape = True

transifex/views.py

-from django.db.models import Q
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-from projects.models import Project
-from transifex.log import logger
-from django.contrib.auth.forms import AuthenticationForm
-
-def search(request):
-    query_string = request.GET.get('q', "")
-    search_terms = query_string.split()
-    results = Project.objects.filter()
-
-    if search_terms:
-        query = Q()
-        for term in search_terms:
-            query &= Q(name__icontains=term) | Q(description__icontains=term) | Q(long_description__icontains=term)
-        results = results.filter(query).distinct()
-    else:
-        results = []
-    logger.debug("Searched for %s. Found %s results." % (query_string, len(results)))
-    return render_to_response("search.html",
-        {'query': query_string, 
-         'terms': search_terms, 
-         'results': results}, 
-          context_instance = RequestContext(request))
-
-def index(request):
-    latest_projects = Project.objects.order_by('-created')[:5]
-    return render_to_response("index.html",
-        {'latest_projects': latest_projects,
-         'form': AuthenticationForm(),
-         'next': request.path},
-          context_instance = RequestContext(request))

txcollections/models.py

 from tagging.fields import TagField
 
 from releases.models import Release as ReleasesRelease
-from transifex.log import log_model
+from txcommon.log import log_model
 
 class CollectionManager(models.Manager):
     pass

txcommon/__init__.py

+version_info = (0, 5, 0, 'alpha', 0)
+
+_verpart = ''
+if version_info[3] != 'final':
+    _verpart = version_info[3]
+
+version = '.'.join(str(v) for v in version_info[:3]) + _verpart
+
+del _verpart

txcommon/decorators.py

+# -*- coding: utf-8 -*-
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
+def user_passes_test_with_403(test_func, login_url=None):
+    """
+    Decorator for views that checks that the user passes the given test.
+    
+    Users that fail the test will be given a 403 error.
+    """
+    def _dec(view_func):
+        def _checklogin(request, *args, **kwargs):
+            if test_func(request.user):
+                return view_func(request, *args, **kwargs)
+            else:
+                resp = render_to_response('403.html', context_instance=RequestContext(request))
+                resp.status_code = 403
+                return resp
+        _checklogin.__doc__ = view_func.__doc__
+        _checklogin.__dict__ = view_func.__dict__
+        return _checklogin
+    return _dec
+
+def perm_required_with_403(perm):
+    """
+    Decorator for views that checks whether a user has a particular permissions
+    enabled, rendering a 403 page as necessary.
+
+    """
+    return user_passes_test_with_403(lambda u: u.has_perm(perm))

txcommon/fixtures/sample_data.json

+[
+  {
+    "pk": 9, 
+    "model": "projects.project", 
+    "fields": {
+      "feed": "", 
+      "description": "Avant Window Navigator (Awn) is a dock-like bar which sits at the bottom of the screen. (bzr)", 
+      "created": "2008-10-09 00:00:00", 
+      "long_description_html": "", 
+      "tags": "", 
+      "enabled": true, 
+      "modified": "2009-03-09 20:17:18", 
+      "slug": "awn", 
+      "maintainers": [], 
+      "collections": [
+        2
+      ], 
+      "hidden": false, 
+      "homepage": "http://launchpad.net/awn", 
+      "long_description": "", 
+      "name": "Avant Window Navigator"
+    }
+  }, 
+  {
+    "pk": 10, 
+    "model": "projects.project", 
+    "fields": {
+      "feed": "", 
+      "description": "Yet another testing module! (cvs)", 
+      "created": "2008-10-16 00:00:00", 
+      "long_description_html": "", 
+      "tags": "", 
+      "enabled": true, 
+      "modified": "2009-03-09 20:16:57", 
+      "slug": "switchdesk", 
+      "maintainers": [], 
+      "collections": [
+        2
+      ], 
+      "hidden": false, 
+      "homepage": "", 
+      "long_description": "", 
+      "name": "Switchdesk"
+    }
+  }, 
+  {
+    "pk": 19, 
+    "model": "projects.project", 
+    "fields": {
+      "feed": "", 
+      "description": "Tools for certain user account management tasks (hg)", 
+      "created": "2009-02-13 18:46:14", 
+      "long_description_html": "", 
+      "tags": "", 
+      "enabled": true, 
+      "modified": "2009-03-09 20:16:32", 
+      "slug": "usermode", 
+      "maintainers": [
+        2
+      ], 
+      "collections": [
+        1
+      ], 
+      "hidden": false, 
+      "homepage": "", 
+      "long_description": "", 
+      "name": "Usermode"
+    }
+  }, 
+  {
+    "pk": 20, 
+    "model": "projects.project", 
+    "fields": {
+      "feed": "", 
+      "description": "Desktop Effects (git)", 
+      "created": "2009-03-09 20:14:18", 
+      "long_description_html": "", 
+      "tags": "gui,graphics", 
+      "enabled": true, 
+      "modified": "2009-03-09 20:16:16", 
+      "slug": "desktop-effects", 
+      "maintainers": [], 
+      "collections": [
+        1
+      ], 
+      "hidden": false, 
+      "homepage": "", 
+      "long_description": "", 
+      "name": "desktop-effects"
+    }
+  }, 
+  {
+    "pk": 8, 
+    "model": "projects.project", 
+    "fields": {
+      "feed": "", 
+      "description": "Desktop Input Method configuration tool (svn)", 
+      "created": "2008-10-08 00:00:00", 
+      "long_description_html": "<p>Desktop Input Method configuration tool\n</p>", 
+      "tags": "", 
+      "enabled": true, 
+      "modified": "2009-03-09 20:15:53", 
+      "slug": "im-chooser", 
+      "maintainers": [], 
+      "collections": [], 
+      "hidden": false, 
+      "homepage": "https://fedorahosted.org/im-chooser", 
+      "long_description": "Desktop Input Method configuration tool", 
+      "name": "im-chooser"
+    }
+  }, 
+  {
+    "pk": 5, 
+    "model": "projects.component", 
+    "fields": {
+      "slug": "02", 
+      "description": "This is the branch that blah blah.", 
+      "releases": [], 
+      "created": "2008-10-09 00:00:00", 
+      "enabled": true, 
+      "i18n_type": "INTLTOOL",