[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-logonpy/usr/share/se3/logonpy_Win9x/ -> se3Logon.py (source)

   1  # -*- coding: utf-8 -*-
   2  import sys, os, posix
   3  from se3Utils import *
   4  
   5  class se3Logon:
   6  
   7      def __init__ (self, path2BatFiles, path2Templates, user, computer, master, arch):
   8          """
   9              Open logon bat, some initializations
  10          """
  11          try: 
  12              self.__logonU = open ("%s/%s.bat" % (path2BatFiles, computer), 'w')
  13              self.__logonU.write ("\\\\%s\\netlogon\\killexplorer.exe 0\r\n" % master)
  14              self.__logonU.write ("cscript \\\\%s\\netlogon\\%s.vbs\r\n" % (master, computer))
  15              self.__tplPath = path2Templates
  16              self.__user = user
  17              self.__computer = computer
  18              self.__master = master
  19              self.__arch = arch
  20  
  21          except OSError:
  22              print "Can't create %s/%s/.bat" % (computer, user)
  23              sys.exit (1)
  24              
  25  
  26      def __del__ (self):
  27          """
  28              Close logon bat
  29          """
  30          try:
  31              self.__logonU.write ("\\\\%s\\netlogon\\fde.exe\r\n" % self.__master)
  32              self.__logonU.close ()
  33              
  34          except OSError:
  35             print "Can't write %s/%s.bat" % (self.__user, self.__computer)
  36  
  37  
  38      def addTemplateslogon (self, templates):
  39          """
  40              Add templates logon, ignore se3printers.bat
  41          """
  42          try:
  43              for template in templates:
  44                  if os.access ("%s/%s/logon.bat" % (self.__tplPath, template), os.F_OK):
  45                      file = open ("%s/%s/logon.bat" \
  46                                    % (self.__tplPath, template))
  47                      for line in file.readlines ():
  48                          self.__logonU.writelines (line)
  49                      self.__logonU.writelines ("\r\n")
  50                      file.close ()
  51                  if os.access ("%s/%s/logon_%s.bat" % (self.__tplPath, template, self.__arch), os.F_OK):
  52                      file = open ("%s/%s/logon_%s.bat" \
  53                                    % (self.__tplPath, template, self.__arch))
  54                      for line in file.readlines ():
  55                          self.__logonU.writelines (line)
  56                      self.__logonU.writelines ("\r\n")
  57                      file.close ()
  58                
  59          except OSError:
  60              print "Can't write %s logon in %s/%s.bat" % (template, self.__user, self.__computer)


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1