def handle(self, *args, **options): if options['debug'] == True: logdebug() logger.debug("options=%s" % options) if options['telco'] is None: lsttelco = Telco.objects.all() self.stdout.write(40 * '-') for t in lsttelco: self.stdout.write("Telco %s" % t) self.stdout.write(40 * '-') raise CommandError("Please specifie option telco") else: try: self.telco = Telco.objects.get(pk=options['telco']) except: self.stdout.write(Telco.info_telcos()) raise CommandError("Telco not found") if options['typezone'] is None or not options[ 'typezone'] in list_typezone(): logger.error("typezone \n%s" % info_typezone()) raise CommandError("Please specifie option typezone") # if options['bizzone'] is None: # logger.error("bizzone \n%s"%info_bizzone()) # raise CommandError("Please specifie option bizzone") if options['infoconfig'] is None: self.stdout.write(ConfigImport.info_configimport()) raise CommandError("InfoConfig not found") try: self.infoconfig = ConfigImport.objects.get( pk=options['infoconfig']) logger.debug("infoconfig=%s" % self.infoconfig) except (ObjectDoesNotExist, ValueError) as e: logger.error("ConfigImport Info %s %s" % (options['infoconfig'], e)) self.stdout.write(ConfigImport.info_configimport()) raise CommandError("Please specifie option config") if options['filename'] is None: raise CommandError("Filename not found") try: ie_Price().import_price(type=options['typezone'], fromtelco=self.telco, config=self.infoconfig, filename=options['filename'], force=options['force']) except Exception, e: raise CommandError("%s" % e)
def handle(self, *args, **options): if options['debug'] == True: logdebug() logger.debug("options=%s"%options) if options['telco'] is None: lsttelco = Telco.objects.all() self.stdout.write(40 * '-') for t in lsttelco: self.stdout.write("Telco %s"%t) self.stdout.write(40 * '-') raise CommandError("Please specifie option telco") else: try: self.telco=Telco.objects.get(pk=options['telco']) except: self.stdout.write(Telco.info_telcos()) raise CommandError("Telco not found") if options['typezone'] is None or not options['typezone'] in list_typezone(): logger.error("typezone \n%s"%info_typezone()) raise CommandError("Please specifie option typezone") # if options['bizzone'] is None: # logger.error("bizzone \n%s"%info_bizzone()) # raise CommandError("Please specifie option bizzone") if options['infoconfig'] is None: self.stdout.write(ConfigImport.info_configimport()) raise CommandError("InfoConfig not found") try: self.infoconfig = ConfigImport.objects.get(pk=options['infoconfig']) logger.debug("infoconfig=%s"%self.infoconfig) except (ObjectDoesNotExist, ValueError) as e: logger.error("ConfigImport Info %s %s"%(options['infoconfig'], e)) self.stdout.write(ConfigImport.info_configimport()) raise CommandError("Please specifie option config") if options['filename'] is None: raise CommandError("Filename not found") try: ie_Price().import_price(type=options['typezone'], fromtelco=self.telco, config=self.infoconfig, filename=options['filename'], force=options['force']) except Exception, e: raise CommandError("%s"%e)
def handle(self, *args, **options): if getattr(settings, "DEBUG", False): self.djangodebug = True if options["debug"] == True: logdebug() logger.debug("options=%s" % options) self.workdate = datenow() logger.info("WORKDATE %s" % self.workdate) if options["auto"] is False: # automatic, TelcoInjectors par Telco logger.debug("NO AUTO") if options["telco"] is None: lsttelco = Telco.objects.all() self.stdout.write(40 * "-") for t in lsttelco: self.stdout.write("Telco %s" % t) self.stdout.write(40 * "-") raise CommandError("Please specifie option telco") else: try: self.telco = Telco.objects.get(pk=options["telco"]) except ObjectDoesNotExist, e: self.stdout.write(Telco.info_telcos()) raise CommandError("Telco not found") # if options['bizzone'] is None: # logger.error("bizzone \n%s"%info_bizzone()) # raise CommandError("Please specifie option bizzone") if options["injector"] is None: lsttelco = Telco.objects.all() for t in lsttelco: if t.injectors: self.stdout.write(40 * "-") self.stdout.write("Telco %s" % t) for p in t.injectors.all(): self.stdout.write( "Injectors : %s" % "(%s) %s [%s] [%s]" % (int(p.id), p.name, p.get_bizzone_display(), p.get_typeconnexion_display()) ) self.stdout.write(40 * "-") raise CommandError("Please specifie option injector") try: self.telcoinjector = TelcoInjector.objects.get(pk=options["injector"]) logger.debug("injector=%s" % self.telcoinjector) if options["extention"]: self.extention = options["extention"] else: self.extention = self.telcoinjector.get_typefile_display() if options["filename"]: self.thelist = glob.glob(options["filename"]) else: if options["directory"]: self.directory = options["directory"] else: self.directory = normpath(self.telcoinjector.path_dest) logger.debug( "directory=%s extention=%s list=%s" % (self.directory, self.extention, self.get_files(self.directory, self.extention)) ) except ObjectDoesNotExist, e: logger.error("Telco Injector Info %s %s" % (options["injector"], e)) raise CommandError("Please specifie option injector")
def handle(self, *args, **options): if getattr(settings, 'DEBUG', False): self.djangodebug = True if options['debug'] == True: logdebug() logger.debug("options=%s" % options) self.workdate = datenow() logger.info("WORKDATE %s" % self.workdate) if options['auto'] is False: #automatic, TelcoInjectors par Telco logger.debug("NO AUTO") if options['telco'] is None: lsttelco = Telco.objects.all() self.stdout.write(40 * '-') for t in lsttelco: self.stdout.write("Telco %s" % t) self.stdout.write(40 * '-') raise CommandError("Please specifie option telco") else: try: self.telco = Telco.objects.get(pk=options['telco']) except ObjectDoesNotExist, e: self.stdout.write(Telco.info_telcos()) raise CommandError("Telco not found") #if options['bizzone'] is None: # logger.error("bizzone \n%s"%info_bizzone()) # raise CommandError("Please specifie option bizzone") if options['injector'] is None: lsttelco = Telco.objects.all() for t in lsttelco: if t.injectors: self.stdout.write(40 * '-') self.stdout.write("Telco %s" % t) for p in t.injectors.all(): self.stdout.write( "Injectors : %s" % "(%s) %s [%s] [%s]" % (int(p.id), p.name, p.get_bizzone_display(), p.get_typeconnexion_display())) self.stdout.write(40 * '-') raise CommandError("Please specifie option injector") try: self.telcoinjector = TelcoInjector.objects.get( pk=options['injector']) logger.debug("injector=%s" % self.telcoinjector) if options['extention']: self.extention = options['extention'] else: self.extention = self.telcoinjector.get_typefile_display() if options['filename']: self.thelist = glob.glob(options['filename']) else: if options['directory']: self.directory = options['directory'] else: self.directory = normpath(self.telcoinjector.path_dest) logger.debug( "directory=%s extention=%s list=%s" % (self.directory, self.extention, self.get_files(self.directory, self.extention))) except ObjectDoesNotExist, e: logger.error("Telco Injector Info %s %s" % (options['injector'], e)) raise CommandError("Please specifie option injector")