Sure, I've never submitted a patch before, how do I do that?<br>
Jose<BR><BR><br>
<BLOCKQUOTE style="PADDING-LEFT: 8px; MARGIN-LEFT: 8px; BORDER-LEFT: blue 2px solid"><BR>-------- Original Message --------<BR>Subject: RE: [Webware-devel] __init__ context requirment<BR>From: "Geoffrey Talvola" <gtalvola@...: Mon, June 30, 2003 7:55 am<BR>To: "'jose@...'" <jose@...;, "webware-devel"<BR><webware-devel@...>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR>
<DIV><FONT face=Arial size=2><SPAN class=719455014-30062003>Could you submit this as a patch to Sourceforge?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=719455014-30062003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=719455014-30062003>Note that there is already similar code in ServletFactory that will add the __init__.py if necessary when importing a servlet. That apparently doesn't help you if you forgot to put the __init__.py into the main context directory because it tries to import all contexts right at the beginning. But, if you add subdirectories of your context directory, the __init__.py will be created in each subdirectory automatically the first time you access a servlet in that subdirectory.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=719455014-30062003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=719455014-30062003>- Geoff</SPAN></FONT></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> jose@... [mailto:jose@...> Sunday, June 29, 2003 5:56 PM<BR><B>To:</B> webware-devel<BR><B>Subject:</B> [Webware-devel] __init__ context requirment<BR><BR></FONT></DIV>Dear webware community <BR> <BR>a recent email by Lothar Scholz, points out an interesting question/problem which has bitten me at least a few times. when you make a new context, if you fortet to add the required __init__.py file to it the context will fail to load correctly. This can cause problems especially for folks new to webkit if they do not realise that a context is loaded like a standart python module. To correct this I added the folloing code my the addContext function in the application.py file:<BR> <BR>orginal code:<BR> def addContext(self, name, dir):<BR> if self._contexts.has_key(name):<BR> print 'WARNING: Overwriting context %s (=%s) with %s' % (<BR> repr(name), repr(self._contexts[name]), repr(dir))<BR> __contextInitialized = 1 # Assume already initialized.<BR> else:<BR> __contextInitialized = 0<BR> .....<BR> <BR>Modified code:<BR> def addContext(self, name, dir):<BR> # Code added by Jose<BR> # __init__ check file code<BR> # this code will check for the __init__ file and add it if necessary<BR> if not os.path.exists(os.path.join(dir, '__init__.py')):<BR> # __init__.py file is missing creat it<BR> print '__init__ file is missing, creating __init__ file now'<BR> init = file(os.path.join(dir, '__init__.py'), 'w')<BR> init.write('# Auto generated __init__ file\n')<BR> init.close()<BR> # end __init__ file check code<BR> # end Code added by Jose<BR> if self._contexts.has_key(name):<BR> print 'WARNING: Overwriting context %s (=%s) with %s' % (<BR> repr(name), repr(self._contexts[name]), repr(dir))<BR> __contextInitialized = 1 # Assume already initialized.<BR> else:<BR> __contextInitialized = 0<BR> ......<BR> <BR>Note that I am not doing anything special other then checking to see if the file is present proir to your loading the context, if it is present I do nothing, otherwise I make one with a single comment line in the file. I think its a nice feature to add as we move to 0.9<BR> <BR>Jose<BR>------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Webware-devel mailing list Webware-devel@... https://lists.sourceforge.net/lists/listinfo/webware-devel</BLOCKQUOTE></BLOCKQUOTE>
|