From 5803d802e5919d0fea30484efd08b79a885a9f9f Mon Sep 17 00:00:00 2001 From: Doug Fish Date: Tue, 16 Sep 2014 09:04:52 -0500 Subject: [PATCH] Update Usage Comments for DeleteAction Update the attributes for DeleteAction to explain updated usage and note problem attributes which will be deprecated. Add note to BatchAction action_past. Change-Id: Ie50efae19711618f2a8caea84d45a648b31f7703 partial-bug: 1307476 --- horizon/tables/actions.py | 41 ++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py index 52ccd6ce9a..6f825d712e 100644 --- a/horizon/tables/actions.py +++ b/horizon/tables/actions.py @@ -609,6 +609,10 @@ class BatchAction(Action): setting self.current_past_action = n will set the current active item from the list(action_past[n]) + NOTE: action_past attribute is bad for translations and should be + avoided. Please use the action_past method instead. + This form is kept for legacy. + .. attribute:: data_type_singular Optional display name (if the data_type method is not defined) for the @@ -838,24 +842,51 @@ class DeleteAction(BatchAction): A short name or "slug" representing this action. Defaults to 'delete' - .. attribute:: action_present + .. method:: action_present + + Method accepting an integer/long parameter and returning the display + forms of the name properly pluralised (depending on the integer) and + translated in a string or tuple/list. + + .. attribute:: action_present (PendingDeprecation) A string containing the transitive verb describing the delete action. Defaults to 'Delete' - .. attribute:: action_past + NOTE: action_present attribute is bad for translations and should be + avoided. Please use the action_present method instead. + This form is kept for legacy. + + .. method:: action_past + + Method accepting an integer/long parameter and returning the display + forms of the name properly pluralised (depending on the integer) and + translated in a string or tuple/list. + + .. attribute:: action_past (PendingDeprecation) A string set to the past tense of action_present. Defaults to 'Deleted' - .. attribute:: data_type_singular + NOTE: action_past attribute is bad for translations and should be + avoided. Please use the action_past method instead. + This form is kept for legacy. + + .. attribute:: data_type_singular (PendingDeprecation) A string used to name the data to be deleted. - .. attribute:: data_type_plural + .. attribute:: data_type_plural (PendingDeprecation) Optional. Plural of ``data_type_singular``. - Defaults to ``data_type_singular`` appended with an 's'. + Defaults to ``data_type_singular`` appended with an 's'. Relying on + the default is bad for translations and should not be done, so it's + absence will raise a DeprecationWarning. It is currently kept as + optional for legacy code. + + NOTE: data_type_singular and data_type_plural attributes are bad for + translations and should be avoided. Please use the action_present and + action_past methods. This form is kept for legacy. """ name = "delete"