Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1476 apps feed views #1477

Merged
merged 3 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/moin/apps/feed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

from moin.i18n import _
from moin.apps.feed import feed
from moin.constants.keys import NAME, NAME_EXACT, WIKINAME, COMMENT, MTIME, REVID, ALL_REVS, PARENTID, LATEST_REVS
from moin.constants.keys import (NAME, NAME_EXACT, NAMESPACE, WIKINAME, COMMENT, MTIME, REVID,
ALL_REVS, PARENTID, LATEST_REVS)
from moin.themes import get_editor_info, render_template
from moin.items import Item
from moin.utils.crypto import cache_key
from moin.utils.interwiki import url_for_item
from moin.utils.interwiki import url_for_item, split_fqname

from moin import log
logging = log.getLogger(__name__)
Expand All @@ -44,7 +45,8 @@ def atom(item_name):
'''
query = Term(WIKINAME, app.cfg.interwikiname)
if item_name:
query = And([query, Term(NAME_EXACT, item_name), ])
fqname = split_fqname(item_name)
query = And([query, Term(NAME_EXACT, fqname.value), Term(NAMESPACE, fqname.namespace), ])
revs = list(flaskg.storage.search(query, idx_name=LATEST_REVS, sortedby=[MTIME], reverse=True, limit=1))
if revs:
rev = revs[0]
Expand All @@ -57,15 +59,15 @@ def atom(item_name):
if not item_name:
title = "{0}".format(app.cfg.sitename)
else:
title = "{0} - {1}".format(app.cfg.sitename, item_name)
title = "{0} - {1}".format(app.cfg.sitename, fqname)
feed = FeedGenerator()
feed.id(request.url)
feed.title(title)
feed.link(href=request.host_url)
feed.link(href=request.url, rel='self')
query = Term(WIKINAME, app.cfg.interwikiname)
if item_name:
query = And([query, Term(NAME_EXACT, item_name), ])
query = And([query, Term(NAME_EXACT, fqname.value), Term(NAMESPACE, fqname.namespace), ])
history = flaskg.storage.search(query, idx_name=ALL_REVS, sortedby=[MTIME], reverse=True, limit=100)
for rev in history:
name = rev.fqname.fullname
Expand All @@ -86,7 +88,7 @@ def atom(item_name):
content = render_template('atom.html', get='first_revision', rev=this_rev,
content=Markup(hl_item.content._render_data()), revision=this_revid)
except Exception:
logging.exception("content rendering crashed")
logging.exception("content rendering crashed on item {0}".format(name))
content = _('MoinMoin feels unhappy.')
author = get_editor_info(rev.meta, external=True)
rev_comment = rev.meta.get(COMMENT, '')
Expand Down
13 changes: 12 additions & 1 deletion src/moin/help/welcome/users-Home.data
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
users/Home page
= users/Home =

Use this namespace to create your user home page using the namespace and your
login name as the page name. Example: `users/JoeDoe`

If you are logged in when you create/edit any page
there will be a link to your home page near the bottom in the item credits.

You are encouraged to fill your home page with any information about yourself
that you are willing to share with other wiki users. If the wiki admin wants
to encourage some consistency among user home pages there will be a template
offered in the page creation dialog.
13 changes: 7 additions & 6 deletions src/moin/help/welcome/users-Home.meta
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
"address": "127.0.0.1",
"comment": "",
"contenttype": "text/x.moin.wiki;charset=utf-8",
"dataid": "553bd9f91b034a7eaa25b04c31ea40d2",
"dataid": "9c043f2b971b4df4acd0b488df64bd76",
"externallinks": [],
"itemid": "39190076bdde4314a5f4d857f998a2f9",
"itemlinks": [],
"itemtransclusions": [],
"itemtype": "default",
"mtime": 1679755014,
"mtime": 1689193990,
"name": [
"Home"
],
"name_old": [],
"namespace": "users",
"parentid": "420f034d049543eaa74fe35441264a66",
"rev_number": 1,
"revid": "67c2df0ce15c44b5903c0d9502ee7fe8",
"sha1": "ea505479709bda469782e7a75809223dcfde7e10",
"size": 15,
"revid": "5df874c84981428d9f58072011e97438",
"sha1": "7988eff17ca08ba85fbb8219911a3ad9a7523cd8",
"size": 558,
"summary": "",
"tags": [],
"wikiname": "MyMoinMoin"
}
}
Loading