pombreda / getpaid

Automatically exported from code.google.com/p/getpaid
0 stars 0 forks source link

getpaid-checkout-wizard UnicodeDecodeError: 'ascii' codec can't decode #242

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. checkout with a cart containing a product with a title containing an
accentuated character

What is the expected output? 
expected redirection to paypal

What do you see instead?
2009-04-06 21:14:45 ERROR Zope.SiteErrorLog
http://127.0.0.1:8080/3/@@getpaid-checkout-wizard
Traceback (innermost last):                                               

  Module ZPublisher.Publish, line 119, in publish                         

  Module ZPublisher.mapply, line 88, in mapply                            

  Module ZPublisher.Publish, line 42, in call_object                      

  Module Products.Five.browser.metaconfigure, line 417, in __call__       

  Module Shared.DC.Scripts.Bindings, line 313, in __call__                

  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec            

  Module Products.PageTemplates.PageTemplateFile, line 129, in _exec      

  Module Products.PageTemplates.PageTemplate, line 98, in pt_render       

  Module zope.pagetemplate.pagetemplate, line 117, in pt_render           

  Module zope.tal.talinterpreter, line 271, in __call__                   

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 891, in do_useMacro                

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 536, in do_optTag_tal              

  Module zope.tal.talinterpreter, line 521, in do_optTag                  

  Module zope.tal.talinterpreter, line 516, in no_tag                     

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 957, in do_defineSlot              

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 536, in do_optTag_tal              

  Module zope.tal.talinterpreter, line 521, in do_optTag                  

  Module zope.tal.talinterpreter, line 516, in no_tag                     

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 861, in do_defineMacro             

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 957, in do_defineSlot              

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 536, in do_optTag_tal              

  Module zope.tal.talinterpreter, line 521, in do_optTag                  

  Module zope.tal.talinterpreter, line 516, in no_tag                     

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 534, in do_optTag_tal              

  Module zope.tal.talinterpreter, line 516, in no_tag                     

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 949, in do_defineSlot              

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 534, in do_optTag_tal              

  Module zope.tal.talinterpreter, line 516, in no_tag                     

  Module zope.tal.talinterpreter, line 346, in interpret                  

  Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal     

  Module Products.PageTemplates.Expressions, line 221, in evaluateStructure

  Module zope.tales.tales, line 696, in evaluate                          

   - URL: index                                                           

   - Line 10, Column 4
   - Expression: <PathExpr standard:'view/getButton'>
   - Names:
      {'container': <PloneSite at /3>,
       'context': <PloneSite at /3>,
       'default': <object object at 0xb7c92528>,
       'here': <PloneSite at /3>,
       'loop': {},
       'nothing': None,
       'options': {'args': (<Products.Five.metaclass.SimpleViewClass from
/home/dan/Plone/buildout-cache/eggs/getpaid.paypal-0.4.2-py2.4.egg/getpaid/paypa
l/browser/templates/paypalbutton.pt
object at 0xfbb5cec>,)},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at
0xfbb802c>,
       'request': <HTTPRequest,
URL=http://127.0.0.1:8080/3/@@getpaid-checkout-wizard>,
       'root': <Application at >,
       'template': <ImplicitAcquirerWrapper object at 0xfb0c24c>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <Products.Five.metaclass.SimpleViewClass from
/home/dan/Plone/buildout-cache/eggs/getpaid.paypal-0.4.2-py2.4.egg/getpaid/paypa
l/browser/templates/paypalbutton.pt
object at 0xfbb5cec>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper
object at 0xfbb82cc>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 161, in _eval
  Module Products.PageTemplates.Expressions, line 123, in render
  Module getpaid.paypal.browser.paypalbutton, line 53, in getButton
  Module hurry.workflow.workflow, line 238, in fireTransition
  Module zope.event, line 23, in notify
  Module zope.component.event, line 26, in dispatch
  Module zope.component._api, line 131, in subscribers
  Module zope.component.registry, line 300, in subscribers
  Module zope.interface.adapter, line 535, in subscribers
  Module zope.component.event, line 33, in objectEventNotify
  Module zope.component._api, line 131, in subscribers
  Module zope.component.registry, line 300, in subscribers
  Module zope.interface.adapter, line 535, in subscribers
  Module Products.PloneGetPaid.notifications, line 147, in sendNotification
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10:
ordinal not in range(128)

change the title and it works

What version of the product are you using? On what version of Plone? How
did you install it (tarball vs buildout vs...)?

Products.PloneGetPaid-0.7.5

Please provide any additional information below.

Original issue reported on code.google.com by danielle...@gmail.com on 6 Apr 2009 at 7:29

GoogleCodeExporter commented 9 years ago
in /Products.PloneGetPaid-0.7.5/Products/PloneGetPaid/content.py
we have
class ShippableItemFactory( LineItemFactory ):

    def createLineItem( self, payable, quantity ):

        nitem = item.PayableShippableLineItem()
        nitem.item_id = self.content.UID() # archetypes uid

        # we use intids to reference content that we can dereference cleanly
        # without access to context.
        nitem.uid = component.getUtility( IIntIds ).register( self.content )

        # copy over information regarding the item
        nitem.name = self.content.Title()
but nitem.name is a string 

just above in class LineItemFactory( object ) 

we have
nitem.name = getUnicodeString( self.content.Title() )
where getUnicodeString
def getUnicodeString( s ):
            """Try to convert a string to unicode from utf-8, as this is what
Archetypes uses"""
            ...

I use as payable standard content objects and for me
nitem.name = self.content.title #  <type 'unicode'>

seems to work

Original comment by danielle...@gmail.com on 6 Apr 2009 at 10:47

GoogleCodeExporter commented 9 years ago
I had this problem also.
I have used an workaround as described in the list:

http://www.mail-archive.com/getpaid-dev@googlegroups.com/msg00349.html

Original comment by rafaelcr...@gmail.com on 14 Jun 2009 at 8:57

GoogleCodeExporter commented 9 years ago
I had this problem also.
And after checking each solution I have refactored 
Products/PloneGetPaid/content.py a
little and have included the patch.

Attached you can find the patch against svn revision 2719. Someone with 
permission
should check this patch and commit it to the trunk. 

Original comment by oggers on 29 Jun 2009 at 9:24

Attachments:

GoogleCodeExporter commented 9 years ago
I don't use anymore getpaid.paypal (I don't want to share my experience with my
customers). I just wanted to say I solve all my Unicode problems by patching 
base.py
see issue Issue 242

Original comment by danielle...@gmail.com on 17 Apr 2010 at 12:02