[albatross-users] Patch to albatross app.py

VanL vlindberg at verio.net
Tue Apr 22 03:50:02 EST 2003


Hello,

Sorry, I forgot one part of it. (Pasted from an older version).  Here is
the full fix:

        page = self.__cache.get(path)
        if page: pageexists = os.path.exists(page.__file__)
        else: pageexists = 0
        if page and pageexists:
            mtime = os.stat(page.__file__)[stat.ST_MTIME]
            if mtime > page.__mtime__:
                reload(page)
                page.__mtime__ = mtime
        if not page or not pageexists:
            dirname, name = os.path.split(path)




VanL wrote:

> Hello,
>
> Just started using albatross.
> In app.py:
>
> If you delete the .pyc file in a Modular App, you get the following 
> error:
> Template traceback (most recent call last):
>
> Traceback (most recent call last):
>   File "/usr/local/webmanager/pylib/albatross/app.py", line 143, in run
>     self.load_page(ctx)
>   File "/usr/local/webmanager/pylib/albatross/app.py", line 252, in 
> load_page
>     ctx.set_page(name)
>   File "/usr/local/webmanager/pylib/albatross/app.py", line 86, in 
> set_page
>     self.app.load_page(self)
>   File "/usr/local/webmanager/pylib/albatross/app.py", line 253, in 
> load_page
>     self.load_page_module(ctx, name)
>   File "/usr/local/webmanager/pylib/albatross/app.py", line 262, in 
> load_page_module
>     mtime = os.stat(page.__file__)[stat.ST_MTIME]
> OSError: [Errno 2] No such file or directory: 
> '/www/htdocs/albatross/testing/Test.pyc'
>
> In this case, Test.py was replaced by test.py.
>
> To fix this, change line 260-268 of app.py from
>
>         page = self.__cache.get(path)
>         if page:
>             mtime = os.stat(page.__file__)[stat.ST_MTIME]
>             if mtime > page.__mtime__:
>                 reload(page)
>                 page.__mtime__ = mtime
>         if not page:
>             dirname, name = os.path.split(path)
>
> to
>
>         page = self.__cache.get(path)
>         pageexists = os.path.exists(page)
>         if page and pageexists:
>             mtime = os.stat(page.__file__)[stat.ST_MTIME]
>             if mtime > page.__mtime__:
>                 reload(page)
>                 page.__mtime__ = mtime
>         if not page or not pageexists:
>             dirname, name = os.path.split(path)
>
>
>
> Thanks,
>
> VanL
>
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users







More information about the Albatross-users mailing list