|
I am writing a new RF library which is expected to take string arguments because the (pre-existing) Python library that I use is expecting strings, not unicode. Ofcourse I can convert each unicode to string before calling my existing function which supports only strings. The problem is I have lots of similar functions and in each of these functions I will have to call this unicode to string conversion circus. Is there a straight forward way of doing this, so that the RF function will directly accept in string format Another question is the default unicode support a Robot Framework feature or a RIDE feature ? (I am using RIDE, is that why I am getting this problem) Thanks binith |
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.
Hello,Robot Framework parses all normal test data to Unicode strings. There is no way to tell it to convert arguments to bytes (Python str object) when calling keywords.It's strange that your Python library handles only bytes and not Unicode even when you have only ASCII data. I would first look is it possible to change that. If that's not possible, you need to handle unicode -> str conversion yourself.If you have lot of methods, you may want to consider writing a decorator that does the argument conversion for you. If there's a really big amount of those methods and all of them should handle the same conversion, you may consider using metaclasses or class decorators to automatically decorate all your functions. Notice, though, that your decorators need to be signature-preserving or otherwise Robo, RIDE, and Libdoc won't see correct arguments. This is discussed briefly in the User Guide:Cheers,.peke
I am writing a new RF library which is expected to take string arguments because the (pre-existing) Python library that I use is expecting strings, not unicode. Ofcourse I can convert each unicode to string before calling my existing function which supports only strings.
import ConfigParser class RFConfigParser: def get (self,section, option): print type (section) #prints unicode section = str (section) #works but I dont want to do this return self._config.get (section, option) #this pre-existing function expect a string input
The problem is I have lots of similar functions and in each of these functions I will have to call this unicode to string conversion circus.
Is there a straight forward way of doing this, so that the RF function will directly accept in string format
Another question is the default unicode support a Robot Framework feature or a RIDE feature ? (I am using RIDE, is that why I am getting this problem)
Thanks
binith
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.