Exemplo n.º 1
0
def commitTarget(target):
    cmd1 = 'svn add --quiet --force .'
    cmd2 = 'svn commit --non-interactive -m "Automated Commit on %s" .' % (_utils.timeStampLocalTime())
    cmds = ['cd "%s"' % (target)]
    cmds.append(cmd1)
    cmds.append(cmd2)
    _commitTarget(cmds)
Exemplo n.º 2
0
 def make_node(self,
               _id=-1,
               _parent=-1,
               _name='',
               _creation_date=_utils.timeStampLocalTime(),
               _modification_date=_utils.timeStampLocalTime(),
               _is_active=False,
               _is_file=False,
               _is_url=False):
     return Node(id=_id,
                 name=_name,
                 parent=_parent,
                 creation_date=default_date(_creation_date),
                 modification_date=default_date(_modification_date),
                 is_active=_is_active,
                 is_file=_is_file,
                 is_url=_is_url)
Exemplo n.º 3
0
    def execute(self,callback=None,changeFlags=None):
        if (not self.__running__):
            if (changeFlags):
                self.__changes__ = changeFlags
                
            if (callable(callback)):
                self.__callback__ = callback
            
            self.__running__ = True

            name = _utils.getProgramName()
            fpath = os.path.dirname(sys.argv[0])
            _log_path = _utils.safely_mkdir_logs(fpath=fpath)
            _log_path = _utils.safely_mkdir(fpath=_log_path,dirname=_utils.timeStampLocalTimeForFileName(delimiters=('_','-'),format=_utils.formatSalesForceTimeStr()))
            
            logFileName = os.sep.join([_log_path,'%s.log' % (name)])
            
            print '(%s) :: logFileName=%s' % (_utils.timeStampLocalTime(),logFileName)
    
            _logging = logging.INFO
            _console_logging = logging.INFO
    
            standardLogging.standardLogging(logFileName,_level=_logging,console_level=_console_logging,isVerbose=True)
    
            self.dequeue_logging()
    
            self.report_changes(self.__changes__)
    
            if (os.path.exists(self.__watching__)):
                FILE_LIST_DIRECTORY = 0x0001
                self.__hDir__ = win32file.CreateFile (
                    self.__watching__,
                    FILE_LIST_DIRECTORY,
                    win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
                    None,
                    win32con.OPEN_EXISTING,
                    win32con.FILE_FLAG_BACKUP_SEMANTICS,
                    None
                )

                while (self.__running__):
                    for action,aFile in win32file.ReadDirectoryChangesW(self.__hDir__,1024,True,self.__changes__,None,None):
                        fpath = os.path.join(self.__watching__, aFile)
                        action = Actions(action)
                        self.ProcessChange(action,aFile)
            else:
                print >>sys.stderr, 'ERROR: Nothing to do unless you watch a directory.'
Exemplo n.º 4
0
if not options.database:
    parser.error("You must specify the database name")
    _utils.terminate('Cannot continue without the database name on the command line.')

__cwd__ = os.path.expanduser("~")
name = _utils.getProgramName()
fpath = __cwd__
_log_path = _utils.safely_mkdir_logs(fpath=fpath)
_log_path = _utils.safely_mkdir(fpath=_log_path,dirname=_utils.timeStampLocalTimeForFileName(delimiters=('_','-'),format=_utils.formatSalesForceTimeStr()))
if (not os.path.exists(_log_path)):
    print >> sys.stderr, 'Logging path does not exist at "%s".' % (_log_path)

logFileName = os.sep.join([_log_path,'%s.log' % (name)])

print '(%s) :: Logging to "%s".' % (_utils.timeStampLocalTime(),logFileName)
    
from standalone.conf import settings

from vyperlogix.django import django_utils
DOMAIN_NAME = django_utils.socket.gethostname()
print '1.DOMAIN_NAME=%s' % (DOMAIN_NAME)
if (DOMAIN_NAME in ['HPDV7-6163us']):
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': options.database,
            'USER' : 'root',
            'PASSWORD' : 'peekab00',
            'HOST' : '192.168.1.248',
            'PORT' : '3306',
Exemplo n.º 5
0
class VyperDjangoMiddleware(object):
    def __adjust_apps__(self, apps, aSite):
        i_apps = apps
        o_apps = [
            app for app in i_apps if (not app.startswith('django.'))
        ]  # seek to determine which apps are from django and which are not...
        _apps = list(set(i_apps) - set(o_apps))
        o_apps = [
            '%s.%s' % (aSite.__name__, app.split('.')[-1]) for app in o_apps
        ]
        return tuple(_apps + o_apps)

    def process_request(self, request):
        url_toks = django_utils.parse_url_parms(request)

        http_host = request.META['HTTP_X_FORWARDED_SERVER'] if (
            request.META.has_key('HTTP_X_FORWARDED_SERVER')
        ) else request.META['HTTP_HOST']
        _host = http_host.split(':')[0]

        s = 'combined%s.settings' % ('.django' if (
            not django_utils.isProduction(django_utils._cname)) else '')
        m = LazyImport.LazyImport(s)
        m = m.__lazyimport_import
        settings._target = None
        settings.configure(**m.__dict__)

        d = lists.HashedLists2(
            dict([(k, v) for k, v in m.__dict__.iteritems()
                  if (not k.startswith('__')) and (not k.endswith('__')) and (
                      ObjectTypeName.typeClassName(v) != 'module')]))
        if (django_utils.isBeingDebugged) and (sys.platform != 'win32'):
            fout = open('/home/raychorn/debug.txt', 'w')
            try:
                print >> fout, '_host is "%s".' % (_host)
                print >> fout, '%s\n' % ('=' * 80)
                d.prettyPrint(title=s, fOut=fout)
            finally:
                fout.flush()
                fout.close()

        r_url = settings.ROOT_URLCONF

        isAdjustingInstalledApps = False
        if (settings.SITES.has_key(_host)):
            aSite = settings.SITES[_host]
            s = '%s.settings' % (aSite.__name__)
            m = LazyImport.LazyImport(s)
            m = m.__lazyimport_import

            d = dict([
                (k, v) for k, v in m.__dict__.iteritems()
                if (not k.startswith('__')) and (not k.endswith('__')) and (
                    ObjectTypeName.typeClassName(v) != 'module')
            ])
            if (d.has_key('INSTALLED_APPS')):
                d['INSTALLED_APPS'] = self.__adjust_apps__(
                    d['INSTALLED_APPS'], aSite)
                m.__dict__['INSTALLED_APPS'] = d['INSTALLED_APPS']
            request.session['settings'] = d

            settings._target = None
            settings.configure(**m.__dict__)

            d = lists.HashedLists2(
                dict([(k, v) for k, v in m.__dict__.iteritems()
                      if (not k.startswith('__')) and (not k.endswith('__'))
                      and (ObjectTypeName.typeClassName(v) != 'module')]))

            _path = aSite.__path__[0]

            x = ListWrapper.ListWrapper(sys.path)
            xi = x.findAllMatching(_path)
            if (len(xi) == 0):
                sys.path.insert(0, _path)

            isAdjustingInstalledApps = True
            settings.ROOT_URLCONF = '%s.%s' % (
                aSite.__name__, settings.ROOT_URLCONF.split('.')[-1])
        else:
            settings.ROOT_URLCONF = s.replace('.settings', '.urls')

        _app_loader_errors = []
        if (settings.INSTALLED_APPS):
            loading._loaded = False
            loading._app_list = []
            loading._app_models = {}
            for app in settings.INSTALLED_APPS:
                try:
                    aModule = loading.load_app(app)
                    app_name = app.split('.')[-1]
                    if (aModule is not None) and (
                            not loading._app_models.has_key(app_name)):
                        reload(aModule)
                except ImportError, e:
                    if (str(e).find('No module named') == -1):
                        _app_loader_errors.append(
                            _utils.formattedException(details=e))
            loading._loaded = True

        if (sys.platform != 'win32'):
            fname = '/home/raychorn/debug/%s/debug-apps.txt' % ('_'.join(
                _utils.timeStampForFileName().split('_')[0:-1]))
            _utils._makeDirs(os.path.dirname(fname))
            fout = open(fname, 'a')
            try:
                ts = ' '.join(_utils.timeStampLocalTime().split('T'))
                print >> fout, 'BEGIN: %s :: %s' % (ts, '=' * 80)
                print >> fout, '_host is "%s".' % (_host)
                print >> fout, '%s\n' % ('-' * 80)
                del d['SECRET_KEY']
                del d['DATABASE_PASSWORD']
                d.prettyPrint(title=s, fOut=fout)
                if (len(_app_loader_errors) > 0):
                    ReportTheList.reportTheList(_app_loader_errors,
                                                'App Loader Errors',
                                                fOut=fout)
                print >> fout, 'END!   %s :: %s\n\n' % (ts, '=' * 80)
            finally:
                fout.flush()
                fout.close()
Exemplo n.º 6
0
 def queue_logging(self,level,msg):
     _msg = '%s --> %s' % (_utils.timeStampLocalTime(),msg)
     self.__outputQ__.put_nowait(SmartObject({'msg':_msg,'level':level}))