[Grok-dev] Neanderthal II possible sprint topics

Sebastian Ware sebastian at urbantalk.se
Sat Sep 12 05:12:35 EDT 2009


It's registering LocalUtilities that I would like to understand. Right  
now I have to recreate the application and export/import objects when  
I want to add indexes.

Mvh Sebastian

On 11 sep 2009, at 14.34, Tim Cook wrote:

> On Fri, 2009-09-11 at 12:33 +0200, Sebastian Ware wrote:
>> Sample code or automatic adding of local utilities to an exisiting  
>> app
>> would be great. Especially for the usecase of adding new catalogs and
>> indexes.
>
> I'm not sure if this is what you are looking for but I do some setup  
> in Index when the application is created.
> Not catalogs/Indexes (yet) using a render() method and then  
> redirecting (I know it's hard coded right now) to a management page.
> Needs work but it's a start.  Is this what you are looking for?
>
> class Index(grok.View):
>    grok.context(oship)
>
>    # Create the containers and initial python source templates for  
> the archetypes
>    def render(self):
>        logfile=os.getcwd()+'/parts/log/pyfile_build.log'
>        #create the logfile if it doesn't exist
>        f=open(logfile,'w')
>        f.write("Python source file log.\n\n")
>
>        logging.basicConfig(level=logging.INFO,
>                            format='%(asctime)s %(levelname)s % 
> (message)s',
>                            filename=f,
>                            filemode='w')
>
>
>        try:
>            self.context['termserver'] = grok.Container() #  
> terminology server
>            self.context['aql'] = grok.Container() # AQL repository
>        except DuplicationError:
>            pass
>
>        print "\n\n\n********* Begin creating Python files. ********* 
> \n"
>
>        CreatePy()
>
>        print "\n\n Finished creating Python source files.\n"
>
>        self.redirect("http://localhost:8080/oship/oshipmanage") #  
> now simply redirect to the main page
>
>
>
>
>>
>> ***************************************************************
>> Timothy Cook, MSc
>>
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> Skype ID == (upon request)
>> Academic.Edu Profile: http://uff.academia.edu/TimothyCook
>>
>> You may get my Public GPG key from  popular keyservers or
>> from this link http://timothywayne.cook.googlepages.com/home
>>



More information about the Grok-dev mailing list