Hi Massimo,

Thanks for your reply.

Somewhere else in your logic you are changing this.
>

I've gone through my applications logic, session[id] is being created in a 
router function:

def router():
    if not len(request.args):
        redirect(URL('addressbook','index'))
    else:
        id=request.args(0)
        
account=db(db.nodeAccount.nodeID==id).select(db.nodeAccount.ALL).first()
        if account:
            if account.accountID==BASICACCOUNTID:
                redirect(URL('vcard',args=id))
            elif account.accountID==ADVANCEDACCOUNTID:
                if not session[id]:
                    session[id]=Storage(id=id)
                    session[id].accountID=ADVANCEDACCOUNTID
                    session[id].pluralID=account.pluralID
                redirect(URL('site','index',args=id))
            elif account.accountID==BASICHUBACCOUNTID:
                redirect(URL('vhub',args=id))
            elif account.accountID==ADVANCEDHUBACCOUNTID:
                if not session[id]:
                    session[id]=Storage(id=id)
                    session[id].accountID=ADVANCEDHUBACCOUNTID
                    session[id].pluralID=account.pluralID
                redirect(URL('hub','index',args=id))
        else:
            redirect(URL('card',args=id))
        return None
 
It''s attributes are given a value in site.py's index function:

def index():
    if not session[request.args(0)]:
        redirect(URL('addressbook','router',args=request.args(0)))
    elif not session[request.args(0)].accountID==ADVANCEDACCOUNTID:
        redirect(URL('addressbook','router',args=request.args(0)))
    else:
        if not session[id].node:
            session[id].node=retrieve_node(id,db)
        if not session[id].sitenav:
            session[id].site_menu=[]
            
sitenav=db((db.nodeNav.nodeID==id)&(db.nodeNav.frontend==True)&(db.nodeNav.navID==db.nav.id)&\
            
(db.nav.navbarID==SITENAVBARID)).select(db.nav.ALL,db.nodeNav.ALL,orderby=db.nav.insequence)
            if sitenav:
                
session[id].herotext=session[id].hero=session[id].theme=session[id].customtheme=None
                
session[id].homepage=session[id].promounit=session[id].relatednames=session[id].socialmedia=\
                
session[id].googlemaps=session[id].container=session[id].navbarfixedtop=False
                session[id].sitenav=True
                for s in sitenav:
                    if s.nav.id==HOMENAVID:
                        
session[id].site_menu.append([T(s.nav.name),False,URL(s.nav.frontendcontroller,s.nav.function,args=id)])
                    elif s.nav.id==HEROTEXTNAVID:
                        
session[id].herotext=db(db.heroUnitText.nodeID==id).select(db.heroUnitText.nodeID,db.heroUnitText.h1,\
                        
db.heroUnitText.h1,db.heroUnitText.p,db.heroUnitText.pColor,db.heroUnitText.btn,\
                        
db.heroUnitText.btnUrl,db.heroUnitText.btnColor).first()
                    elif s.nav.id==HEROFILENAVID:
                        
session[id].hero=db(db.heroUnit.nodeID==id).select(db.heroUnit.nodeID,db.heroUnit.url,db.heroUnit.isLogo,\
                        db.heroUnit.isImage).first()
                    elif s.nav.id==HOMEPAGENAVID:
                        session[id].homepage=True
                    elif s.nav.id==PROMOUNITNAVID:
                        session[id].promounit=True
                    elif s.nav.id==RELATEDNAMESNAVID:
                        session[id].relatednames=True
                    elif s.nav.id==SOCIALMEDIANAVID:
                        session[id].socialmedia=True
                    elif s.nav.id==GOOGLEMAPSNAVID:
                        session[id].googlemaps=True
                    elif s.nav.id==THEMENAVID:
                        
theme=db((db.nodeTheme.nodeID==id)&(db.nodeTheme.themeID==db.theme.id)).select(db.theme.ALL).first()
                        if theme:
                            session[id].container=theme.container
                            session[id].navbarfixedtop=theme.navbarFixedTop
                            session[id].theme=theme
                    elif s.nav.id==CUSTOMTHEMENAVID:
                        
customtheme=db(db.customTheme.nodeID==id).select(db.customTheme.ALL).first()
                        if customtheme:
                            session[id].container=customtheme.container
                            
session[id].navbarfixedtop=customtheme.navbarFixedTop
                            session[id].customtheme=customtheme
        ...
        if session[id].homepage:
            
homepage=db((db.aboutText.nodeID==id)&(db.aboutText.aboutID==HOMEABOUTID)).select(db.aboutText.ALL).first()
            if not homepage:
                response.flash='Geen home page tekst beschikbaar'
                session.alert='alert-info'
        if session[id].promounit:
            promorows=retrieve_promoUnits(id,db,HOMEPAGEPROMOID)
        if session[id].node:
            response.title=session[id].node.computedName + ' - Index'
        return dict(homepage=homepage,promorows=promorows)

And in case the user resets function in the CMS this function is being 
executed:

@auth.requires_login()
def onaccept_functions(form):
    id=get_ID(auth,session)
    session[id].node=False:
    session[id].sitenav=False

Since this caused an error of the sort NoneType has no node, I changed 
onaccept_functions to:

@auth.requires_login()
def onaccept_functions(form):
    id=get_ID(auth,session)
    if session[id]:
        del session[id]

Hoping, that when refreshing the page site/index/5, the index function 
would redirect to the router function, create a new session[5] object etc. 
But it doesn't while session[5] still exists, although in the CMS, 
session[5] is None.

The only problem I can think of is that CMS and site/index/5 are opened in 
the same browser but in different windows. I this is the cause of the 
problem, is there a way to solve it?

Kind regards,

Annet.

-- 



Reply via email to