Re: Patch for simple walk caching
Jesse Lawrence <lawrence_jesse-FFYn/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
Roberto De Almeida wrote:
>Hi, Will.
>
>I'm using static rendering on my weblog, and it works fine (as in "no
>errors"). I created a "build(url)" method that renders a given URL
>when necessary; my pyblosxom.cgi script is also hacked to build the
>pages when a 404 is given, so that, effectively, static pages are
>built only when requested.
>
>The method is described here:
>
> http://dealmeida.net/en/colophon.html
>
>Roberto
>
>
>
Hi Roberto,
I adjusted your pyblosxom.cgi a bit, so it can handle cases where you
blog is contained in a subdirectory of you server's DocumentRoot. ex:
http://yourdomain/blog/index.html
Here is is:
if not os.environ.get("REQUEST_METHOD", ""):
if len(sys.argv) > 1 and sys.argv[1] == "--static":
if "--incremental" in sys.argv:
incremental = 1
else:
incremental = 0
p = PyBlosxom(req)
p.runStaticRenderer(incremental)
else:
test_installation(req)
# Add this part.
elif os.environ.get('REQUEST_URI', '') and
os.environ.get('REDIRECT_STATUS', '') == '404':
url = os.environ['REQUEST_URI']
# We need to join config['base_url'] and 'PATH_INFO', then remove
'base_url'.
import urlparse
url = urlparse.urljoin("http://"+d["HTTP_HOST"], url)
url = url.replace(config.py['base_url'], '')
d["PATH_INFO"] = url
req.addHttp(d)
p = PyBlosxom(req)
p.build(url)
p.run()
else:
p = PyBlosxom(req)
p.run()
Jesse Lawrence
>On Tue, 7 Dec 2004 12:19:25 -0600 (CST), will guaraldi
><[email protected]> wrote:
>
>
>>On Tue, 7 Dec 2004, Bill Mill wrote:
>>
>>
>>>>I'd rather re-factor what we have than patch the core with what you're
>>>>doing now.
>>>>
>>>>
>>>You're the boss; the nice thing about what I've done is that Ted can
>>>drop it into his site and get a nice speedup, and it should work with
>>>what he's got installed already.
>>>
>>>In the future, I agree that we should refactor everything to use what
>>>you've done. If we can get it to work well, it'll be much more elegant
>>>than what I have done. I still see problems, for example, in getting the
>>>correct comment count with update_static_entry. How do you determine
>>>accurately which files need it? For example, all the /keyword/*.html
>>>files would need to be updated on my blog.
>>>
>>>With my changes, you don't need to worry about that, because the
>>>comments plugin still handles counting the comments in cb_prepare.
>>>
>>>
>>Well, I don't know about being the boss. My use cases are definitely not
>>comprehensive enough for me to assume that I know where pyblosxom should
>>go.
>>
>>Going back a bit, I said that the static rendering was half-assed. One of
>>the reasons I said that was the update_static_entry stuff wasn't
>>integrated into anything that would need it. Additionally, it may not
>>even work as it might have edge cases that are not desirable.
>>
>>For example, as you note, it doesn't really work with the way you use
>>pyblosxom.
>>
>>One of the goals for refactoring was to add the ability to do index
>>caching which is very much like your file list caching except I want to
>>add to that caching of filestat and other meta data. Though I'm not
>>really sure how that works yet.
>>
>>I think that'd join nicely with the things you're doing right now.
>>
>>
>>
>>
>>>The difference is that most plugins will still run normally. Only the
>>>few plugins which use fileinfo or pathinfo would need to be changed;
>>>comments and trackback, among others, should remain unaffected.
>>>
>>>
>>I see where you're coming from now. Yeah, static rendering is good for
>>some things, but would be a total pain in the ass for others. I'm not
>>even sure it really works well except for simpler blogs that don't have
>>much interaction.
>>
>>/will
>>
>>
>>
>>
>>-------------------------------------------------------
>>SF email is sponsored by - The IT Product Guide
>>Read honest & candid reviews on hundreds of IT Products from real users.
>>Discover which products truly live up to the hype. Start reading now.
>>http://productguide.itmanagersjournal.com/
>>_______________________________________________
>>Pyblosxom-devel mailing list
>>Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>>https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
>>
>>
>>
>
>
>
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/