awesome now it works, I had to wrap some vars with str() and booom

@service.rss
def showLatest():
    shopnames = db().select(db.shopname.ALL,limitby=(0,20))
    return dict(
            title=str(response.title),
            link=URL(request.application,'default','call',args=
['rss','showLatest']),
            description=str(response.description),
            created_on=request.now,
            entries=[
                dict(title=i.name,
                    link = URL(request.application,
'default','show',args=[i.id]),
                    description = '%s added %s on %s'%(db.auth_user
[i.posted_by].first_name,i.name,i.posted_on),
                    created_on = str(i.posted_on)) for i in
shopnames])

insteresting is that i had to do
created_on = str(i.posted_on) in the entries array
but
created_on=request.now in the main description worked just fine

Thank you soooo much

On Oct 28, 4:10 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> One of your variables (response.description, response.title, ..?) is a
> T(....), it should be a str(T(....)) else it cannot be serialized in
> XML.
>
> On Oct 28, 9:28 am, selecta <gr...@delarue-berlin.de> wrote:
>
>
>
> > i created a rss service with adding the following to the default
> > controller
>
> > @service.rss
> > def showLatest():
> >     shopnames = db().select(db.shopname.ALL,limitby=(0,20))
> >     return dict(
> >             title=response.title,
> >             link=URL(request.application,'default','call',args=
> > ['rss','showLatest']),
> >             description=response.description,
> >             created_on=request.now,
> >             entries=[
> >                 dict(title=i.name,
> >                     link = URL(request.application,
> > 'default','show',args=[i.id]),
> >                     description = '%s added %s on %s'%(db.auth_user
> > [i.posted_by].first_name,i.name,i.posted_on),
> >                     created_on = i.posted_on) for i in shopnames])
>
> > but when I try to 
> > callhttp://127.0.0.1:8000/frisur/default/call/rss/showLatest
> > i get
>
> > Traceback (most recent call last):
> >   File "/home/me/Dev/web2py/gluon/restricted.py", line 184, in
> > restricted
> >     exec ccode in environment
> >   File "/home/me/Dev/web2py/applications/frisur/controllers/
> > default.py", line 113, in <module>
> >   File "/home/me/Dev/web2py/gluon/globals.py", line 102, in <lambda>
> >     self._caller = lambda f: f()
> >   File "/home/me/Dev/web2py/applications/frisur/controllers/
> > default.py", line 111, in call
> >     return service()
> >   File "/home/me/Dev/web2py/gluon/tools.py", line 2416, in __call__
> >     return self.serve_rss(request.args[1:])
> >   File "/home/me/Dev/web2py/gluon/tools.py", line 2297, in serve_rss
> >     return serializers.rss(feed)
> >   File "/home/me/Dev/web2py/gluon/serializers.py", line 52, in rss
> >     return rss2.dumps(rss)
> >   File "/home/me/Dev/web2py/gluon/contrib/rss2.py", line 571, in dumps
> >     rss.write_xml(s)
> >   File "/home/me/Dev/web2py/gluon/contrib/rss2.py", line 24, in
> > write_xml
> >     self.publish(handler)
> >   File "/home/me/Dev/web2py/gluon/contrib/rss2.py", line 433, in
> > publish
> >     _element(handler, 'title', self.title)
> >   File "/home/me/Dev/web2py/gluon/contrib/rss2.py", line 56, in
> > _element
> >     obj.publish(handler)
> > AttributeError: 'lazyT' object has no attribute 'publish'
>
> > did I do something wrong or is this a bug?
> > callinghttp://127.0.0.1:8000/frisur/default/showLatestworksjust
> > fine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to