Thank you for considering it Douglas. Kind regards, - Yarko On Mon, May 4, 2009 at 4:21 AM, Douglas Soares de Andrade < [email protected]> wrote:
> > Em Segunda-feira 04 Maio 2009, às 03:49:15, Yarko Tymciurak escreveu: > > I am concerned about two things: > > --- this code change is introduced in a lot of places, e.g. same code > > replicated... > > --- the way the code is, it will always run (which is unnecessary, except > > for first time in an app, and even then only in downloaded from hg apps, > as > > once welcome contains these dirs, they will be propogated) > > > > > === modified file 'gluon/cache.py' > > > --- gluon/cache.py 2009-04-27 05:33:09 +0000 > > > +++ gluon/cache.py 2009-05-04 02:00:53 +0000 > > > @@ -92,6 +92,14 @@ > > > > > > def __init__(self, request): > > > self.request = request > > > + > > > + # Lets test if the cache folder exists, if not > > > + # we are going to create it > > > + folder = os.path.join(request.folder, 'cache') > > > + > > > > # I suggest replace the following lines: > > > + if not os.path.exists(folder): > > > + os.mkdir(folder) > > > + > > > self.locker = open(os.path.join(request.folder, > > > 'cache/cache.lock'), 'a') > > > > with something like: > > > > self.locker = must_open(os.path.join(request.folder, > > 'cache/cache.lock'),'a') > > > > Where somewhere convenient, something like this is placed: > > > > def must_open( path, *args ): > > try: > > f = open( path, *args ) > > except IOError, e: > > dir = path.rsplit( '/', 1)[0] > > if (e.errno == 2) & (not os.path.exists( dir )): > > os.mkdir( dir ) > > f = open( path, *args) > > return f > > > > > > This will encapsulate the change, and make it a utility available to > > applications; (to be useful to applications, perhaps os.mkdirs() could > be > > used). > > > > - Yarko > > Hum, yes, i can move this to the utils module. I will make an update soon. > > Thanks Yarko > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

