default_email_address = "Please input your E-mail address"
config.plugins.vuplusauthenticity = ConfigSubsection()
-config.plugins.vuplusauthenticity.sn_a = NoSave(ConfigSelection(default = "MSA", choices = [ ("MSA", _("MSA")), ("MA", _("MA")), ("MB", _("MB")), ("MC", _("MC")), ("MD", _("MD")), ("ME", _("ME")), ("MF", _("MF")), ("MG", _("MG")), ("MH", _("MH"))] ))
-config.plugins.vuplusauthenticity.sn_b = NoSave(ConfigInteger(default = 0, limits = (1, 999999999)))
+config.plugins.vuplusauthenticity.sn_a = NoSave(ConfigSelection(default = "MSA", choices = [ ("MSA", _("MSA")), ("MA", _("MA")), ("MB", _("MB")), ("MC", _("MC")), ("C", _("C")), ("D", _("D")), ("E", _("E")), ("F", _("F")), ("G", _("G"))] ))
+config.plugins.vuplusauthenticity.sn_b = NoSave(ConfigInteger(default = 0, limits = (1, 9999999999)))
+config.plugins.vuplusauthenticity.sn_b_mx = NoSave(ConfigInteger(default = 0, limits = (1, 999999999)))
config.plugins.vuplusauthenticity.sn_b_msa = NoSave(ConfigInteger(default = 0, limits = (1, 9999999)))
config.plugins.vuplusauthenticity.email = NoSave(ConfigText(default = default_email_address, visible_width = 50, fixed_size = False))
self.sn_aEntry = getConfigListEntry(_("1-1. Serial Number (The first two or three letters of SN)"), config.plugins.vuplusauthenticity.sn_a)
if config.plugins.vuplusauthenticity.sn_a.value == "MSA":
self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b_msa)
+ elif config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
+ self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b_mx)
else:
self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b)
self.emailEntry = getConfigListEntry(_("2. Contact"), config.plugins.vuplusauthenticity.email)
if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
sn_length = 7
sn = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
- else:
+ elif config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
sn_length = 9
+ sn = str(config.plugins.vuplusauthenticity.sn_b_mx.value)
+ else:
+ sn_length = 10
sn = str(config.plugins.vuplusauthenticity.sn_b.value)
if len(sn) > sn_length or sn == '0':
return False
else:
while(len(sn)<sn_length):
sn = '0'+sn
+ if sn_length == 10:
+ if int(sn[:3]) == 0 or int(sn[3:5]) not in range(1,53) or int(sn[-5:]) == 0:
+ return False
+ else:
+ return True
if sn_length == 9:
if int(sn[:2]) not in range(28) or int(sn[2:4]) not in range(1,53) or int(sn[-5:]) == 0:
return False
if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
sn_length = 7
sn_b = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
- else:
+ if config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
sn_length = 9
+ sn_b = str(config.plugins.vuplusauthenticity.sn_b_mx.value)
+ else:
+ sn_length = 10
sn_b = str(config.plugins.vuplusauthenticity.sn_b.value)
while(len(sn_b)<sn_length):
sn_b = '0'+sn_b