Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
68894ede
Commit
68894ede
authored
Jul 06, 2012
by
Clément Schreiner
Browse files
New method in BasePlugin: _new_result (update to new model).
parent
6723100c
Changes
2
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/__init__.py
View file @
68894ede
...
...
@@ -37,6 +37,8 @@ __license__ = 'MIT'
from
debexpo.lib
import
constants
from
debexpo.model.plugin_results
import
PluginResultData
class
BasePlugin
(
object
):
result_model
=
None
...
...
@@ -56,13 +58,18 @@ class BasePlugin(object):
def
_add_db_objects
(
self
,
*
db_objects
):
self
.
_db_objects
.
extend
(
db_objects
)
def
_add_data
(
self
,
id
=
0
,
**
data
):
result_data
=
[
self
.
result_model
(
package_version_id
=
self
.
package_version
.
id
,
id
=
id
,
def
_add_data
(
self
,
result
,
**
data
):
result_data
=
[
PluginResultData
(
plugin_result
=
result
,
key
=
key
,
value
=
data
[
key
])
for
key
in
data
]
self
.
_add_db_objects
(
*
result_data
)
def
_new_result
(
self
,
**
data
):
result
=
self
.
result_model
(
package_version
=
self
.
package_version
)
self
.
_add_db_objects
(
result
)
self
.
_add_data
(
result
,
**
data
)
return
result
@
property
def
db_objects
(
self
):
return
self
.
_db_objects
debexpo/plugins/native.py
View file @
68894ede
...
...
@@ -67,14 +67,15 @@ class NativePlugin(BasePlugin):
native
=
filecheck
.
is_native_package
(
self
.
changes
)
result
=
self
.
_new_result
()
if
native
:
# Most uploads will not be native, and especially on mentors, a native
# package is almost probably in error.
log
.
warning
(
'Package is native'
)
self
.
_add_data
(
native
=
'true'
)
self
.
_add_data
(
result
,
native
=
'true'
)
else
:
log
.
debug
(
'Package is not native'
)
self
.
_add_data
(
native
=
'false'
,
severity
=
constants
.
PLUGIN_SEVERITY_INFO
)
self
.
_add_data
(
result
,
native
=
'false'
,
severity
=
constants
.
PLUGIN_SEVERITY_INFO
)
plugin
=
NativePlugin
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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