Patch submitted by mrb.
Fix to link to the pubsub hub for atom_feed 'by tag'. Added 'rel': 'alternate' and 'type': 'text/html' to 'atomlinks'
This commit is contained in:
parent
44082b12d8
commit
a4dcb1f46a
@ -14,6 +14,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from mediagoblin import mg_globals
|
||||||
from mediagoblin.db.models import MediaEntry
|
from mediagoblin.db.models import MediaEntry
|
||||||
from mediagoblin.db.util import media_entries_for_tag_slug
|
from mediagoblin.db.util import media_entries_for_tag_slug
|
||||||
from mediagoblin.tools.pagination import Pagination
|
from mediagoblin.tools.pagination import Pagination
|
||||||
@ -80,6 +81,17 @@ def atom_feed(request):
|
|||||||
link = request.urlgen('index', qualified=True)
|
link = request.urlgen('index', qualified=True)
|
||||||
feed_title += "for all recent items"
|
feed_title += "for all recent items"
|
||||||
|
|
||||||
|
atomlinks = [
|
||||||
|
{'href': link,
|
||||||
|
'rel': 'alternate',
|
||||||
|
'type': 'text/html'}]
|
||||||
|
|
||||||
|
if mg_globals.app_config["push_urls"]:
|
||||||
|
for push_url in mg_globals.app_config["push_urls"]:
|
||||||
|
atomlinks.append({
|
||||||
|
'rel': 'hub',
|
||||||
|
'href': push_url})
|
||||||
|
|
||||||
cursor = cursor.order_by(MediaEntry.created.desc())
|
cursor = cursor.order_by(MediaEntry.created.desc())
|
||||||
cursor = cursor.limit(ATOM_DEFAULT_NR_OF_UPDATED_ITEMS)
|
cursor = cursor.limit(ATOM_DEFAULT_NR_OF_UPDATED_ITEMS)
|
||||||
|
|
||||||
@ -87,9 +99,8 @@ def atom_feed(request):
|
|||||||
feed_title,
|
feed_title,
|
||||||
feed_url=request.url,
|
feed_url=request.url,
|
||||||
id=link,
|
id=link,
|
||||||
links=[{'href': link,
|
links=atomlinks)
|
||||||
'rel': 'alternate',
|
|
||||||
'type': 'text/html'}])
|
|
||||||
for entry in cursor:
|
for entry in cursor:
|
||||||
feed.add(entry.get('title'),
|
feed.add(entry.get('title'),
|
||||||
entry.description_html,
|
entry.description_html,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user