Show More
@@ -2,7 +2,7 b'' | |||
|
2 | 2 | Hg app, a web based mercurial repository managment based on pylons |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 |
VERSION = (0, 7, |
|
|
5 | VERSION = (0, 7, 1, 'beta') | |
|
6 | 6 | |
|
7 | 7 | __version__ = '.'.join((str(each) for each in VERSION[:4])) |
|
8 | 8 |
@@ -44,7 +44,7 b' def make_app(global_conf, full_stack=Tru' | |||
|
44 | 44 | |
|
45 | 45 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
|
46 | 46 | #set the https based on HTTP_X_URL_SCHEME |
|
47 | app = HttpsFixup(app) | |
|
47 | ||
|
48 | 48 | app = SimpleHg(app, config) |
|
49 | 49 | |
|
50 | 50 | if asbool(full_stack): |
@@ -58,6 +58,7 b' def make_app(global_conf, full_stack=Tru' | |||
|
58 | 58 | else: |
|
59 | 59 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) |
|
60 | 60 | |
|
61 | app = HttpsFixup(app) | |
|
61 | 62 | # Establish the Registry for this application |
|
62 | 63 | app = RegistryManager(app) |
|
63 | 64 |
@@ -2,11 +2,12 b'' | |||
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | import logging |
|
4 | 4 | from operator import itemgetter |
|
5 | from pylons import tmpl_context as c, request, config | |
|
6 | from pylons_app.lib.base import BaseController, render | |
|
5 | from pylons import tmpl_context as c, request, config, url, response | |
|
6 | from pylons_app.lib.base import BaseController, render, _full_changelog_cached | |
|
7 | 7 | from pylons_app.lib.utils import get_repo_slug |
|
8 | 8 | from pylons_app.model.hg_model import HgModel |
|
9 | 9 | from pylons_app.lib.auth import LoginRequired |
|
10 | from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed | |
|
10 | 11 | log = logging.getLogger(__name__) |
|
11 | 12 | |
|
12 | 13 | class FeedController(BaseController): |
@@ -14,9 +15,47 b' class FeedController(BaseController):' | |||
|
14 | 15 | #secure it or not ? |
|
15 | 16 | def __before__(self): |
|
16 | 17 | super(FeedController, self).__before__() |
|
18 | #common values for feeds | |
|
19 | self.description = 'Changes on %s repository' | |
|
20 | self.title = "%s feed" | |
|
21 | self.language = 'en-us' | |
|
22 | self.ttl = "5" | |
|
23 | self.feed_nr = 10 | |
|
24 | ||
|
25 | def atom(self, repo_name): | |
|
26 | """Produce an atom-1.0 feed via feedgenerator module""" | |
|
27 | feed = Atom1Feed(title=self.title % repo_name, | |
|
28 | link=url('summary_home', repo_name=repo_name, qualified=True), | |
|
29 | description=self.description % repo_name, | |
|
30 | language=self.language, | |
|
31 | ttl=self.ttl) | |
|
17 | 32 | |
|
18 | def atom(self): | |
|
19 | return 'Hello Atom' | |
|
33 | ||
|
34 | for cnt, cs in enumerate(_full_changelog_cached(repo_name)): | |
|
35 | if cnt > self.feed_nr: | |
|
36 | break | |
|
37 | feed.add_item(title=cs.message, | |
|
38 | link=url('changeset_home', repo_name=repo_name, revision=cs.raw_id, qualified=True), | |
|
39 | description=str(cs.date)) | |
|
40 | ||
|
41 | response.content_type = feed.mime_type | |
|
42 | return feed.writeString('utf-8') | |
|
43 | ||
|
20 | 44 | |
|
21 | def rss(self): | |
|
22 | return 'Hello rss' | |
|
45 | def rss(self, repo_name): | |
|
46 | """Produce an rss2 feed via feedgenerator module""" | |
|
47 | feed = Rss201rev2Feed(title=self.title % repo_name, | |
|
48 | link=url('summary_home', repo_name=repo_name, qualified=True), | |
|
49 | description=self.description % repo_name, | |
|
50 | language=self.language, | |
|
51 | ttl=self.ttl) | |
|
52 | ||
|
53 | for cnt, cs in enumerate(_full_changelog_cached(repo_name)): | |
|
54 | if cnt > self.feed_nr: | |
|
55 | break | |
|
56 | feed.add_item(title=cs.message, | |
|
57 | link=url('changeset_home', repo_name=repo_name, revision=cs.raw_id, qualified=True), | |
|
58 | description=str(cs.date)) | |
|
59 | ||
|
60 | response.content_type = feed.mime_type | |
|
61 | return feed.writeString('utf-8') |
General Comments 0
You need to be logged in to leave comments.
Login now