[apparmor] [patch][utils] Refractor prompts to class

Christian Boltz apparmor at cboltz.de
Sun Sep 21 20:56:27 UTC 2014


Hello,

Am Mittwoch, 10. September 2014 schrieb Kshitij Gupta:
> In keeping with the idea to make the less Perl-ish and more OOP style
> (in hope to get more Pythonic). I thought it was a simple place to
> start off with.
>
> Any suggestions and changes for the patch are welcome.
> 
> The following patch:
> - creates a class for prompt questions moving away from Perl hash hack
> for the purpose.
> - moves some functions to the methods for that class
> - fix options being incorrectly passed to questionPrompt in
> aa-mergeprof
> 
> Due to the functions being moved around the patch is a bit long.

That, and lots of q.['whatever'] -> q.whatever changes ;-)
 
> Basic testing done with logprof.

The patch looks good, with one exception:

=== modified file 'utils/apparmor/ui.py'
--- utils/apparmor/ui.py    2014-08-06 17:07:41 +0000
+++ utils/apparmor/ui.py    2014-09-10 06:59:16 +0000

+    def promptUser(self, params=''):
+        cmd = None
+        arg = None
+        if UI_mode == 'text':
+            cmd, arg = self.Text_PromptUser()
+        else:
+            q.type = 'wizard'
+            SendDataToYast(q)
+            ypath, yarg = GetDataFromYast()

That should probably be
            ypath, yarg = self.GetDataFromYast()
(note the added "self.")

With this fixed,
Acked-by: Christian Boltz <apparmor at cboltz.de>


Regards,

Christian Boltz
-- 
> I'll be happy to fix the wording or Germanglish :D
And shift it to Netherlangish? ;)
[> Jos Poortvliet and Lars Müller in opensuse-project]




More information about the AppArmor mailing list