Browse Source

Cleanup

master
Johann Schmitz 5 years ago
parent
commit
5171c549be
Signed by: ercpe GPG Key ID: A084064277C501ED
  1. 3
      src/gitbrowser/conf.py
  2. 5
      src/gitbrowser/templatetags/gb_tags.py
  3. 1
      src/gitbrowser/utils/http.py
  4. 3
      src/gitbrowser/views/core.py
  5. 3
      src/gitbrowser/views/mixins.py
  6. 16
      src/gitbrowser/views/repository.py

3
src/gitbrowser/conf.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import logging
import os
from django.conf import settings
from django.conf import settings
FEATURE_DEFAULTS = {
'gravatar': True,

5
src/gitbrowser/templatetags/gb_tags.py

@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
import urlparse
from django.contrib.humanize.templatetags.humanize import naturaltime
from django import template
from django.core.urlresolvers import reverse
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.template.base import TemplateSyntaxError
from django.template.defaultfilters import date, slugify
from django.template.loader import render_to_string
from django.utils.html import linebreaks
from django.utils.safestring import mark_safe
from gitbrowser.utils.linking import Autolinker
register = template.Library()

1
src/gitbrowser/utils/http.py

@ -24,4 +24,3 @@ def bestof(accept_header, *args):
for ct, q in accepted_content_types:
if ct in wanted_content_types:
return ct

3
src/gitbrowser/views/core.py

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http.response import Http404
from django.views.generic.base import TemplateView, View, ContextMixin
from django.views.generic.base import TemplateView
from gitbrowser.conf import config, LIST_STYLE_FLAT, LIST_STYLE_HIERARCHICAL, LIST_STYLE_TREE
from gitbrowser.views.mixins import BreadcrumbMixin, RepositoryMixin

3
src/gitbrowser/views/mixins.py

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
import json
import logging
from django.http import Http404, HttpResponse
from gitbrowser.conf import config
from gitbrowser.utils.http import bestof
from gitbrowser.utils.misc import generate_breadcrumb_path

16
src/gitbrowser/views/repository.py

@ -1,17 +1,19 @@
# -*- coding: utf-8 -*-
from gzip import GzipFile
import json
import logging
import urllib
from django.core.urlresolvers import reverse
from django.utils.http import http_date
from django.core.paginator import PageNotAnInteger, Paginator
from gzip import GzipFile
from django.core.paginator import EmptyPage
from django.core.paginator import PageNotAnInteger, Paginator
from django.core.urlresolvers import reverse
from django.http import StreamingHttpResponse, HttpResponse
from django.template.base import Template
from django.template.context import Context
from django.utils.http import http_date
from django.views.generic import TemplateView, View
from django.views.generic.detail import DetailView
from gitbrowser.conf import config, COMMIT_LIST_DEFAULT
from gitbrowser.templatetags.gb_tags import time_tag
from gitbrowser.views.mixins import RepositoryMixin, JSONContentNegotiationMixin
@ -40,7 +42,7 @@ class RepositoryTreeData(RepositoryMixin, View):
'commit_datetime': time_tag(commit.authored_datetime()),
'obj': item.hexsha
})
except Exception as ex:
except:
logging.exception("Caught exception while fetching latest commit for %s in %s" % (item, self.repository))
return StreamingHttpResponse(_inner(), content_type='text/event-stream')
@ -131,7 +133,7 @@ class RepositoryCommitsListView(JSONContentNegotiationMixin, RepositoryMixin, Te
'committer_name': commit.committer.name,
'committer_email': commit.committer.email
}
except Exception as ex:
except:
logging.exception("Failed to convert %s" % commit)
return json.dumps(list(_aa()))
@ -154,7 +156,7 @@ class RepositoryTagsView(JSONContentNegotiationMixin, RepositoryMixin, TemplateV
'timestamp': x.commit.committed_date,
'description': x.commit.summary
}
except Exception as ex:
except:
logging.exception("Failed to convert %s" % x)
return json.dumps(list(_aa()))