Some AUM fixups

This commit is contained in:
Roger Philibert 2011-04-13 12:43:26 +02:00 committed by Romain Bignon
commit 7a0aad5e8f
3 changed files with 14 additions and 4 deletions

View file

@ -68,6 +68,7 @@ class AuMBrowser(BaseBrowser):
'http://www.adopteunmec.com/register4.php.*': RegisterConfirmPage,
'http://www.adopteunmec.com/home.php': HomePage,
'http://www.adopteunmec.com/shop2c?.php': ShopPage,
'http[s]://www.adopteunmec.com/register-pay.php': ShopPage,
'http://www.adopteunmec.com/mails.php': ContactListPage,
'http://www.adopteunmec.com/mail.php': ContactListPage,
'http://www.adopteunmec.com/mails.php\?type=1': BasketsPage,
@ -105,7 +106,7 @@ class AuMBrowser(BaseBrowser):
return not self.is_on_page(LoginPage)
def home(self):
return self.location('http://www.adopteunmec.com/home.php')
return self.location('http://www.adopteunmec.com/')
def pageaccess(func):
def inner(self, *args, **kwargs):
@ -273,7 +274,7 @@ class AuMBrowser(BaseBrowser):
@pageaccess
def search_profiles(self, **kwargs):
self.location('/search.php?display=1')
self.location('/search.php')
self.page.search(**kwargs)
return self.page.get_profiles_ids()

View file

@ -22,6 +22,7 @@ from __future__ import with_statement
from weboob.tools.browser import BrowserUnavailable
from weboob.capabilities.dating import Optimization
from weboob.capabilities.contact import QueryError
from weboob.tools.log import getLogger
@ -56,6 +57,9 @@ class QueriesQueue(Optimization):
return self.check_cron is not None
def enqueue_query(self, id, priority=999):
id_queue = [_id[1] for _id in self.queue]
if int(id) in id_queue:
raise QueryError('This id is already queued')
self.queue.append((int(priority), int(id)))
self.save()
# Try to flush queue to send it now.

View file

@ -19,6 +19,7 @@
import re
import mechanize
from weboob.tools.mech import ClientForm
from weboob.tools.browser import BrowserIncorrectPassword
@ -30,7 +31,10 @@ from ..captcha import Captcha
class LoginPage(PageBase):
def login(self, login, password):
self.browser.select_form(name="form_login")
try:
self.browser.select_form(name="form_login")
except mechanize._mechanize.FormNotFoundError:
return
self.browser['login'] = login
self.browser['password'] = password
@ -120,7 +124,8 @@ class BanPage(PageBase):
raise AdopteBanned('Your IP address is banned.')
class ShopPage(PageBase):
pass
def on_loaded(self):
self.browser.location('http://www.adopteunmec.com/account.php')
class ErrPage(PageBase):
def on_loaded(self):