Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
142 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from thing.models import Project | ||
|
||
class ProjectSympaTool(models.Model): | ||
project = models.ForeignKey(Project, verbose_name=_("project"), unique=True) | ||
|
||
list_path = models.CharField(_('sympa list path'), max_length=80) | ||
list_name = models.CharField(_('sympa list name'), max_length=200) | ||
|
||
from django.contrib import admin | ||
admin.site.register(ProjectSympaTool) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
This file demonstrates writing tests using the unittest module. These will pass | ||
when you run "manage.py test". | ||
Replace this with more appropriate tests for your application. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
|
||
class SimpleTest(TestCase): | ||
def test_basic_addition(self): | ||
""" | ||
Tests that 1 + 1 always equals 2. | ||
""" | ||
self.assertEqual(1 + 1, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from django.conf import settings | ||
|
||
from thing_sympa.models import ProjectSympaTool | ||
|
||
class ToolProvider(object): | ||
|
||
_SYMPA_BASE_URL = settings.THING_SYMPA_BASE_URL | ||
_SYMPA_TOOL_PATH = 'lists' | ||
_DELIVERANCE_RULES = """ | ||
<ruleset> | ||
<rule class="default"> | ||
<drop content="div#Menus .MenuBlock:first-child" /> | ||
<drop content="div#Menus" /> | ||
<replace theme="children://div[@id='oc-content-container']" | ||
content="div#Menus" collapse-sources="1" /> | ||
<append theme="children://div[@id='oc-content-container']" | ||
content="//div[@id='Stretcher']" | ||
collapse-sources="1" | ||
/> | ||
</rule> | ||
</ruleset> | ||
""" | ||
|
||
def __init__(self, project): | ||
self._project = project | ||
try: | ||
self._tool = ProjectSympaTool.objects.get(project=project) | ||
except ProjectSympaTool.DoesNotExist: | ||
self._tool = None | ||
|
||
def nav_entries(self): | ||
if self._tool is None: | ||
return None | ||
return [(self._project.homepage_url() | ||
+ self._SYMPA_TOOL_PATH | ||
+ '/arc/%s' % self._tool.list_path, | ||
self._tool.list_name)] | ||
|
||
def nav_management_entries(self): | ||
return None | ||
|
||
def match_request(self, path_info): | ||
if self._tool is None: | ||
return None | ||
path_info = path_info.lstrip("/").split("/") | ||
if path_info[0] == self._SYMPA_TOOL_PATH: | ||
return '/'.join(path_info[1:]) | ||
|
||
def bind_request(self, path_info): | ||
self.script_name = self._project.homepage_url().rstrip("/") + "/%s/" % ( | ||
self._SYMPA_TOOL_PATH) | ||
self.path_info = path_info | ||
self.url = self._SYMPA_BASE_URL | ||
self.deliverance_rules = self._DELIVERANCE_RULES | ||
return self | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your views here. |