use the new id management system and writing (id@backend instead of backend.id)
This commit is contained in:
parent
8533c05e65
commit
1a94a7b77f
1 changed files with 11 additions and 16 deletions
|
|
@ -45,12 +45,6 @@ class HaveSex(PromptApplication):
|
||||||
|
|
||||||
return self.loop()
|
return self.loop()
|
||||||
|
|
||||||
def split_id(self, id):
|
|
||||||
try:
|
|
||||||
bname, id = id.split('.', 1)
|
|
||||||
except ValueError:
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
return self.weboob.backends.get(bname, None), id
|
return self.weboob.backends.get(bname, None), id
|
||||||
|
|
||||||
@PromptApplication.command("exit program")
|
@PromptApplication.command("exit program")
|
||||||
|
|
@ -60,16 +54,17 @@ class HaveSex(PromptApplication):
|
||||||
|
|
||||||
@PromptApplication.command("show a profile")
|
@PromptApplication.command("show a profile")
|
||||||
def command_profile(self, id):
|
def command_profile(self, id):
|
||||||
backend, _id = self.split_id(id)
|
_id, backend_name = self.parse_id(id)
|
||||||
if not backend:
|
|
||||||
print 'Invalid ID: %s' % id
|
found = 0
|
||||||
return False
|
for backend, profile in self.weboob.do_backends(backend_name, 'get_profile', _id):
|
||||||
with backend:
|
if profile:
|
||||||
profile = backend.get_profile(_id)
|
print profile.get_profile_text()
|
||||||
if not profile:
|
found = 1
|
||||||
print 'Profile not found'
|
|
||||||
|
if not found:
|
||||||
|
print >>sys.stderr, 'Profile not found'
|
||||||
|
|
||||||
print profile.get_profile_text()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def service(self, action, function, *params):
|
def service(self, action, function, *params):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue