your sitemap_xml is not a structure (list of dict, list of list, etc.)
it is the actual xml as a string. You just replace the last line:
return dict(sitemap_xml=sitemap_xml)
with
return sitemap_xml
On Dec 23, 10:06 am, Leandro - ProfessionalIT <[email protected]>
wrote:
> On Dec 23, 1:50 pm, mdipierro <[email protected]> wrote:
>
> > I need to see the actual code.
>
> Master, follow my dummie code:
>
> def sitemap():
> import os
> from gluon.myregex import regex_expose
>
> # Statics URLs
> ctldir = os.path.join(request.folder,"controllers")
> ctls=os.listdir(ctldir)
> if 'appadmin.py' in ctls: ctls.remove('appadmin.py')
> if 'manage.py' in ctls: ctls.remove('manage.py')
> sitemap_xml = '<?xml version="1.0" encoding="UTF-8"?>\n'
> sitemap_xml +='<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/
> 0.9">\n'
> for ctl in ctls:
> if ctl.endswith(".bak") == False:
> filename = os.path.join(ctldir,ctl)
> data = open(filename, 'r').read()
> functions = regex_expose.findall(data)
> ctl = ctl[:-3].replace("_"," ")
> for f in functions:
> sitemap_xml += '<url>\n<loc>' +
> 'http://www.leandro.inf.br/'+
> request.application + '/' + ctl + '/' + f.replace("_"," ") + '</loc>
> \n</url>\n'
>
> # Dynamic URLs
> posts = db().select(db.posts.ALL, orderby=~db.posts.created)
> for item in posts:
> sitemap_xml += '<url>\n<loc>' + 'http://www.leandro.inf.br/'+
> request.application + '/' + 'default/post' + '/' + item.slug + '</loc>
> \n</url>\n'
> sitemap_xml +='</urlset>'
> return dict(sitemap_xml=sitemap_xml)
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en.