[Bugs] #2833 UNSP: add support for PDF export

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Sun May 29 05:38:45 EDT 2011


#2833: add support for PDF export
------------------------------------------+---------------------------------
    Reporter:  godiard                    |          Owner:  lucian                     
        Type:  enhancement                |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  Browse                     |        Version:  Git as of bugdate          
    Severity:  Unspecified                |       Keywords:                             
Distribution:                             |   Status_field:  New                        
------------------------------------------+---------------------------------
Changes (by sascha_silbe):

 * cc: sascha_silbe (added)


Comment:

 > Replying to [comment:4 sascha_silbe]:
 > > The problem is that {{{print}}} is a reserved keyword in Python 2.
 XPCOM would need to rename {{{print}}} to something else, e.g.
 {{{print_}}}. I'm not sure how feasible it is to get that fix rolled out
 to the distributions that still ship a python-xpcom we can use in the
 first place (Ubuntu doesn't ship it at all and recent versions of Fedora
 are [ticket:2772 broken], too).
 >
 > For actually printing PDFs, a workaround like {{{setattr(self, 'print',
 print_)}}} should work.

 As expected, this still fails in getattr():

 {{{
         setattr(print_iface, 'print_', getattr(print_iface, 'print'))
 }}}

 {{{
 Traceback (most recent call last):
   File "/home/sascha.silbe/sugar-
 jhbuild/install/share/sugar/activities/Browse.activity/webtoolbar.py",
 line 506, in _export_pdf_cb
     browser.export_pdf()
   File "/home/sascha.silbe/sugar-
 jhbuild/install/share/sugar/activities/Browse.activity/browser.py", line
 323, in export_pdf
     logging.debug('print: %r', getattr(print_iface, 'print'))
   File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 374,
 in __getattr__
     return getattr(interface, attr)
   File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 466,
 in __getattr__
     unbound_method = BuildMethod(method_info, self._iid_)
   File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 125,
 in BuildMethod
     codeObject = compile(method_code, "<XPCOMObject method '%s'>" %
 (name,), "exec")
   File "<XPCOMObject method 'print'>", line 2
     def print(self, Param1, Param2):
             ^
 SyntaxError: invalid syntax
 }}}

 The problem is that the code generated on-the-fly by '''python-xpcom'''
 uses the reserved keyword {{{print}}}.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/2833#comment:9>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list