Skip to content

Commit

Permalink
Deactivate exists checks for page trail and do not show non-existent …
Browse files Browse the repository at this point in the history
…items
  • Loading branch information
UlrichB22 committed Oct 18, 2024
1 parent 467ae73 commit 622ffb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/moin/apps/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
from moin import user
from moin.constants.keys import * # noqa
from moin.constants.namespaces import * # noqa
from moin.constants.itemtypes import ITEMTYPE_DEFAULT, ITEMTYPE_TICKET
from moin.constants.itemtypes import ITEMTYPE_DEFAULT, ITEMTYPE_TICKET, ITEMTYPE_NONEXISTENT
from moin.constants.contenttypes import * # noqa
from moin.constants.rights import SUPERUSER
from moin.constants.misc import FLASH_REPEAT
Expand Down Expand Up @@ -524,14 +524,14 @@ def add_presenter(wrapped, view, add_trail=False, abort404=True):
@frontend.route(f"/+{view}/<itemname:item_name>", defaults=dict(rev=CURRENT))
@wraps(wrapped)
def wrapper(item_name, rev):
if add_trail:
flaskg.user.add_trail(item_name)
try:
item = Item.create(item_name, rev_id=rev)
except AccessDenied:
abort(403)
if abort404 and isinstance(item, NonExistent):
abort(404, item_name)
if add_trail:
flaskg.user.add_trail(item_name)
return wrapped(item)

return wrapper
Expand Down Expand Up @@ -588,7 +588,8 @@ def show_item(item_name, rev):
return redirect(url_for_item(fqname))
try:
item = Item.create(item_name, rev_id=rev)
flaskg.user.add_trail(item_name)
if item.itemtype != ITEMTYPE_NONEXISTENT:
flaskg.user.add_trail(item_name)
item_is_deleted = flash_if_item_deleted(item_name, rev, item)
item_may = get_item_permissions(fqname, item)
result = item.do_show(rev, item_is_deleted=item_is_deleted, item_may=item_may)
Expand Down
7 changes: 2 additions & 5 deletions src/moin/themes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def location_breadcrumbs(self, fqname):
current_item += segment
fq_current = CompositeName(namespace, NAME_EXACT, current_item)
fq_segment = CompositeName(segment1_namespace, NAME_EXACT, segment)
breadcrumbs.append((fq_segment, fq_current, bool(self.storage.get_item(**fq_current.query))))
breadcrumbs.append((fq_segment, fq_current, True))
current_item += "/"
segment1_namespace = ""
return breadcrumbs
Expand All @@ -370,12 +370,9 @@ def path_breadcrumbs(self):
err = not is_known_wiki(wiki_name)
href = url_for_item(wiki_name=wiki_name, **fqname.split)
if is_local_wiki(wiki_name):
exists = bool(self.storage.get_item(**fqname.query))
wiki_name = "" # means "this wiki" for the theme code
else:
exists = True # we can't detect existance of remote items
if item_name:
breadcrumbs.append((wiki_name, fqname, href, exists, err))
breadcrumbs.append((wiki_name, fqname, href, True, err))
return breadcrumbs

def userhome(self):
Expand Down

0 comments on commit 622ffb1

Please sign in to comment.