Commit d770229e4b5b624ad771a654e3b3ba028d291592

Authored by Gust
Committed by Luciano Prestes
1 parent dce5b60f

Remove Trac

colab/plugins/trac/__init__.py
... ... @@ -1,3 +0,0 @@
1   -
2   -
3   -default_app_config = 'colab.plugins.trac.apps.ProxyTracAppConfig'
colab/plugins/trac/admin.py
... ... @@ -1 +0,0 @@
1   -# from . import signals
colab/plugins/trac/apps.py
... ... @@ -1,24 +0,0 @@
1   -
2   -from django.utils.translation import ugettext_lazy as _
3   -
4   -from ..utils.apps import ColabProxiedAppConfig
5   -
6   -
7   -class ProxyTracAppConfig(ColabProxiedAppConfig):
8   - name = 'colab.plugins.trac'
9   - verbose_name = 'Trac Proxy'
10   -
11   - menu = {
12   - 'title': _('Code'),
13   - 'links': (
14   - (_('Timeline'), 'timeline'),
15   - (_('Wiki'), 'wiki'),
16   - (_('View Tickets'), 'report'),
17   - (_('Roadmap'), 'roadmap'),
18   - (_('Browse Source'), 'browser'),
19   - ),
20   - 'auth_links': (
21   - (_('New Ticket'), 'newticket'),
22   - (_('New Wiki Page'), 'wiki/WikiNewPage'),
23   - ),
24   - }
colab/plugins/trac/data_api.py
... ... @@ -1,7 +0,0 @@
1   -from colab.plugins.utils.proxy_data_api import ProxyDataAPI
2   -
3   -
4   -class TracDataAPI(ProxyDataAPI):
5   -
6   - def fetch_data(self):
7   - pass
colab/plugins/trac/diazo.xml
... ... @@ -1,45 +0,0 @@
1   -<rules
2   - xmlns="http://namespaces.plone.org/diazo"
3   - xmlns:css="http://namespaces.plone.org/diazo/css"
4   - xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5   -
6   - <replace css:theme="#trac-css" content="//head/link" />
7   - <replace css:theme="#trac-js" content="//head/script" />
8   - <replace theme="//head/title" content="//head/title" />
9   -
10   - <before css:theme-children="#main-content" css:content="#main" />
11   -
12   - <after theme-children="/html/head">
13   - <style>
14   - .navbar .nav ul { font-size: 14px; text-align: left; padding: 5px 0; }
15   - .navbar .nav li { border: 0; padding: 0; white-space: normal; display: list-item;}
16   - :link:not(.btn),
17   - :visited:not(.btn) { border: 0; color: rgb(66, 139, 202); }
18   - h1 { font-size: 24px; margin: 0.15em 1em 0.5em 0px; }
19   - h2 { font-size: 20px }
20   - h3 { font-size: 16px }
21   - h4 { font-size: 14px }
22   - input[type="checkbox"], input[type="radio"] { margin: 0 4px; }
23   - fieldset { padding: 1em; margin: 1em 0; border: 1px solid rgb(215, 215, 215); }
24   - label { font-weight: 400; }
25   - legend { margin-bottom: 0; width: auto; }
26   - input, textarea, select { margin: 2px; }
27   -
28   - .wikitoolbar,
29   - .wikitoolbar:before,
30   - .wikitoolbar:after {
31   - -moz-box-sizing: content-box;
32   - -webkit-box-sizing: content-box;
33   - }
34   - .wikitoolbar :link,
35   - .wikitoolbar :visited {
36   - border-width: 1px;
37   - border-style: solid;
38   - border-color: #fff #fff #fff #ccc;
39   - -moz-box-sizing: content-box;
40   - -webkit-box-sizing: content-box;
41   - }
42   - </style>
43   - </after>
44   -
45   -</rules>
colab/plugins/trac/migrations/0001_initial.py
... ... @@ -1,141 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -from __future__ import unicode_literals
3   -
4   -from django.db import models, migrations, connections
5   -
6   -
7   -def create_views(apps, schema_editor):
8   - connection = connections['trac']
9   -
10   - cursor = connection.cursor()
11   -
12   - # revision_view
13   - cursor.execute('''
14   - CREATE OR REPLACE VIEW revision_view AS SELECT
15   - revision.rev,
16   - revision.author,
17   - revision.message,
18   - repository.value AS repository_name,
19   - TIMESTAMP WITH TIME ZONE 'epoch' + (revision.time/1000000) * INTERVAL '1s' AS created,
20   - CONCAT(revision.repos, '-', revision.rev) AS key
21   - FROM revision
22   - INNER JOIN repository ON(
23   - repository.id = revision.repos
24   - AND repository.name = 'name'
25   - AND repository.value != ''
26   - );
27   - ''')
28   -
29   - # attachment_view
30   - cursor.execute('''
31   - CREATE OR REPLACE VIEW attachment_view AS SELECT
32   - CONCAT(attachment.type, '/' , attachment.id, '/', attachment.filename) AS url,
33   - attachment.type AS used_by,
34   - attachment.filename AS filename,
35   - attachment.id as attach_id,
36   - (SELECT LOWER(SUBSTRING(attachment.filename FROM '\.(\w+)$'))) AS mimetype,
37   - attachment.author AS author,
38   - attachment.description AS description,
39   - attachment.size AS size,
40   - TIMESTAMP WITH TIME ZONE 'epoch' + (attachment.time/1000000)* INTERVAL '1s' AS created
41   - FROM attachment;
42   - ''')
43   -
44   - # wiki_view
45   - cursor.execute('''
46   - CREATE OR REPLACE VIEW wiki_view AS SELECT
47   - wiki.name AS name,
48   - (SELECT wiki2.text FROM wiki AS wiki2 WHERE wiki2.name = wiki.name
49   - AND wiki2.version = MAX(wiki.version)) AS wiki_text,
50   - (SELECT wiki3.author FROM wiki AS wiki3 WHERE wiki3.name = wiki.name
51   - AND wiki3.version = 1) AS author,
52   - string_agg(DISTINCT wiki.author, ', ') AS collaborators,
53   - TIMESTAMP WITH TIME ZONE 'epoch' + (MIN(wiki.time)/1000000) * INTERVAL '1s' AS created,
54   - TIMESTAMP WITH TIME ZONE 'epoch' + (MAX(wiki.time)/1000000) * INTERVAL '1s' AS modified,
55   - (SELECT wiki4.author FROM wiki AS wiki4 WHERE wiki4.name = wiki.name
56   - AND wiki4.version = MAX(wiki.version)) AS modified_by
57   - FROM wiki
58   - GROUP BY wiki.name;
59   - ''')
60   -
61   - # ticket_view
62   - cursor.execute('''
63   - CREATE OR REPLACE VIEW ticket_view AS SELECT
64   - ticket.id AS id,
65   - ticket.summary as summary,
66   - ticket.description as description,
67   - ticket.milestone as milestone,
68   - ticket.priority as priority,
69   - ticket.component as component,
70   - ticket.version as version,
71   - ticket.severity as severity,
72   - ticket.reporter as reporter,
73   - ticket.reporter as author,
74   - ticket.status as status,
75   - ticket.keywords as keywords,
76   - (SELECT
77   - string_agg(DISTINCT ticket_change.author, ', ')
78   - FROM ticket_change WHERE ticket_change.ticket = ticket.id
79   - GROUP BY ticket_change.ticket) as collaborators,
80   - TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000)* INTERVAL '1s' AS created,
81   - TIMESTAMP WITH TIME ZONE 'epoch' + (changetime/1000000) * INTERVAL '1s' AS modified,
82   - (SELECT
83   - ticket_change.author
84   - FROM ticket_change
85   - WHERE ticket_change.ticket = ticket.id
86   - AND ticket_change.time = ticket.changetime
87   - LIMIT 1
88   - ) AS modified_by
89   - FROM ticket;
90   - ''')
91   -
92   - # ticket_collab_count_view
93   - cursor.execute('''
94   - CREATE OR REPLACE VIEW ticket_collab_count_view AS
95   - SELECT
96   - COALESCE (t1.author, t2.author) as author,
97   - (COALESCE(t1.count, 0) + COALESCE(t2.count, 0)) as count
98   - FROM
99   - (SELECT author, count(*) as count
100   - FROM ticket_change
101   - GROUP BY author
102   - ORDER BY author
103   - ) AS t1
104   - FULL OUTER JOIN
105   - (SELECT reporter as author, count(*) as count
106   - FROM ticket
107   - GROUP BY reporter
108   - ORDER BY reporter
109   - ) AS t2
110   - ON t1.author = t2.author;
111   - ''')
112   -
113   - # wiki_collab_count_view
114   - cursor.execute('''
115   - CREATE OR REPLACE VIEW wiki_collab_count_view AS
116   - SELECT author, count(*) from wiki GROUP BY author;
117   - ''')
118   -
119   -
120   -def drop_views(apps, schema_editor):
121   - connection = connections['trac']
122   -
123   - cursor = connection.cursor()
124   - cursor.execute('''
125   - DROP VIEW IF EXISTS revision_view;
126   - DROP VIEW IF EXISTS ticket_view;
127   - DROP VIEW IF EXISTS wiki_view;
128   - DROP VIEW IF EXISTS ticket_collab_count_view;
129   - DROP VIEW IF EXISTS wiki_collab_count_view;
130   - DROP VIEW IF EXISTS attachment_view;
131   - ''')
132   -
133   -
134   -class Migration(migrations.Migration):
135   -
136   - dependencies = [
137   - ]
138   -
139   - operations = [
140   - migrations.RunPython(code=create_views, reverse_code=drop_views)
141   - ]
colab/plugins/trac/migrations/__init__.py
colab/plugins/trac/models.py
... ... @@ -1,133 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -import os
3   -import urllib2
4   -
5   -from django.db import models
6   -from django.conf import settings
7   -
8   -from hitcounter.models import HitCounterModelMixin
9   -
10   -from colab.accounts.models import User
11   -
12   -
13   -class Attachment(models.Model, HitCounterModelMixin):
14   - url = models.TextField(primary_key=True)
15   - attach_id = models.TextField()
16   - used_by = models.TextField()
17   - filename = models.TextField()
18   - author = models.TextField(blank=True)
19   - description = models.TextField(blank=True)
20   - created = models.DateTimeField(blank=True)
21   - mimetype = models.TextField(blank=True)
22   - size = models.IntegerField(blank=True)
23   -
24   - class Meta:
25   - managed = False
26   - db_table = 'attachment_view'
27   -
28   - @property
29   - def filepath(self):
30   - return os.path.join(
31   - settings.ATTACHMENTS_FOLDER_PATH,
32   - self.used_by,
33   - self.attach_id,
34   - urllib2.quote(self.filename.encode('utf8'))
35   - )
36   -
37   - def get_absolute_url(self):
38   - return u'/raw-attachment/{}'.format(self.url)
39   -
40   - def get_author(self):
41   - try:
42   - return User.objects.get(username=self.author)
43   - except User.DoesNotExist:
44   - return None
45   -
46   -
47   -class Revision(models.Model, HitCounterModelMixin):
48   - key = models.TextField(blank=True, primary_key=True)
49   - rev = models.TextField(blank=True)
50   - author = models.TextField(blank=True)
51   - message = models.TextField(blank=True)
52   - repository_name = models.TextField(blank=True)
53   - created = models.DateTimeField(blank=True, null=True)
54   -
55   - class Meta:
56   - managed = False
57   - db_table = 'revision_view'
58   -
59   - def get_absolute_url(self):
60   - return u'/changeset/{}/{}'.format(self.rev, self.repository_name)
61   -
62   - def get_author(self):
63   - try:
64   - return User.objects.get(username=self.author)
65   - except User.DoesNotExist:
66   - return None
67   -
68   -
69   -class Ticket(models.Model, HitCounterModelMixin):
70   - id = models.IntegerField(primary_key=True)
71   - summary = models.TextField(blank=True)
72   - description = models.TextField(blank=True)
73   - milestone = models.TextField(blank=True)
74   - priority = models.TextField(blank=True)
75   - component = models.TextField(blank=True)
76   - version = models.TextField(blank=True)
77   - severity = models.TextField(blank=True)
78   - reporter = models.TextField(blank=True)
79   - author = models.TextField(blank=True)
80   - status = models.TextField(blank=True)
81   - keywords = models.TextField(blank=True)
82   - collaborators = models.TextField(blank=True)
83   - created = models.DateTimeField(blank=True, null=True)
84   - modified = models.DateTimeField(blank=True, null=True)
85   - modified_by = models.TextField(blank=True)
86   -
87   - class Meta:
88   - managed = False
89   - db_table = 'ticket_view'
90   -
91   - def get_absolute_url(self):
92   - return u'/ticket/{}'.format(self.id)
93   -
94   - def get_author(self):
95   - try:
96   - return User.objects.get(username=self.author)
97   - except User.DoesNotExist:
98   - return None
99   -
100   - def get_modified_by(self):
101   - try:
102   - return User.objects.get(username=self.modified_by)
103   - except User.DoesNotExist:
104   - return None
105   -
106   -
107   -class Wiki(models.Model, HitCounterModelMixin):
108   - name = models.TextField(primary_key=True)
109   - wiki_text = models.TextField(blank=True)
110   - author = models.TextField(blank=True)
111   - collaborators = models.TextField(blank=True)
112   - created = models.DateTimeField(blank=True, null=True)
113   - modified = models.DateTimeField(blank=True, null=True)
114   - modified_by = models.TextField(blank=True)
115   -
116   - class Meta:
117   - managed = False
118   - db_table = 'wiki_view'
119   -
120   - def get_absolute_url(self):
121   - return u'/wiki/{}'.format(self.name)
122   -
123   - def get_author(self):
124   - try:
125   - return User.objects.get(username=self.author)
126   - except User.DoesNotExist:
127   - return None
128   -
129   - def get_modified_by(self):
130   - try:
131   - return User.objects.get(username=self.modified_by)
132   - except User.DoesNotExist:
133   - return None
colab/plugins/trac/routers.py
... ... @@ -1,23 +0,0 @@
1   -class TracRouter(object):
2   - def db_for_read(self, model, **hints):
3   - if model._meta.app_label == 'proxy':
4   - return 'trac'
5   - return None
6   -
7   - def db_for_write(self, model, **hints):
8   - if model._meta.app_label == 'proxy':
9   - return 'trac'
10   - return None
11   -
12   - def allow_relation(self, obj1, obj2, **hints):
13   - if obj1._meta.app_label == 'proxy' or \
14   - obj2._meta.app_label == 'proxy':
15   - return True
16   - return None
17   -
18   - def allow_migrate(self, db, model):
19   - if db == 'trac':
20   - return model._meta.app_label == 'proxy'
21   - elif model._meta.app_label == 'proxy':
22   - False
23   - return None
colab/plugins/trac/search_indexes.py
... ... @@ -1,155 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -
3   -import string
4   -
5   -from django.template import loader, Context
6   -from haystack import indexes
7   -from haystack.utils import log as logging
8   -
9   -from colab.search.base_indexes import BaseIndex
10   -from .models import Attachment, Ticket, Wiki, Revision
11   -
12   -
13   -logger = logging.getLogger('haystack')
14   -
15   -# the string maketrans always return a string encoded with latin1
16   -# http://stackoverflow.com/questions/1324067/how-do-i-get-str-translate-to-work-with-unicode-strings # noqa
17   -table = string.maketrans(
18   - string.punctuation,
19   - '.' * len(string.punctuation)
20   -).decode('latin1')
21   -
22   -
23   -class AttachmentIndex(BaseIndex, indexes.Indexable):
24   - title = indexes.CharField(model_attr='filename')
25   - description = indexes.CharField(model_attr='description', null=True)
26   - modified = indexes.DateTimeField(model_attr='created', null=True)
27   - used_by = indexes.CharField(model_attr='used_by', null=True, stored=False)
28   - mimetype = indexes.CharField(
29   - model_attr='mimetype',
30   - null=True,
31   - stored=False
32   - )
33   - size = indexes.IntegerField(model_attr='size', null=True, stored=False)
34   - filename = indexes.CharField(stored=False)
35   -
36   - def get_model(self):
37   - return Attachment
38   -
39   - def get_updated_field(self):
40   - return 'created'
41   -
42   - def prepare(self, obj):
43   - data = super(AttachmentIndex, self).prepare(obj)
44   -
45   - try:
46   - file_obj = open(obj.filepath)
47   - except IOError as e:
48   - logger.warning(u'IOError: %s - %s', e.strerror, e.filename)
49   - return data
50   - backend = self._get_backend(None)
51   -
52   - extracted_data = backend.extract_file_contents(file_obj)
53   - file_obj.close()
54   -
55   - if not extracted_data:
56   - return data
57   -
58   - t = loader.select_template(
59   - ('search/indexes/proxy/attachment_text.txt', )
60   - )
61   - data['text'] = t.render(Context({
62   - 'object': obj,
63   - 'extracted': extracted_data,
64   - }))
65   - return data
66   -
67   - def prepare_filename(self, obj):
68   - return obj.filename.translate(table).replace('.', ' ')
69   -
70   - def prepare_icon_name(self, obj):
71   - return u'file'
72   -
73   - def prepare_type(self, obj):
74   - return u'attachment'
75   -
76   -
77   -class WikiIndex(BaseIndex, indexes.Indexable):
78   - title = indexes.CharField(model_attr='name')
79   - collaborators = indexes.CharField(
80   - model_attr='collaborators',
81   - null=True,
82   - stored=False,
83   - )
84   -
85   - def get_model(self):
86   - return Wiki
87   -
88   - def prepare_description(self, obj):
89   - return u'{}\n{}'.format(obj.wiki_text, obj.collaborators)
90   -
91   - def prepare_icon_name(self, obj):
92   - return u'book'
93   -
94   - def prepare_type(self, obj):
95   - return u'wiki'
96   -
97   -
98   -class TicketIndex(BaseIndex, indexes.Indexable):
99   - tag = indexes.CharField(model_attr='status', null=True)
100   - milestone = indexes.CharField(model_attr='milestone', null=True)
101   - component = indexes.CharField(model_attr='component', null=True)
102   - severity = indexes.CharField(model_attr='severity', null=True)
103   - reporter = indexes.CharField(model_attr='reporter', null=True)
104   - keywords = indexes.CharField(model_attr='keywords', null=True)
105   - collaborators = indexes.CharField(
106   - model_attr='collaborators',
107   - null=True,
108   - stored=False,
109   - )
110   -
111   - def get_model(self):
112   - return Ticket
113   -
114   - def prepare_description(self, obj):
115   - return u'{}\n{}\n{}\n{}\n{}\n{}\n{}'.format(
116   - obj.description, obj.milestone, obj.component, obj.severity,
117   - obj.reporter, obj.keywords, obj.collaborators
118   - )
119   -
120   - def prepare_icon_name(self, obj):
121   - return u'tag'
122   -
123   - def prepare_title(self, obj):
124   - return u'#{} - {}'.format(obj.pk, obj.summary)
125   -
126   - def prepare_type(self, obj):
127   - return 'ticket'
128   -
129   -
130   -class RevisionIndex(BaseIndex, indexes.Indexable):
131   - description = indexes.CharField(model_attr='message', null=True)
132   - modified = indexes.DateTimeField(model_attr='created', null=True)
133   - repository_name = indexes.CharField(
134   - model_attr='repository_name',
135   - stored=False
136   - )
137   -
138   - def get_model(self):
139   - return Revision
140   -
141   - def get_updated_field(self):
142   - return 'created'
143   -
144   - def get_boost(self, obj):
145   - boost = super(RevisionIndex, self).get_boost(obj)
146   - return boost * 0.8
147   -
148   - def prepare_icon_name(self, obj):
149   - return u'align-right'
150   -
151   - def prepare_title(self, obj):
152   - return u'{} [{}]'.format(obj.repository_name, obj.rev)
153   -
154   - def prepare_type(self, obj):
155   - return 'changeset'
colab/plugins/trac/signals.py
... ... @@ -1,33 +0,0 @@
1   -
2   -from django.db import connections
3   -from django.dispatch import receiver
4   -from django.db.models.signals import post_save
5   -
6   -from colab.accounts.models import User
7   -
8   -
9   -@receiver(post_save, sender=User)
10   -def change_session_attribute_email(sender, instance, **kwargs):
11   - cursor = connections['trac'].cursor()
12   -
13   - cursor.execute(("UPDATE session_attribute SET value=%s "
14   - "WHERE name='email' AND sid=%s"),
15   - [instance.email, instance.username])
16   - cursor.execute(("UPDATE session_attribute SET value=%s "
17   - "WHERE name='name' AND sid=%s"),
18   - [instance.get_full_name(), instance.username])
19   -
20   - cursor.execute(("INSERT INTO session_attribute "
21   - "(sid, authenticated, name, value) "
22   - "SELECT %s, '1', 'email', %s WHERE NOT EXISTS "
23   - "(SELECT 1 FROM session_attribute WHERE sid=%s "
24   - "AND name='email')"),
25   - [instance.username, instance.email, instance.username])
26   -
27   - cursor.execute(("INSERT INTO session_attribute "
28   - "(sid, authenticated, name, value) "
29   - "SELECT %s, '1', 'name', %s WHERE NOT EXISTS "
30   - "(SELECT 1 FROM session_attribute WHERE sid=%s "
31   - "AND name='name')"),
32   - [instance.username, instance.get_full_name(),
33   - instance.username])
colab/plugins/trac/templates/proxy/trac.html
... ... @@ -1,7 +0,0 @@
1   -{% extends "base.html" %}
2   -
3   -{% block head %}
4   - <placeholder id="trac-css"/>
5   - <placeholder id="trac-js"/>
6   - {{ block.super }}
7   -{% endblock %}
colab/plugins/trac/templates/search/indexes/proxy/attachment_text.txt
... ... @@ -1,15 +0,0 @@
1   -{{ object.filename }}
2   -{{ object.filename|slugify }}
3   -{{ object.description }}
4   -{{ object.description|slugify }}
5   -{{ object.used_by }}
6   -{{ object.mimetype }}
7   -{{ object.get_author.get_full_name }}
8   -
9   -{% for k, v in extracted.metadata.items %}
10   - {% for val in v %}
11   - {{ k }}: {{ val|safe }}
12   - {% endfor %}
13   -{% endfor %}
14   -
15   -{{ extracted.contents|striptags|safe }}
colab/plugins/trac/templates/search/indexes/proxy/revision_text.txt
... ... @@ -1,8 +0,0 @@
1   -{{ object.repository_name }}
2   -{{ object.repository_name|slugify }}
3   -{{ object.rev }}
4   -{{ object.rev|slugify }}
5   -{% firstof object.get_author.get_full_name object.author %}
6   -{% firstof object.get_author.get_full_name|slugify object.author|slugify %}
7   -{{ object.message }}
8   -{{ object.message|slugify }}
colab/plugins/trac/templates/search/indexes/proxy/ticket_text.txt
... ... @@ -1,20 +0,0 @@
1   -{{ object.summary }}
2   -{{ object.summary|slugify }}
3   -{{ object.description }}
4   -{{ object.description|slugify }}
5   -{{ object.milestone }}
6   -{{ object.milestone|slugify }}
7   -{{ object.component|slugify }}
8   -{{ object.version }}
9   -{{ object.severity }}
10   -{{ object.severity|slugify }}
11   -{{ object.reporter }}
12   -{{ object.reporter|slugify }}
13   -{% firstof object.get_author.get_fullname or object.author %}
14   -{% firstof object.get_author.get_fullname|slugify or object.author|slugify %}
15   -{{ object.status }}
16   -{{ object.status|slugify }}
17   -{{ object.keywords }}
18   -{{ object.keywords|slugify }}
19   -{{ object.collaborators }}
20   -{{ object.collaborators|slugify }}
colab/plugins/trac/templates/search/indexes/proxy/wiki_text.txt
... ... @@ -1,9 +0,0 @@
1   -{{ object.author }}
2   -{{ object.get_author.get_full_name }}
3   -{{ object.get_author.get_full_name|slugify }}
4   -{{ object.name }}
5   -{{ object.name|slugify }}
6   -{{ object.collaborators }}
7   -{{ object.collaborators|slugify }}
8   -{{ object.wiki_text }}
9   -{{ object.wiki_text|slugify }}
colab/plugins/trac/urls.py
... ... @@ -1,10 +0,0 @@
1   -
2   -from django.conf.urls import patterns, url
3   -
4   -from .views import TracProxyView
5   -
6   -
7   -urlpatterns = patterns('',
8   - # Trac
9   - url(r'^(?P<path>.*)$', TracProxyView.as_view(), name='trac'),
10   -)
colab/plugins/trac/views.py
... ... @@ -1,40 +0,0 @@
1   -
2   -from hitcounter.views import HitCounterViewMixin
3   -
4   -from ..utils.views import ColabProxyView
5   -from .models import Wiki, Ticket, Revision
6   -
7   -
8   -class TracProxyView(HitCounterViewMixin, ColabProxyView):
9   - app_label = 'trac'
10   - diazo_theme_template = 'proxy/trac.html'
11   -
12   - def get_object(self):
13   - obj = None
14   -
15   - if self.request.path_info.startswith('/wiki'):
16   - wiki_name = self.request.path_info.split('/', 2)[-1]
17   - if not wiki_name:
18   - wiki_name = 'WikiStart'
19   - try:
20   - obj = Wiki.objects.get(name=wiki_name)
21   - except Wiki.DoesNotExist:
22   - return None
23   - elif self.request.path_info.startswith('/ticket'):
24   - ticket_id = self.request.path_info.split('/')[2]
25   - try:
26   - obj = Ticket.objects.get(id=ticket_id)
27   - except (Ticket.DoesNotExist, ValueError):
28   - return None
29   - elif self.request.path_info.startswith('/changeset'):
30   - try:
31   - changeset, repo = self.request.path_info.split('/')[2:4]
32   - except ValueError:
33   - return None
34   - try:
35   - obj = Revision.objects.get(rev=changeset,
36   - repository_name=repo)
37   - except Revision.DoesNotExist:
38   - return None
39   -
40   - return obj
colab/urls.py
... ... @@ -35,7 +35,6 @@ urlpatterns = patterns(&#39;&#39;,
35 35 # Uncomment the next line to enable the admin:
36 36 url(r'^colab/admin/', include(admin.site.urls)),
37 37  
38   - url(r'^trac/', include('colab.plugins.trac.urls')),
39 38 url(r'^gitlab/', include('colab.plugins.gitlab.urls')),
40 39 url(r'^mezuro/', include('colab.plugins.mezuro.urls')),
41 40 url(r'^social/', include('colab.plugins.noosfero.urls')),
... ...