Commit 165c3e804e846e4b45c9613889a4f6b985173520
1 parent
7de25ba3
Exists in
master
and in
39 other branches
Moving trac stuff to a different app
Showing
21 changed files
with
311 additions
and
311 deletions
Show diff stats
src/accounts/search_indexes.py
src/accounts/views.py
... | ... | @@ -25,7 +25,7 @@ from haystack.query import SearchQuerySet |
25 | 25 | from super_archives.models import EmailAddress, Message |
26 | 26 | from super_archives.utils.email import send_email_lists |
27 | 27 | from search.utils import trans |
28 | -from proxy.models import WikiCollabCount, TicketCollabCount | |
28 | +#from proxy.trac.models import WikiCollabCount, TicketCollabCount | |
29 | 29 | from .forms import (UserCreationForm, ListsForm, UserUpdateForm, |
30 | 30 | ChangeXMPPPasswordForm) |
31 | 31 | from .errors import XMPPChangePwdException | ... | ... |
src/api/resources.py
... | ... | @@ -7,8 +7,7 @@ from tastypie.constants import ALL_WITH_RELATIONS, ALL |
7 | 7 | from tastypie.resources import ModelResource |
8 | 8 | |
9 | 9 | from super_archives.models import Message, EmailAddress |
10 | -from proxy.models import Revision, Ticket, Wiki | |
11 | - | |
10 | +#from proxy.trac.models import Revision, Ticket, Wiki | |
12 | 11 | |
13 | 12 | User = get_user_model() |
14 | 13 | |
... | ... | @@ -66,56 +65,56 @@ class MessageResource(ModelResource): |
66 | 65 | } |
67 | 66 | |
68 | 67 | |
69 | -class RevisionResource(ModelResource): | |
70 | - class Meta: | |
71 | - queryset = Revision.objects.all() | |
72 | - resource_name = 'revision' | |
73 | - excludes = ['collaborators', ] | |
74 | - filtering = { | |
75 | - 'key': ALL, | |
76 | - 'rev': ALL, | |
77 | - 'author': ALL, | |
78 | - 'message': ALL, | |
79 | - 'repository_name': ALL, | |
80 | - 'created': ALL, | |
81 | - } | |
82 | - | |
83 | - | |
84 | -class TicketResource(ModelResource): | |
85 | - class Meta: | |
86 | - queryset = Ticket.objects.all() | |
87 | - resource_name = 'ticket' | |
88 | - excludes = ['collaborators', ] | |
89 | - filtering = { | |
90 | - 'id': ALL, | |
91 | - 'summary': ALL, | |
92 | - 'description': ALL, | |
93 | - 'milestone': ALL, | |
94 | - 'priority': ALL, | |
95 | - 'component': ALL, | |
96 | - 'version': ALL, | |
97 | - 'severity': ALL, | |
98 | - 'reporter': ALL, | |
99 | - 'author': ALL, | |
100 | - 'status': ALL, | |
101 | - 'keywords': ALL, | |
102 | - 'created': ALL, | |
103 | - 'modified': ALL, | |
104 | - 'modified_by': ALL, | |
105 | - } | |
106 | - | |
107 | - | |
108 | -class WikiResource(ModelResource): | |
109 | - class Meta: | |
110 | - queryset = Wiki.objects.all() | |
111 | - resource_name = 'wiki' | |
112 | - excludes = ['collaborators', ] | |
113 | - filtering = { | |
114 | - 'name': ALL, | |
115 | - 'wiki_text': ALL, | |
116 | - 'author': ALL, | |
117 | - 'name': ALL, | |
118 | - 'created': ALL, | |
119 | - 'modified': ALL, | |
120 | - 'modified_by': ALL, | |
121 | - } | |
68 | +#class RevisionResource(ModelResource): | |
69 | +# class Meta: | |
70 | +# queryset = Revision.objects.all() | |
71 | +# resource_name = 'revision' | |
72 | +# excludes = ['collaborators', ] | |
73 | +# filtering = { | |
74 | +# 'key': ALL, | |
75 | +# 'rev': ALL, | |
76 | +# 'author': ALL, | |
77 | +# 'message': ALL, | |
78 | +# 'repository_name': ALL, | |
79 | +# 'created': ALL, | |
80 | +# } | |
81 | +# | |
82 | +# | |
83 | +#class TicketResource(ModelResource): | |
84 | +# class Meta: | |
85 | +# queryset = Ticket.objects.all() | |
86 | +# resource_name = 'ticket' | |
87 | +# excludes = ['collaborators', ] | |
88 | +# filtering = { | |
89 | +# 'id': ALL, | |
90 | +# 'summary': ALL, | |
91 | +# 'description': ALL, | |
92 | +# 'milestone': ALL, | |
93 | +# 'priority': ALL, | |
94 | +# 'component': ALL, | |
95 | +# 'version': ALL, | |
96 | +# 'severity': ALL, | |
97 | +# 'reporter': ALL, | |
98 | +# 'author': ALL, | |
99 | +# 'status': ALL, | |
100 | +# 'keywords': ALL, | |
101 | +# 'created': ALL, | |
102 | +# 'modified': ALL, | |
103 | +# 'modified_by': ALL, | |
104 | +# } | |
105 | +# | |
106 | +# | |
107 | +#class WikiResource(ModelResource): | |
108 | +# class Meta: | |
109 | +# queryset = Wiki.objects.all() | |
110 | +# resource_name = 'wiki' | |
111 | +# excludes = ['collaborators', ] | |
112 | +# filtering = { | |
113 | +# 'name': ALL, | |
114 | +# 'wiki_text': ALL, | |
115 | +# 'author': ALL, | |
116 | +# 'name': ALL, | |
117 | +# 'created': ALL, | |
118 | +# 'modified': ALL, | |
119 | +# 'modified_by': ALL, | |
120 | +# } | ... | ... |
src/api/urls.py
... | ... | @@ -4,8 +4,7 @@ from django.conf.urls import patterns, include, url |
4 | 4 | |
5 | 5 | from tastypie.api import Api |
6 | 6 | |
7 | -from .resources import (UserResource, EmailAddressResource, MessageResource, | |
8 | - RevisionResource, TicketResource, WikiResource) | |
7 | +from .resources import (UserResource, EmailAddressResource, MessageResource) | |
9 | 8 | from .views import VoteView |
10 | 9 | |
11 | 10 | |
... | ... | @@ -13,9 +12,6 @@ api = Api(api_name='v1') |
13 | 12 | api.register(UserResource()) |
14 | 13 | api.register(EmailAddressResource()) |
15 | 14 | api.register(MessageResource()) |
16 | -api.register(RevisionResource()) | |
17 | -api.register(TicketResource()) | |
18 | -api.register(WikiResource()) | |
19 | 15 | |
20 | 16 | |
21 | 17 | urlpatterns = patterns('', | ... | ... |
src/badger/utils.py
... | ... | @@ -2,8 +2,8 @@ |
2 | 2 | |
3 | 3 | from django.db.models import Count |
4 | 4 | |
5 | -from proxy.models import (Revision, Ticket, Wiki, | |
6 | - WikiCollabCount, TicketCollabCount) | |
5 | +#from proxy.trac.models import (Revision, Ticket, Wiki, | |
6 | +# WikiCollabCount, TicketCollabCount) | |
7 | 7 | from accounts.models import User |
8 | 8 | |
9 | 9 | ... | ... |
src/colab/custom_settings.py
src/colab/urls.py
src/home/views.py
... | ... | @@ -9,7 +9,7 @@ from django.http import HttpResponse, Http404 |
9 | 9 | from search.utils import trans |
10 | 10 | from haystack.query import SearchQuerySet |
11 | 11 | |
12 | -from proxy.models import WikiCollabCount, TicketCollabCount | |
12 | +#from proxy.trac.models import WikiCollabCount, TicketCollabCount | |
13 | 13 | from super_archives.models import Thread |
14 | 14 | |
15 | 15 | ... | ... |
src/proxy/models.py
... | ... | @@ -1,178 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -from django.db import models | |
3 | -from django.conf import settings | |
4 | -import os | |
5 | -import urllib2 | |
6 | - | |
7 | -from django.conf import settings | |
8 | -from django.db import models, connections | |
9 | -from django.db.models.signals import post_save | |
10 | -from django.dispatch import receiver | |
11 | - | |
12 | -from accounts.models import User | |
13 | -from hitcounter.models import HitCounterModelMixin | |
14 | - | |
15 | -class Attachment(models.Model, HitCounterModelMixin): | |
16 | - url = models.TextField(primary_key=True) | |
17 | - attach_id = models.TextField() | |
18 | - used_by = models.TextField() | |
19 | - filename = models.TextField() | |
20 | - author = models.TextField(blank=True) | |
21 | - description = models.TextField(blank=True) | |
22 | - created = models.DateTimeField(blank=True) | |
23 | - mimetype = models.TextField(blank=True) | |
24 | - size = models.IntegerField(blank=True) | |
25 | - | |
26 | - class Meta: | |
27 | - managed = False | |
28 | - db_table = 'attachment_view' | |
29 | - | |
30 | - @property | |
31 | - def filepath(self): | |
32 | - return os.path.join( | |
33 | - settings.ATTACHMENTS_FOLDER_PATH, | |
34 | - self.used_by, | |
35 | - self.attach_id, | |
36 | - urllib2.quote(self.filename.encode('utf8')) | |
37 | - ) | |
38 | - | |
39 | - def get_absolute_url(self): | |
40 | - return u'/raw-attachment/{}'.format(self.url) | |
41 | - | |
42 | - def get_author(self): | |
43 | - try: | |
44 | - return User.objects.get(username=self.author) | |
45 | - except User.DoesNotExist: | |
46 | - return None | |
47 | - | |
48 | - | |
49 | -class Revision(models.Model, HitCounterModelMixin): | |
50 | - key = models.TextField(blank=True, primary_key=True) | |
51 | - rev = models.TextField(blank=True) | |
52 | - author = models.TextField(blank=True) | |
53 | - message = models.TextField(blank=True) | |
54 | - repository_name = models.TextField(blank=True) | |
55 | - created = models.DateTimeField(blank=True, null=True) | |
56 | - | |
57 | - class Meta: | |
58 | - managed = False | |
59 | - db_table = 'revision_view' | |
60 | - | |
61 | - def get_absolute_url(self): | |
62 | - return u'/changeset/{}/{}'.format(self.rev, self.repository_name) | |
63 | - | |
64 | - def get_author(self): | |
65 | - try: | |
66 | - return User.objects.get(username=self.author) | |
67 | - except User.DoesNotExist: | |
68 | - return None | |
69 | - | |
70 | -class Ticket(models.Model, HitCounterModelMixin): | |
71 | - id = models.IntegerField(primary_key=True) | |
72 | - summary = models.TextField(blank=True) | |
73 | - description = models.TextField(blank=True) | |
74 | - milestone = models.TextField(blank=True) | |
75 | - priority = models.TextField(blank=True) | |
76 | - component = models.TextField(blank=True) | |
77 | - version = models.TextField(blank=True) | |
78 | - severity = models.TextField(blank=True) | |
79 | - reporter = models.TextField(blank=True) | |
80 | - author = models.TextField(blank=True) | |
81 | - status = models.TextField(blank=True) | |
82 | - keywords = models.TextField(blank=True) | |
83 | - collaborators = models.TextField(blank=True) | |
84 | - created = models.DateTimeField(blank=True, null=True) | |
85 | - modified = models.DateTimeField(blank=True, null=True) | |
86 | - modified_by = models.TextField(blank=True) | |
87 | - | |
88 | - class Meta: | |
89 | - managed = False | |
90 | - db_table = 'ticket_view' | |
91 | - | |
92 | - def get_absolute_url(self): | |
93 | - return u'/ticket/{}'.format(self.id) | |
94 | - | |
95 | - def get_author(self): | |
96 | - try: | |
97 | - return User.objects.get(username=self.author) | |
98 | - except User.DoesNotExist: | |
99 | - return None | |
100 | - | |
101 | - def get_modified_by(self): | |
102 | - try: | |
103 | - return User.objects.get(username=self.modified_by) | |
104 | - except User.DoesNotExist: | |
105 | - return None | |
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 | |
134 | - | |
135 | - | |
136 | -class WikiCollabCount(models.Model): | |
137 | - author = models.TextField(primary_key=True) | |
138 | - count = models.IntegerField() | |
139 | - | |
140 | - class Meta: | |
141 | - managed = False | |
142 | - db_table = 'wiki_collab_count_view' | |
143 | - | |
144 | - | |
145 | -class TicketCollabCount(models.Model): | |
146 | - author = models.TextField(primary_key=True) | |
147 | - count = models.IntegerField() | |
148 | - | |
149 | - class Meta: | |
150 | - managed = False | |
151 | - db_table = 'ticket_collab_count_view' | |
152 | - | |
153 | - | |
154 | -@receiver(post_save, sender=User) | |
155 | -def change_session_attribute_email(sender, instance, **kwargs): | |
156 | - cursor = connections['trac'].cursor() | |
157 | - | |
158 | - cursor.execute(("UPDATE session_attribute SET value=%s " | |
159 | - "WHERE name='email' AND sid=%s"), | |
160 | - [instance.email, instance.username]) | |
161 | - cursor.execute(("UPDATE session_attribute SET value=%s " | |
162 | - "WHERE name='name' AND sid=%s"), | |
163 | - [instance.get_full_name(), instance.username]) | |
164 | - | |
165 | - cursor.execute(("INSERT INTO session_attribute " | |
166 | - "(sid, authenticated, name, value) " | |
167 | - "SELECT %s, '1', 'email', %s WHERE NOT EXISTS " | |
168 | - "(SELECT 1 FROM session_attribute WHERE sid=%s " | |
169 | - "AND name='email')"), | |
170 | - [instance.username, instance.email, instance.username]) | |
171 | - | |
172 | - cursor.execute(("INSERT INTO session_attribute " | |
173 | - "(sid, authenticated, name, value) " | |
174 | - "SELECT %s, '1', 'name', %s WHERE NOT EXISTS " | |
175 | - "(SELECT 1 FROM session_attribute WHERE sid=%s " | |
176 | - "AND name='name')"), | |
177 | - [instance.username, instance.get_full_name(), | |
178 | - instance.username]) |
src/proxy/templatetags/__init__.py
src/proxy/templatetags/proxy.py
... | ... | @@ -1,12 +0,0 @@ |
1 | -from django import template | |
2 | - | |
3 | -from super_archives.utils import url | |
4 | -from django.conf import settings | |
5 | - | |
6 | - | |
7 | -register = template.Library() | |
8 | -TEMPLATE_PATH = 'proxy/tags/' | |
9 | - | |
10 | -@register.assignment_tag | |
11 | -def is_trac_enable(): | |
12 | - return settings.TRAC_ENABLED | |
13 | 0 | \ No newline at end of file |
src/proxy/trac/admin.py
src/proxy/trac/models.py
... | ... | @@ -0,0 +1,149 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +from django.db import models | |
3 | +from django.conf import settings | |
4 | +import os | |
5 | +import urllib2 | |
6 | + | |
7 | +from accounts.models import User | |
8 | +from hitcounter.models import HitCounterModelMixin | |
9 | + | |
10 | + | |
11 | +class Attachment(models.Model, HitCounterModelMixin): | |
12 | + url = models.TextField(primary_key=True) | |
13 | + attach_id = models.TextField() | |
14 | + used_by = models.TextField() | |
15 | + filename = models.TextField() | |
16 | + author = models.TextField(blank=True) | |
17 | + description = models.TextField(blank=True) | |
18 | + created = models.DateTimeField(blank=True) | |
19 | + mimetype = models.TextField(blank=True) | |
20 | + size = models.IntegerField(blank=True) | |
21 | + | |
22 | + class Meta: | |
23 | + managed = False | |
24 | + db_table = 'attachment_view' | |
25 | + | |
26 | + @property | |
27 | + def filepath(self): | |
28 | + return os.path.join( | |
29 | + settings.ATTACHMENTS_FOLDER_PATH, | |
30 | + self.used_by, | |
31 | + self.attach_id, | |
32 | + urllib2.quote(self.filename.encode('utf8')) | |
33 | + ) | |
34 | + | |
35 | + def get_absolute_url(self): | |
36 | + return u'/raw-attachment/{}'.format(self.url) | |
37 | + | |
38 | + def get_author(self): | |
39 | + try: | |
40 | + return User.objects.get(username=self.author) | |
41 | + except User.DoesNotExist: | |
42 | + return None | |
43 | + | |
44 | + | |
45 | +class Revision(models.Model, HitCounterModelMixin): | |
46 | + key = models.TextField(blank=True, primary_key=True) | |
47 | + rev = models.TextField(blank=True) | |
48 | + author = models.TextField(blank=True) | |
49 | + message = models.TextField(blank=True) | |
50 | + repository_name = models.TextField(blank=True) | |
51 | + created = models.DateTimeField(blank=True, null=True) | |
52 | + | |
53 | + class Meta: | |
54 | + managed = False | |
55 | + db_table = 'revision_view' | |
56 | + | |
57 | + def get_absolute_url(self): | |
58 | + return u'/changeset/{}/{}'.format(self.rev, self.repository_name) | |
59 | + | |
60 | + def get_author(self): | |
61 | + try: | |
62 | + return User.objects.get(username=self.author) | |
63 | + except User.DoesNotExist: | |
64 | + return None | |
65 | + | |
66 | + | |
67 | +class Ticket(models.Model, HitCounterModelMixin): | |
68 | + id = models.IntegerField(primary_key=True) | |
69 | + summary = models.TextField(blank=True) | |
70 | + description = models.TextField(blank=True) | |
71 | + milestone = models.TextField(blank=True) | |
72 | + priority = models.TextField(blank=True) | |
73 | + component = models.TextField(blank=True) | |
74 | + version = models.TextField(blank=True) | |
75 | + severity = models.TextField(blank=True) | |
76 | + reporter = models.TextField(blank=True) | |
77 | + author = models.TextField(blank=True) | |
78 | + status = models.TextField(blank=True) | |
79 | + keywords = models.TextField(blank=True) | |
80 | + collaborators = models.TextField(blank=True) | |
81 | + created = models.DateTimeField(blank=True, null=True) | |
82 | + modified = models.DateTimeField(blank=True, null=True) | |
83 | + modified_by = models.TextField(blank=True) | |
84 | + | |
85 | + class Meta: | |
86 | + managed = False | |
87 | + db_table = 'ticket_view' | |
88 | + | |
89 | + def get_absolute_url(self): | |
90 | + return u'/ticket/{}'.format(self.id) | |
91 | + | |
92 | + def get_author(self): | |
93 | + try: | |
94 | + return User.objects.get(username=self.author) | |
95 | + except User.DoesNotExist: | |
96 | + return None | |
97 | + | |
98 | + def get_modified_by(self): | |
99 | + try: | |
100 | + return User.objects.get(username=self.modified_by) | |
101 | + except User.DoesNotExist: | |
102 | + return None | |
103 | + | |
104 | + | |
105 | +class Wiki(models.Model, HitCounterModelMixin): | |
106 | + name = models.TextField(primary_key=True) | |
107 | + wiki_text = models.TextField(blank=True) | |
108 | + author = models.TextField(blank=True) | |
109 | + collaborators = models.TextField(blank=True) | |
110 | + created = models.DateTimeField(blank=True, null=True) | |
111 | + modified = models.DateTimeField(blank=True, null=True) | |
112 | + modified_by = models.TextField(blank=True) | |
113 | + | |
114 | + class Meta: | |
115 | + managed = False | |
116 | + db_table = 'wiki_view' | |
117 | + | |
118 | + def get_absolute_url(self): | |
119 | + return u'/wiki/{}'.format(self.name) | |
120 | + | |
121 | + def get_author(self): | |
122 | + try: | |
123 | + return User.objects.get(username=self.author) | |
124 | + except User.DoesNotExist: | |
125 | + return None | |
126 | + | |
127 | + def get_modified_by(self): | |
128 | + try: | |
129 | + return User.objects.get(username=self.modified_by) | |
130 | + except User.DoesNotExist: | |
131 | + return None | |
132 | + | |
133 | + | |
134 | +class WikiCollabCount(models.Model): | |
135 | + author = models.TextField(primary_key=True) | |
136 | + count = models.IntegerField() | |
137 | + | |
138 | + class Meta: | |
139 | + managed = False | |
140 | + db_table = 'wiki_collab_count_view' | |
141 | + | |
142 | + | |
143 | +class TicketCollabCount(models.Model): | |
144 | + author = models.TextField(primary_key=True) | |
145 | + count = models.IntegerField() | |
146 | + | |
147 | + class Meta: | |
148 | + managed = False | |
149 | + db_table = 'ticket_collab_count_view' | ... | ... |
... | ... | @@ -0,0 +1,33 @@ |
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 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]) | ... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | + | |
2 | +from django.conf.urls import patterns, include, url | |
3 | + | |
4 | +from .views import TracProxyView | |
5 | + | |
6 | + | |
7 | +urlpatterns = patterns('', | |
8 | + # Trac URLs | |
9 | + url(r'^(?P<path>(?:admin|wiki|changeset|newticket|ticket|chrome|timeline|roadmap|browser|report|tags|query|about|prefs|log|attachment|raw-attachment|diff|milestone).*)$', | |
10 | + TracProxyView.as_view()), | |
11 | + | |
12 | + # Trac | |
13 | + url(r'^trac/(?P<path>.*)$', TracProxyView.as_view()), | |
14 | +) | ... | ... |
src/proxy/trac/views.py
1 | -from django.shortcuts import render | |
2 | 1 | |
3 | -# Create your views here. | |
2 | +import os | |
3 | + | |
4 | +from django.conf import settings | |
5 | + | |
6 | +from revproxy.views import ProxyView | |
7 | +from hitcounter.views import HitCounterViewMixin | |
8 | + | |
9 | +from .models import Wiki, Ticket, Revision | |
10 | + | |
11 | + | |
12 | +CWD = os.path.abspath(os.path.dirname(__file__)) | |
13 | +DIAZO_RULES_DIR = os.path.join(CWD, 'diazo') | |
14 | + | |
15 | + | |
16 | +class TracProxyView(HitCounterViewMixin, ProxyView): | |
17 | + base_url = settings.COLAB_TRAC_URL | |
18 | + add_remote_user = settings.REVPROXY_ADD_REMOTE_USER | |
19 | + diazo_theme_template = 'proxy/trac.html' | |
20 | + diazo_rules = os.path.join(DIAZO_RULES_DIR, 'trac.xml') | |
21 | + html5 = True | |
22 | + | |
23 | + def get_object(self): | |
24 | + obj = None | |
25 | + | |
26 | + if self.request.path_info.startswith('/wiki'): | |
27 | + wiki_name = self.request.path_info.split('/', 2)[-1] | |
28 | + if not wiki_name: | |
29 | + wiki_name = 'WikiStart' | |
30 | + try: | |
31 | + obj = Wiki.objects.get(name=wiki_name) | |
32 | + except Wiki.DoesNotExist: | |
33 | + return None | |
34 | + elif self.request.path_info.startswith('/ticket'): | |
35 | + ticket_id = self.request.path_info.split('/')[2] | |
36 | + try: | |
37 | + obj = Ticket.objects.get(id=ticket_id) | |
38 | + except (Ticket.DoesNotExist, ValueError): | |
39 | + return None | |
40 | + elif self.request.path_info.startswith('/changeset'): | |
41 | + try: | |
42 | + changeset, repo = self.request.path_info.split('/')[2:4] | |
43 | + except ValueError: | |
44 | + return None | |
45 | + try: | |
46 | + obj = Revision.objects.get(rev=changeset, | |
47 | + repository_name=repo) | |
48 | + except Revision.DoesNotExist: | |
49 | + return None | |
50 | + | |
51 | + return obj | ... | ... |
src/proxy/urls.py
1 | 1 | |
2 | 2 | from django.conf.urls import patterns, include, url |
3 | 3 | |
4 | -from .views import ProxyView, JenkinsProxyView, GitlabProxyView, RedmineProxyView, TracProxyView | |
4 | +from .views import ProxyView, JenkinsProxyView, GitlabProxyView, RedmineProxyView | |
5 | 5 | |
6 | 6 | |
7 | 7 | urlpatterns = patterns('', |
8 | - # Trac URLs | |
9 | - url(r'^(?P<path>(?:admin|wiki|changeset|newticket|ticket|chrome|timeline|roadmap|browser|report|tags|query|about|prefs|log|attachment|raw-attachment|diff|milestone).*)$', | |
10 | - TracProxyView.as_view()), | |
11 | - | |
12 | 8 | # Jenkins URLs |
13 | 9 | url(r'^ci/(?P<path>.*)$', JenkinsProxyView.as_view()), |
14 | 10 | |
15 | - # Trac | |
16 | - url(r'^trac/(?P<path>.*)$', TracProxyView.as_view()), | |
17 | - | |
18 | 11 | # Gitlab |
19 | 12 | url(r'^gitlab/(?P<path>.*)$', GitlabProxyView.as_view()), |
20 | 13 | |
21 | 14 | # Redmine |
22 | 15 | url(r'^redmine/(?P<path>.*)$', RedmineProxyView.as_view()) |
23 | - | |
24 | 16 | ) | ... | ... |
src/proxy/views.py
... | ... | @@ -4,50 +4,11 @@ import os |
4 | 4 | from django.conf import settings |
5 | 5 | |
6 | 6 | from revproxy.views import ProxyView |
7 | -from .models import Wiki, Ticket, Revision | |
8 | -from hitcounter.views import HitCounterViewMixin | |
9 | 7 | |
10 | 8 | |
11 | 9 | CWD = os.path.abspath(os.path.dirname(__file__)) |
12 | 10 | DIAZO_RULES_DIR = os.path.join(CWD, 'diazo') |
13 | 11 | |
14 | -class TracProxyView(HitCounterViewMixin, ProxyView): | |
15 | - base_url = settings.COLAB_TRAC_URL | |
16 | - add_remote_user = settings.REVPROXY_ADD_REMOTE_USER | |
17 | - diazo_theme_template = 'proxy/trac.html' | |
18 | - diazo_rules = os.path.join(DIAZO_RULES_DIR, 'trac.xml') | |
19 | - html5 = True | |
20 | - | |
21 | - def get_object(self): | |
22 | - obj = None | |
23 | - | |
24 | - if self.request.path_info.startswith('/wiki'): | |
25 | - wiki_name = self.request.path_info.split('/', 2)[-1] | |
26 | - if not wiki_name: | |
27 | - wiki_name = 'WikiStart' | |
28 | - try: | |
29 | - obj = Wiki.objects.get(name=wiki_name) | |
30 | - except Wiki.DoesNotExist: | |
31 | - return None | |
32 | - elif self.request.path_info.startswith('/ticket'): | |
33 | - ticket_id = self.request.path_info.split('/')[2] | |
34 | - try: | |
35 | - obj = Ticket.objects.get(id=ticket_id) | |
36 | - except (Ticket.DoesNotExist, ValueError): | |
37 | - return None | |
38 | - elif self.request.path_info.startswith('/changeset'): | |
39 | - try: | |
40 | - changeset, repo = self.request.path_info.split('/')[2:4] | |
41 | - except ValueError: | |
42 | - return None | |
43 | - try: | |
44 | - obj = Revision.objects.get(rev=changeset, | |
45 | - repository_name=repo) | |
46 | - except Revision.DoesNotExist: | |
47 | - return None | |
48 | - | |
49 | - return obj | |
50 | - | |
51 | 12 | |
52 | 13 | class JenkinsProxyView(ProxyView): |
53 | 14 | base_url = settings.COLAB_CI_URL | ... | ... |
src/search/templates/search/includes/search_filters.html
1 | -{% load i18n superarchives proxy %} | |
1 | +{% load i18n superarchives %} | |
2 | 2 | |
3 | 3 | {% if filters %} |
4 | 4 | <ul class="unstyled-list"> |
... | ... | @@ -111,7 +111,6 @@ |
111 | 111 | <h4>{% trans "Types" %}</h4> |
112 | 112 | |
113 | 113 | <ul class="unstyled-list"> |
114 | - {% is_trac_enable as is_trac %} | |
115 | 114 | |
116 | 115 | {% if is_trac %} |
117 | 116 | <li> | ... | ... |
src/search/views.py