[Grok-dev] Neanderthal II possible sprint topics

Tim Cook timothywayne.cook at gmail.com
Fri Sep 11 08:34:18 EDT 2009


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 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20090911/cbe33f35/attachment.bin 


More information about the Grok-dev mailing list