Minor refactoring for constant
Renames _part_handler_content_type to _PART_HANDLER_CONTENT_TYPE.
This commit is contained in:
parent
7c53a6d0ae
commit
f0d9274b4b
@ -28,7 +28,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class UserDataPlugin(base.BasePlugin):
|
class UserDataPlugin(base.BasePlugin):
|
||||||
_part_handler_content_type = "text/part-handler"
|
_PART_HANDLER_CONTENT_TYPE = "text/part-handler"
|
||||||
_GZIP_MAGIC_NUMBER = '\x1f\x8b'
|
_GZIP_MAGIC_NUMBER = '\x1f\x8b'
|
||||||
|
|
||||||
def execute(self, service, shared_data):
|
def execute(self, service, shared_data):
|
||||||
@ -99,7 +99,7 @@ class UserDataPlugin(base.BasePlugin):
|
|||||||
LOG.debug("Executing userdata plugin: %s" %
|
LOG.debug("Executing userdata plugin: %s" %
|
||||||
user_data_plugin.__class__.__name__)
|
user_data_plugin.__class__.__name__)
|
||||||
|
|
||||||
if content_type == self._part_handler_content_type:
|
if content_type == self._PART_HANDLER_CONTENT_TYPE:
|
||||||
new_user_handlers = user_data_plugin.process(part)
|
new_user_handlers = user_data_plugin.process(part)
|
||||||
self._add_part_handlers(user_data_plugins,
|
self._add_part_handlers(user_data_plugins,
|
||||||
user_handlers,
|
user_handlers,
|
||||||
|
@ -135,7 +135,7 @@ class UserDataPluginTest(unittest.TestCase):
|
|||||||
mock_user_handlers.get.side_effect = [handler_func]
|
mock_user_handlers.get.side_effect = [handler_func]
|
||||||
mock_user_data_plugins.get.side_effect = [user_data_plugin]
|
mock_user_data_plugins.get.side_effect = [user_data_plugin]
|
||||||
if content_type:
|
if content_type:
|
||||||
_content_type = self._userdata._part_handler_content_type
|
_content_type = self._userdata._PART_HANDLER_CONTENT_TYPE
|
||||||
mock_part.get_content_type.return_value = _content_type
|
mock_part.get_content_type.return_value = _content_type
|
||||||
else:
|
else:
|
||||||
_content_type = 'other content type'
|
_content_type = 'other content type'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user