-
Notifications
You must be signed in to change notification settings - Fork 312
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
Fix bug in LektorInfo.resolve_artifact (fix #16) #136
Conversation
lektor.admin.webui.resolve_artifact must need path param. But if given path is pagination dir, older method return None and cause 404. My patch make to test filename for checking its type. If it is dir, method find index file in it and resolve it.
I'm a bit confused why this is necessary but I will check this in detail. Pretty sure this should resolve the filename from the main path and not the fallback. |
from #16
I generated I checked |
|
I'm confused. Why would that not be able to resolve the URL path? It has a branch to support pagination. |
>>> from lektor.project import Project
>>> project = Project.discover()
>>> env = project.make_env()
>>> pad = env.new_pad()
>>> pad.root
<Page model=u'blog' path='/'>
>>> pad.root.children
<Query '/' alt='_primary'>
>>> pad.root.children.all()
[<Page model=u'blog-post' path=u'/2016-01-29-Thinking-In-Company-Framework'>, <Page model=u'blog-post' path=u'/2016-01-26-Homepage-101'>, <Page model=u'blog-post' path=u'/2015-12-23-Move-to-Lektor'>, <Page model=u'blog-post' path=u'/2015-12-19-Naver-and-HTTPS'>, <Page model=u'blog-post' path=u'/2015-12-15-My-New-Otaku-Blog'>, <Page model=u'blog-post' path=u'/2015-12-13-Ichimatsu-no-Hide-and-Seek'>, <Page model=u'blog-post' path=u'/2015-12-12-Time-Machine-For-CS-Part-3'>, <Page model=u'blog-post' path=u'/2015-11-21-Arguments-of-setuptools.setup'>, <Page model=u'blog-post' path=u'/2015-11-13-Time-Machine-For-CS-Part-2'>, <Page model=u'blog-post' path=u'/2015-11-02-Time-Machine-For-CS-Part-1'>, <Page model=u'blog-post' path=u'/2015-10-30-A-Short-Postscript-about-Using-PHP-7.0rc6'>, <Page model=u'blog-post' path=u'/2015-10-26-Understanding-Python-__getitem__-and-slice'>, <Page model=u'blog-post' path=u'/2015-10-24-Story-of-Developing-Front-End-Nowaday'>, <Page model=u'blog-post' path=u'/2015-10-21-Install-TT-RSS-on-Ubuntu-15.04'>, <Page model=u'blog-post' path=u'/2015-10-13-Misunderstanding-about-Mental-Health'>, <Page model=u'blog-post' path=u'/2015-10-12-How-to-Become-a-Great-JavaScript-Developer'>, <Page model=u'blog-post' path=u'/2015-10-10-International-Aheui-Developer-Conf'>, <Page model=u'blog-post' path=u'/2015-10-08-An-Advice-About-Mildly-Better-Way-to-Write-a-Cover-Letter'>, <Page model=u'blog-post' path=u'/2015-09-29-Make-ELB-And-Apply-SSL(HTTPS)'>, <Page model=u'blog-post' path=u'/2015-09-28-Find-Password-Slowly-If-You-Lost-Password-of-RAR-File'>, <Page model=u'blog-post' path=u'/2015-09-24-I-Do-Not-Read-Your-Facebook-Post'>, <Page model=u'blog-post' path=u'/2015-09-15-Defend-Software-Maestro'>, <Page model=u'blog-post' path=u'/2015-08-31-Closers-House-Keeper-Costume-Simulator'>, <Page model=u'blog-post' path=u'/2015-08-20-Looking-for-a-Job'>, <Page model=u'blog-post' path=u'/2015-08-20-There-is-NO-Seperation-Productive-Hobby-Comsuming-Hobby'>, <Page model=u'blog-post' path=u'/2015-08-20-Come-Back-to-My-World'>, <Page model=u'blog-post' path=u'/2015-07-29-Windows-Update-Sucks'>, <Page model=u'blog-post' path=u'/2015-07-27-Successful-Yak-Shaving-Unsuccessful-Yak-Shaving'>, <Page model=u'blog-post' path=u'/2015-07-24-Extension-of-Basical-Data-Type'>, <Page model=u'blog-post' path=u'/2015-07-22-Do-Not-Brew-Language-Installing-Language-by-Homebrew-Is-NOT-Clean'>, <Page model=u'blog-post' path=u'/2015-07-20-Python-AST-101'>, <Page model=u'blog-post' path=u'/2015-07-18-Some-Ambiguousness-in-Python-Tutorial-Call-by-What'>, <Page model=u'blog-post' path=u'/2015-07-16-Library-Idea-Emaillib'>, <Page model=u'blog-post' path=u'/2015-07-14-The-Syntax-Highlighter-of-Jekyll-with-GitHub-Pages'>, <Page model=u'blog-post' path=u'/2015-07-11-I18n-of-JS-The-Right-Way'>, <Page model=u'blog-post' path=u'/2015-07-09-Creating-Custom-AES-Functions-for-SQLAlchemy'>, <Page model=u'blog-post' path=u'/2015-07-07-What-is-the-PKCS-algorithm-version-of-PostgreSQL'>, <Page model=u'blog-post' path=u'/2015-07-05-Internal-of-sqlalchemy.sql.expression.func'>, <Page model=u'blog-post' path=u'/2015-07-05-Cute-Polar-Bear'>] I can't find pagination page in root.children |
I see. In that case the code for pagination lookup is broken for the root case and should be fixed. I will investigate this. |
BTW. Pagination is not supposed to be in root.children. It's only supposed to show up via |
information in my env >>> pad.root.supports_pagination
True
>>> pad.root.pagination
<lektor.pagination.Pagination object at 0x10e728410>
>>> pad.root.pagination.pages
8 |
@item4 can you check if my commit fixes the problem? |
@mitsuhiko It works fine. 👍 |
lektor.admin.webui.resolve_artifact must need path param.
But if given path is pagination dir, older method return None and cause 404.
My patch make to test filename for checking its type. If it is dir, method find index file in it and resolve it.