[master 1/1] Change labelFormatOK to classmethods

vojtechtrefny installerbot-noreply at redhat.com
Mon Aug 17 06:49:47 UTC 2015


From: Vojtech Trefny <vtrefny at redhat.com>

This allows fslabel validity checks without creating the format.

Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
 blivet/tasks/fslabeling.py | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/blivet/tasks/fslabeling.py b/blivet/tasks/fslabeling.py
index b0a4c7e..96894e8 100644
--- a/blivet/tasks/fslabeling.py
+++ b/blivet/tasks/fslabeling.py
@@ -45,54 +45,62 @@ class Ext2FSLabeling(FSLabeling):
 
     default_label = ""
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return len(label) < 17
 
 class FATFSLabeling(FSLabeling):
 
     default_label = "NO NAME"
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return len(label) < 12
 
 class JFSLabeling(FSLabeling):
 
     default_label = ""
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return len(label) < 17
 
 class ReiserFSLabeling(FSLabeling):
 
     default_label = ""
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return len(label) < 17
 
 class XFSLabeling(FSLabeling):
 
     default_label = ""
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return ' ' not in label and len(label) < 13
 
 class HFSLabeling(FSLabeling):
 
     default_label = "Untitled"
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return ':' not in label and len(label) < 28 and len(label) > 0
 
 class HFSPlusLabeling(FSLabeling):
 
     default_label = "Untitled"
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return ':' not in label and 0 < len(label) < 129
 
 class NTFSLabeling(FSLabeling):
 
     default_label = ""
 
-    def labelFormatOK(self, label):
+    @classmethod
+    def labelFormatOK(cls, label):
         return len(label) < 129


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/0ac220164a8eb2b225ca62276f5a9052387e3666


More information about the anaconda-patches mailing list