Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<type 'exceptions.AttributeError'> while adding a feed #23

Closed
ghost opened this issue Mar 14, 2013 · 10 comments
Closed

<type 'exceptions.AttributeError'> while adding a feed #23

ghost opened this issue Mar 14, 2013 · 10 comments
Milestone

Comments

@ghost
Copy link

ghost commented Mar 14, 2013

Feed URL: http://fredjoiner.wordpress.com/feed/atom/

Error

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /var/www/planeteria2/www/allarounddc/admin.py in ()
    215    a = Admin(template_vars(planet, Form)).render()
    216    sys.stdout.write(a)
    217 
    218 if __name__ == "__main__":
=>  219    main()
main = <function main>
 /var/www/planeteria2/www/allarounddc/admin.py in main()
    196    if Form.has_key('PlanetName'):
    197       orig_pass = planet.password
=>  198       planet = update_config(planet)
    199 
    200       if Form.getvalue('Timestamp') != str(planet.last_config_change):
planet = <planet.Planet instance>, global update_config = <function update_config>
 /var/www/planeteria2/www/allarounddc/admin.py in update_config(planet=<planet.Planet instance>)
    135    urls_seen = []
    136    while (Form.has_key('section%d' % feed_count)):
=>  137       url = Form.getvalue('feedurl%d' % feed_count,'').strip()
    138       urls_seen.append(url)
    139       if not url:
url undefined, global Form = FieldStorage(None, None, [MiniFieldStorage('Time...d3.jpeg'), MiniFieldStorage('Pass', '[censored]')]), Form.getvalue = <bound method FieldStorage.getvalue of FieldStor...3.jpeg'), MiniFieldStorage('Pass', '[censored]')])>, feed_count = 0, ).strip undefined
<type 'exceptions.AttributeError'>: 'list' object has no attribute 'strip' 
      args = ("'list' object has no attribute 'strip'",) 
      message = "'list' object has no attribute 'strip'"
@lizzard
Copy link

lizzard commented Mar 16, 2013

Yep, I also had this but while clicking the "save" button at the bottom of the page.

<type 'exceptions.AttributeError'> Python 2.7.3rc2: /usr/bin/python
Sat Mar 16 03:30:39 2013

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/var/www/planeteria2/www/feministhackers/admin.py in ()
215 a = Admin(template_vars(planet, Form)).render()
216 sys.stdout.write(a)
217
218 if name == "main":
=> 219 main()
main =
/var/www/planeteria2/www/feministhackers/admin.py in main()
196 if Form.has_key('PlanetName'):
197 orig_pass = planet.password
=> 198 planet = update_config(planet)
199
200 if Form.getvalue('Timestamp') != str(planet.last_config_change):
planet = <planet.Planet instance>, global update_config =
/var/www/planeteria2/www/feministhackers/admin.py in update_config(planet=<planet.Planet instance>)
135 urls_seen = []
136 while (Form.has_key('section%d' % feed_count)):
=> 137 url = Form.getvalue('feedurl%d' % feed_count,'').strip()
138 urls_seen.append(url)
139 if not url:
url undefined, global Form = FieldStorage(None, None, [MiniFieldStorage('Time..._blue.jpg'), MiniFieldStorage('Pass', 'passme')]), Form.getvalue = <bound method FieldStorage.getvalue of FieldStor...blue.jpg'), MiniFieldStorage('Pass', 'passme')])>, feed_count = 0, ).strip undefined

<type 'exceptions.AttributeError'>: 'list' object has no attribute 'strip'
args = ("'list' object has no attribute 'strip'",)
message = "'list' object has no attribute 'strip'"

@dtiburon
Copy link
Collaborator

I think I may have found the cause of this and did a quick fix. Pull request submitted - let's hope it works for you!

@jvasile
Copy link
Owner

jvasile commented Mar 27, 2013

Closed, thanks to Aleta's 3289266 patch.

@jvasile jvasile closed this as completed Mar 27, 2013
@dtiburon
Copy link
Collaborator

Reopening this, requires more testing to make sure it didn't create another issue. Lizzard reported an error on line 162. Tested to see if it's due to her attempting to add the same feed as she added previously when she encountered the error, but it still dies at Line 162 when adding a completely different feed.

@ghost
Copy link
Author

ghost commented Mar 30, 2013

I tried again with http://fredjoiner.wordpress.com/feed/atom/
and got

 /var/www/planeteria2/www/allarounddc/admin.py in ()
    227    a = Admin(template_vars(planet, Form)).render()
    228    sys.stdout.write(a)
    229 
    230 if __name__ == "__main__":
=>  231    main()
main = <function main>
 /var/www/planeteria2/www/allarounddc/admin.py in main()
    208    if Form.has_key('PlanetName'):
    209       orig_pass = planet.password
=>  210       planet = update_config(planet)
    211 
    212       if Form.getvalue('Timestamp') != str(planet.last_config_change):
planet = <planet.Planet instance>, global update_config = <function update_config>
 /var/www/planeteria2/www/allarounddc/admin.py in update_config(planet=<planet.Planet instance>)
    159          if not url in planet.feeds:
    160             t = {'feedurl':url, 
=>  161                  'name':good_field(Form.getvalue('name%d' % feed_count, '').strip()),
    162                  'image':Form.getvalue('image%d' % feed_count, '').strip()}
    163             planet.feeds[url] = t
global good_field = <function good_field>, global Form = FieldStorage(None, None, [MiniFieldStorage('Time...d3.jpeg'), MiniFieldStorage('Pass', '[censored]')]), Form.getvalue = <bound method FieldStorage.getvalue of FieldStor...3.jpeg'), MiniFieldStorage('Pass', '[censored]')])>, feed_count = 0, ).strip undefined

<type 'exceptions.AttributeError'>: 'list' object has no attribute 'strip'
      args = ("'list' object has no attribute 'strip'",)
      message = "'list' object has no attribute 'strip'" 

@dtiburon
Copy link
Collaborator

That's very helpful! Thanks for this info, I'll keep working on it.

On Mar 29, 2013, at 8:23 PM, Ken Stailey wrote:

I tried again with http://fredjoiner.wordpress.com/feed/atom/
and got
/var/www/planeteria2/www/allarounddc/admin.py in ()
227 a = Admin(template_vars(planet, Form)).render()
228 sys.stdout.write(a)
229
230 if name == "main":
=> 231 main()
main =
/var/www/planeteria2/www/allarounddc/admin.py in main()
208 if Form.has_key('PlanetName'):
209 orig_pass = planet.password
=> 210 planet = update_config(planet)
211
212 if Form.getvalue('Timestamp') != str(planet.last_config_change):
planet = , global update_config =
/var/www/planeteria2/www/allarounddc/admin.py in update_config(planet=)
159 if not url in planet.feeds:
160 t = {'feedurl':url,
=> 161 'name':good_field(Form.getvalue('name%d' % feed_count, '').strip()),
162 'image':Form.getvalue('image%d' % feed_count, '').strip()}
163 planet.feeds[url] = t
global good_field = , global Form = FieldStorage(None, None, [MiniFieldStorage('Time...d3.jpeg'), MiniFieldStorage('Pass', '[censored]')]), Form.getvalue = , feed_count = 0, ).strip undefined

<type 'exceptions.AttributeError'>: 'list' object has no attribute 'strip'
args = ("'list' object has no attribute 'strip'",)
message = "'list' object has no attribute 'strip'"

Reply to this email directly or view it on GitHub.

@ghost
Copy link
Author

ghost commented Apr 22, 2013

Form HTML contains:

    <label for="Pass">Password:</label><input type="password" size="25" name="Pass" id="Pass" value="">

Parse goes:

good_field(Form.getvalue('name%d' % feed_count, '').strip()),

but name="Pass" is not name="Pass1"

Anyhow, it shouldn't try to do planet.add_feed() on the password.

@dtiburon
Copy link
Collaborator

I'm now experiencing this issue as well with the WFS planet; same traceback as @nutznboltz when he added the fredjoiner blog (above).

@nutznboltz, thanks for your attention to this. I apologize for having dropped the ball, life has been a bit crazy lately! A rewrite of the admin.py file is in the plans in the next month or two, but I'd like to at least do a short-term fix for this issue so that those who are prevented from using the admin page. I'm afraid I am not going to be able to take a look at it for a couple weeks still, would you be interested in taking on this issue?

@dtiburon dtiburon reopened this Jul 26, 2013
@dtiburon
Copy link
Collaborator

I've found the culprit! Comparing the three planets that I know have experienced this issue (wfs, feministhackers, allarounddc), it seems all of them first experienced the issue when making a change AFTER having added a feed with an apostrophe in the name. The apostrophe was being interpreted to signify the end of the string, which was throwing a wrench in things.

I've made a small change so that it escapes the apostrophes in the Name field with b4cb5f9.

This prevents the issue from happening with feeds added moving forward, however this does not fix the existing feed names in the database with unescaped apostrophes. I'm leaving this bug open until that's addressed, since those planets which are affected are still broken (cannot add any new feeds).

@dtiburon
Copy link
Collaborator

Upon further testing, it seems no changes to the database are needed. In my local install, I can now update planets that previously got errors. Closing this bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants