I have not changed start-project.py as it's pretty much the default
code.
Elvelind Grandin wrote:
> Could you share any of your code? Your root controller for example.
> and if you have changed start-project.py
root controller has all my incomplete functions :). please bear with
it.
I am pasting the controller code here.

from turbogears import controllers
import model

class Root(controllers.Root):
    from catwalk import CatWalk
    catwalk = CatWalk()

    @turbogears.expose(html="lexwiki.templates.addEntry")
    def addEntry(self,alphaname):
        return(dict(alphaname=alphaname))

    @turbogears.expose()
    def getAllAlpha(self):
        alphas = [alpha.alphaname for alpha in
            model.Alpha.select(orderBy=model.Alpha.q.alphaname)]
        return dict(alphas=alphas)
    @turbogears.expose(html="lexwiki.templates.getAlpha")
    def getAlpha(self,alphaname='A'):
        curAlpha=model.Alpha.byAlphaname(alphaname)
        return self.getEntriesFromAlpha(curAlpha)

    @turbogears.expose(html='lexwiki.templates.Frontpage')
    def index(self):
        alphas = [alpha.alphaname for alpha in
           model.Alpha.select().orderBy(model.Alpha.q.alphaname)]
        #return dict()
        import time
        return dict(now=time.ctime(),alphas=alphas)
    @turbogears.expose(html="lexwiki.templates.getAlpha")
    def saveEntry(self,alphaname,data):
        from datetime import datetime
        curAlpha=model.Alpha.byAlphaname(alphaname)

model.Entries(alpha=curAlpha,data=data,timestamp=datetime.now())
        return self.getEntriesFromAlpha(curAlpha)
    @turbogears.expose(html="lexwiki.templates.showEntry")
    def showEntry(self,id):
        curEntry=model.Entries.get(id)
        return dict(data=curEntry.data,timestamp=curEntry.timestamp)
    def getEntriesFromAlpha(self,alpha):
        entrylist=alpha.entries
        retlist=[]
        for entry in entrylist:

retlist.append(dict(data=entry.data,time=entry.timestamp,id=entry.id))
        return dict(entries=retlist,alphaname=alpha.alphaname)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to