Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
178
Issues
178
List
Boards
Labels
Milestones
Merge Requests
49
Merge Requests
49
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
5c2d563e
Commit
5c2d563e
authored
Feb 26, 2019
by
Romain Bignon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit_backend: rewrite to not require module_name useless parameter
parent
8f032d2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
12 deletions
+26
-12
weboob/core/backendscfg.py
weboob/core/backendscfg.py
+21
-9
weboob/tools/application/qt5/backendcfg.py
weboob/tools/application/qt5/backendcfg.py
+1
-2
weboob/tools/backend.py
weboob/tools/backend.py
+4
-1
No files found.
weboob/core/backendscfg.py
View file @
5c2d563e
...
...
@@ -128,7 +128,7 @@ class BackendsConfig(object):
config
=
self
.
_read_config
()
return
name
in
config
.
sections
()
def
add_backend
(
self
,
backend_name
,
module_name
,
params
,
edit
=
False
):
def
add_backend
(
self
,
backend_name
,
module_name
,
params
):
"""
Add a backend to config.
...
...
@@ -140,20 +140,32 @@ class BackendsConfig(object):
if
not
backend_name
:
raise
ValueError
(
u'Please give a name to the configured backend.'
)
config
=
self
.
_read_config
()
if
not
edit
:
try
:
config
.
add_section
(
backend_name
)
except
DuplicateSectionError
:
raise
BackendAlreadyExists
(
backend_name
)
try
:
config
.
add_section
(
backend_name
)
except
DuplicateSectionError
:
raise
BackendAlreadyExists
(
backend_name
)
config
.
set
(
backend_name
,
'_module'
,
module_name
)
for
key
,
value
in
params
.
items
():
config
.
set
(
backend_name
,
key
,
value
)
self
.
_write_config
(
config
)
def
edit_backend
(
self
,
backend_name
,
module_name
,
params
):
"""Edit a backend from config."""
return
self
.
add_backend
(
backend_name
,
module_name
,
params
,
True
)
def
edit_backend
(
self
,
backend_name
,
params
):
"""
Edit a backend from config.
:param backend_name: name of the backend in config
:param params: params to change
:type params: :class:`dict`
"""
config
=
self
.
_read_config
()
if
not
config
.
has_section
(
backend_name
):
raise
KeyError
(
u'Configured backend "
%
s" not found'
%
backend_name
)
for
key
,
value
in
params
.
items
():
config
.
set
(
backend_name
,
key
,
value
)
self
.
_write_config
(
config
)
def
get_backend
(
self
,
backend_name
):
"""
...
...
weboob/tools/application/qt5/backendcfg.py
View file @
5c2d563e
...
...
@@ -248,7 +248,6 @@ class BackendCfg(QDialog):
self
.
is_enabling
+=
1
backend_name
=
item
.
text
(
0
)
module_name
=
item
.
text
(
1
)
if
item
.
checkState
(
0
)
==
Qt
.
Checked
:
self
.
to_load
.
add
(
backend_name
)
enabled
=
'true'
...
...
@@ -260,7 +259,7 @@ class BackendCfg(QDialog):
pass
enabled
=
'false'
self
.
weboob
.
backends_config
.
edit_backend
(
backend_name
,
module_name
,
{
'_enabled'
:
enabled
})
self
.
weboob
.
backends_config
.
edit_backend
(
backend_name
,
{
'_enabled'
:
enabled
})
@
Slot
(
QTreeWidgetItem
,
int
)
def
backendClicked
(
self
,
item
,
col
):
...
...
weboob/tools/backend.py
View file @
5c2d563e
...
...
@@ -199,7 +199,10 @@ class BackendConfig(ValuesDict):
if
params
is
not
None
:
dump
.
update
(
params
)
self
.
weboob
.
backends_config
.
add_backend
(
self
.
instname
,
self
.
modname
,
dump
,
edit
)
if
edit
:
self
.
weboob
.
backends_config
.
edit_backend
(
self
.
instname
,
dump
)
else
:
self
.
weboob
.
backends_config
.
add_backend
(
self
.
instname
,
self
.
modname
,
dump
)
class
Module
(
object
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment