chore: update types + minor fixes

This commit is contained in:
relikd
2022-11-22 10:51:28 +01:00
parent b75102a211
commit e7ae59fadf
11 changed files with 46 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
from lektor.db import Record # isinstance
from lektor.db import Page # isinstance
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Iterable
from .util import build_url
from .vobj import VPATH, GroupBySource
@@ -60,7 +60,7 @@ class Resolver:
def resolve_server_path(self, node: 'SourceObject', pieces: List[str]) \
-> Optional[GroupBySource]:
''' Local server only: resolve /tag/rss/ -> /tag/rss/index.html '''
if isinstance(node, Record):
if isinstance(node, Page):
rv = self._data.get(build_url([node.url_path] + pieces))
if rv:
return GroupBySource(
@@ -70,7 +70,7 @@ class Resolver:
def resolve_virtual_path(self, node: 'SourceObject', pieces: List[str]) \
-> Optional[GroupBySource]:
''' Admin UI only: Prevent server error and null-redirect. '''
if isinstance(node, Record) and len(pieces) >= 2:
if isinstance(node, Page) and len(pieces) >= 2:
path = node['_path'] # type: str
attr, grp, *optional_page = pieces
page = None