ggaughan / pipe2py

A project to compile Yahoo! Pipes into Python (see it hosted on Google App Engine: http://pipes-engine.appspot.com)
http://wiki.github.com/ggaughan/pipe2py
GNU General Public License v2.0
317 stars 51 forks source link

pipeurlbuilder fails with numeric values in path elements #19

Closed thwarted closed 9 years ago

thwarted commented 10 years ago

pipe 11278a7cb21e7964282dfe9a46f38837

I'm build a URL from two components; the base comes from string builder, which takes one of the inputs (the username) and the awardgroup becomes the only path component. The number input, however, is a float. I can fix this for this pipe by changing the line to

url += "/".join(str(int(p)) for p in path if p)

which fixes both that the input value is a float and that it's not a string, but that only would work for this specific pipe (that is, if I added the username as part of the path, then obviously int() would coerce the wrong value there).

username (default=Duubs) 
awardgroup (1-5) (default=1) 
Traceback (most recent call last):
  File "./pipe_11278a7cb21e7964282dfe9a46f38837.py", line 43, in <module>
    for i in p:
  File ".../pipe2py/modules/pipeoutput.py", line 18, in pipe_output
    for item in _INPUT:
  File ".../pipe2py/modules/pipeloop.py", line 35, in pipe_loop
    for item in _INPUT:        
  File ".../pipe2py/modules/pipefilter.py", line 39, in pipe_filter
    for item in _INPUT:
  File ".../pipe2py/modules/pipeloop.py", line 35, in pipe_loop
    for item in _INPUT:        
  File ".../pipe2py/modules/piperegex.py", line 40, in pipe_regex 
    for item in _INPUT:
  File ".../pipe2py/modules/piperegex.py", line 40, in pipe_regex 
    for item in _INPUT:
  File ".../pipe2py/modules/piperename.py", line 35, in pipe_rename
    for item in _INPUT:
  File ".../pipe2py/modules/pipexpathfetchpage.py", line 32, in pipe_xpathfetchpage
    url = util.get_value(item_url, item, **kwargs)
  File ".../pipe2py/util.py", line 128, in get_value 
    return kwargs[pythonise(_item['terminal'])].next()
  File ".../pipe2py/modules/pipeurlbuilder.py", line 34, in pipe_urlbuilder
    url += "/".join(p for p in path if p)
TypeError: sequence item 0: expected string, float found
thwarted commented 10 years ago

I think https://github.com/thwarted/pipe2py/commit/549508ba8f997f754fb6723c4744a26c4be5f105 resolves the two issues this uncovers.