|
a/Allura/allura/controllers/project.py |
|
b/Allura/allura/controllers/project.py |
|
... |
|
... |
38 |
from allura.lib.base import WsgiDispatchController
|
38 |
from allura.lib.base import WsgiDispatchController
|
39 |
from allura.lib import helpers as h
|
39 |
from allura.lib import helpers as h
|
40 |
from allura.lib import utils
|
40 |
from allura.lib import utils
|
41 |
from allura.lib.decorators import require_post
|
41 |
from allura.lib.decorators import require_post
|
42 |
from allura.controllers.error import ErrorController
|
42 |
from allura.controllers.error import ErrorController
|
|
|
43 |
from allura.controllers.feed import Feed, FeedController
|
43 |
from allura.lib.security import require_access, has_access
|
44 |
from allura.lib.security import require_access, has_access
|
44 |
from allura.lib.security import RoleCache
|
45 |
from allura.lib.security import RoleCache
|
45 |
from allura.lib.widgets import forms as ff
|
46 |
from allura.lib.widgets import forms as ff
|
46 |
from allura.lib.widgets import form_fields as ffw
|
47 |
from allura.lib.widgets import form_fields as ffw
|
47 |
from allura.lib.widgets import project_list as plw
|
48 |
from allura.lib.widgets import project_list as plw
|
|
... |
|
... |
297 |
tool_name = tool_name.lower()
|
298 |
tool_name = tool_name.lower()
|
298 |
entries = [e for e in c.project.sitemap()
|
299 |
entries = [e for e in c.project.sitemap()
|
299 |
if e.tool_name and e.tool_name.lower() == tool_name]
|
300 |
if e.tool_name and e.tool_name.lower() == tool_name]
|
300 |
return dict(entries=entries, type=entries[0].tool_name.capitalize() if entries else None)
|
301 |
return dict(entries=entries, type=entries[0].tool_name.capitalize() if entries else None)
|
301 |
|
302 |
|
302 |
class ProjectController(object):
|
303 |
class ProjectController(FeedController):
|
303 |
|
304 |
|
304 |
def __init__(self):
|
305 |
def __init__(self):
|
305 |
setattr(self, 'feed.rss', self.feed)
|
|
|
306 |
setattr(self, 'feed.atom', self.feed)
|
|
|
307 |
setattr(self, '_nav.json', self._nav)
|
306 |
setattr(self, '_nav.json', self._nav)
|
308 |
self.screenshot = ScreenshotsController()
|
307 |
self.screenshot = ScreenshotsController()
|
309 |
self._list = ToolListController()
|
308 |
self._list = ToolListController()
|
310 |
|
309 |
|
311 |
@expose('json:')
|
310 |
@expose('json:')
|
|
... |
|
... |
365 |
elif 'sub' in mount:
|
364 |
elif 'sub' in mount:
|
366 |
redirect(mount['sub'].url())
|
365 |
redirect(mount['sub'].url())
|
367 |
else:
|
366 |
else:
|
368 |
redirect(c.project.app_configs[0].options.mount_point + '/')
|
367 |
redirect(c.project.app_configs[0].options.mount_point + '/')
|
369 |
|
368 |
|
370 |
@without_trailing_slash
|
369 |
def get_feed(self, project, app, user):
|
371 |
@expose()
|
370 |
"""Return a :class:`allura.controllers.feed.Feed` object describing
|
372 |
@validate(dict(
|
371 |
the xml feed for this controller.
|
373 |
since=h.DateTimeConverter(if_empty=None, if_invalid=None),
|
372 |
|
374 |
until=h.DateTimeConverter(if_empty=None, if_invalid=None),
|
373 |
Overrides :meth:`allura.controllers.feed.FeedController.get_feed`.
|
375 |
page=validators.Int(if_empty=None),
|
374 |
|
376 |
limit=validators.Int(if_empty=None)))
|
375 |
"""
|
377 |
def feed(self, since=None, until=None, page=None, limit=None, **kw):
|
376 |
return Feed(
|
378 |
if request.environ['PATH_INFO'].endswith('.atom'):
|
|
|
379 |
feed_type = 'atom'
|
|
|
380 |
else:
|
|
|
381 |
feed_type = 'rss'
|
|
|
382 |
title = 'Recent changes to Project %s' % c.project.name
|
|
|
383 |
feed = M.Feed.feed(
|
|
|
384 |
dict(project_id=c.project._id),
|
377 |
dict(project_id=project._id),
|
385 |
feed_type,
|
378 |
'Recent changes to Project %s' % project.name,
|
386 |
title,
|
|
|
387 |
c.project.url(),
|
379 |
project.url())
|
388 |
title,
|
|
|
389 |
since, until, page, limit)
|
|
|
390 |
response.headers['Content-Type'] = ''
|
|
|
391 |
response.content_type = 'application/xml'
|
|
|
392 |
return feed.writeString('utf-8')
|
|
|
393 |
|
380 |
|
394 |
@expose()
|
381 |
@expose()
|
395 |
def icon(self, **kw):
|
382 |
def icon(self, **kw):
|
396 |
icon = c.project.icon
|
383 |
icon = c.project.icon
|
397 |
if not icon:
|
384 |
if not icon:
|