non-standard URLs are not correctly interpreted and cannot be corrected

Bug #56729 reported by Jeff Fortin Tam
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Specto
Fix Released
Critical
Unassigned

Bug Description

If you add a watch with an URL that doesn't have http://, (for example, perdu.com) specto does not try to add it. It should try to, at least. The current output is this:

ValueError: unknown url type: perdu.com

However, if you try to correct the URL using edit_watch, it will output this:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/specto/notifier.py", line 413, in refresh
    self.specto.stop_watch(i)
  File "/usr/lib/python2.4/site-packages/specto/main.py", line 207, in stop_watch
    self.watch_db[id].stop_watch()
  File "/usr/lib/python2.4/site-packages/specto/watch.py", line 124, in stop_watch
    gobject.source_remove(self.timer_id)
AttributeError: web_watch instance has no attribute 'timer_id'

Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Furthermore, it becomes a crasher when you restart specto, so I'm marking this as critical:

Traceback (most recent call last):
  File "/usr/bin/specto", line 38, in ?
    specto = Specto()
  File "/usr/lib/python2.4/site-packages/specto/main.py", line 75, in __init__
    watch_value_db = self.watch_io.read_options()
  File "/usr/lib/python2.4/site-packages/specto/watch.py", line 163, in read_options
    values['type'] = int(watch_options['type'])
KeyError: 'type'

Changed in specto:
assignee: nobody → woutclymans
importance: Untriaged → High
importance: High → Critical
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

The content created in watches.list was this:

[perdu test]
updated = False

This information is too little for specto to handle ;) Actually, it completely bypassed collecting other information as soon as the URL did not work. This is something that should be fixed: even if the URL does not work, save the rest of the information.

Revision history for this message
woutc (woutclymans-deactivatedaccount) wrote :

AttributeError: web_watch instance has no attribute 'timer_id': that's because the watch hasn't been started.

KeyError: 'type': as you can see on your last comment, the watch is missing a lot of options

I think this has to be fixed using exceptions to make sure all options are correct.
Else the watch shouldn't be created at all and a warning should be displayed that the user has to input the right values.

Revision history for this message
woutc (woutclymans-deactivatedaccount) wrote :

if the first 7 characters aren't "http://", it will be added to the url

Changed in specto:
status: Unconfirmed → Fix Committed
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

I just had a bug for the second time with this feature, and this time I figured out what happened. See the screenshot: specto did not correctly interpret the URL and added http:// even if I had that already. Uh oh!

Changed in specto:
status: Fix Committed → In Progress
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Here is the output when I try pasting http://gnome-scanning.blogspot.com/ into the URL field and creating the watch:

  File "/usr/lib/python2.4/site-packages/specto/add_watch.py", line 202, in add_clicked
    self.create_watch()
  File "/usr/lib/python2.4/site-packages/specto/add_watch.py", line 294, in create_watch
    self.specto.add_watch(values) #write the options in the configuration file
  File "/usr/lib/python2.4/site-packages/specto/main.py", line 237, in add_watch
    self.start_watch(id)
  File "/usr/lib/python2.4/site-packages/specto/main.py", line 211, in start_watch
    self.watch_db[id].start_watch()
  File "/usr/lib/python2.4/site-packages/specto/watch_web_static.py", line 62, in start_watch
    self.update()
  File "/usr/lib/python2.4/site-packages/specto/watch_web_static.py", line 95, in update
    response = urllib2.urlopen(request)
  File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.4/urllib2.py", line 358, in open
    response = self._open(req, data)
  File "/usr/lib/python2.4/urllib2.py", line 376, in _open
    '_open', req)
  File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.4/urllib2.py", line 980, in do_open
    h = http_class(host) # will parse host:port
  File "/usr/lib/python2.4/httplib.py", line 586, in __init__
    self._set_hostport(host, port)
  File "/usr/lib/python2.4/httplib.py", line 598, in _set_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: ''

Changed in specto:
status: In Progress → Fix Committed
Revision history for this message
Jeff Fortin Tam (kiddo) wrote :

Ok, seems like the behavior disappeared for me. Could you confirm everything works on your side, Wout? If not, reopen the bug.

Changed in specto:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.