[Cubicweb] demote_to_html and main_stream

Carlos Balderas carlos.balderas at gmail.com
Fri Apr 1 05:49:46 CEST 2011


Hi,

I'd like to know if someone can give me a clue of how to solve this error:

ERROR: an exception occurred while calling js_update_events_calendar([]):
'CubicWebTwistedRequestAdapter' object has no attribute 'main_stream'

The view CalendarEvent in web/views/calendar.py uses the method
"demote_to_html" which is needed to let fullcalendar jquery plugin to work
in this view.

The demote_to_html method sets main_stream like this:
self.main_stream.doctype = TRANSITIONAL_DOCTYPE_NOEXT

In my application I'd like to use ajax to load events like this:

(calling my js file with the js right function)

then ...

@monkeypatch(JSonController)
@xhtmlize
def js_update_events_calendar(self):
    .....
    ......
    return self.view(mydemotedtohtmlview, rset, 'null')


But I got the error above, about main_stream.

My first question is about the missing "main_stream" attribute, I am not
sure why that is, as far as I see It is just about assign another type of
value. e.i.
TRANSITIONAL_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">\n'

My second question is about the use of @xhtmlize decorator, since the view
I'd like to use uses "demote_to_html" looks like I don't really know what I
am doing.. =S , so, Is it necesary to use @xhtmlize decorator to return the
html code by this cubicweb/ajax method?

Thank you very much
Regards
Carlos Balderas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20110331/9fd9a9e2/attachment-0126.html>


More information about the Cubicweb mailing list