コード例 #1
0
ファイル: plugoutindex.py プロジェクト: divadrei/bots
def start():
    #NOTE: bots directory should always be on PYTHONPATH - otherwise it will not start.
    #***command line arguments**************************
    usage = '''
    This is "%(name)s" version %(version)s, part of Bots open source edi translator (http://bots.sourceforge.net).
    A utility to generate the index file of a plugin; this can be seen as a database dump of the configuration.
    This is eg useful for version control.
    Usage:
        %(name)s  -c<directory>
    Options:
        -c<directory>   directory for configuration files (default: config).
        
    '''%{'name':os.path.basename(sys.argv[0]),'version':botsglobal.version}
    configdir = 'config'
    for arg in sys.argv[1:]:
        if arg.startswith('-c'):
            configdir = arg[2:]
            if not configdir:
                print 'Error: configuration directory indicated, but no directory name.'
                sys.exit(1)
        else:
            print usage
            sys.exit(0)
    #***end handling command line arguments**************************
    botsinit.generalinit(configdir)     #find locating of bots, configfiles, init paths etc.
    import pluglib              #import here, import at start of file gives error; first initialize.
    usersys = botsglobal.ini.get('directories','usersysabs')
    index_filename = os.path.join(usersys,'index.py')
    dummy_for_cleaned_data = {'databaseconfiguration':True,'umlists':True,'databasetransactions':False}
    pluglib.make_index(dummy_for_cleaned_data,index_filename)
コード例 #2
0
ファイル: views.py プロジェクト: edi-enthusiasts/django-bots
def plugout_index(request, *kw, **kwargs):
    if request.method == 'GET':
        filename = botslib.join(
            botsglobal.ini.get('directories', 'usersysabs'), 'index.py')
        botsglobal.logger.info(
            _(u'Start writing configuration index file "%(file)s".'),
            {'file': filename})
        try:
            dummy_for_cleaned_data = {
                'databaseconfiguration':
                True,
                'umlists':
                botsglobal.ini.getboolean('settings', 'codelists_in_plugin',
                                          True),
                'databasetransactions':
                False
            }
            pluglib.make_index(dummy_for_cleaned_data, filename)
        except Exception as msg:
            notification = _(u'Error writing configuration index file: "%s".'
                             ) % unicode(msg)
            botsglobal.logger.error(notification)
            messages.add_message(request, messages.INFO, notification)
        else:
            notification = _(
                u'Configuration index file "%s" is written successful.'
            ) % filename
            botsglobal.logger.info(notification)
            messages.add_message(request, messages.INFO, notification)
        return django.shortcuts.redirect('/home')
コード例 #3
0
def start():
    #NOTE: bots directory should always be on PYTHONPATH - otherwise it will not start.
    #***command line arguments**************************
    usage = '''
    This is "%(name)s" version %(version)s, part of Bots open source edi translator (http://bots.sourceforge.net).
    A utility to generate the index file of a plugin; this can be seen as a database dump of the configuration.
    This is eg useful for version control.
    Usage:
        %(name)s  -c<directory>
    Options:
        -c<directory>   directory for configuration files (default: config).
        
    '''%{'name':os.path.basename(sys.argv[0]),'version':botsglobal.version}
    configdir = 'config'
    for arg in sys.argv[1:]:
        if arg.startswith('-c'):
            configdir = arg[2:]
            if not configdir:
                print 'Error: configuration directory indicated, but no directory name.'
                sys.exit(1)
        else:
            print usage
            sys.exit(0)
    #***end handling command line arguments**************************
    botsinit.generalinit(configdir)     #find locating of bots, configfiles, init paths etc.
    import pluglib              #import here, import at start of file gives error; first initialize.
    usersys = botsglobal.ini.get('directories','usersysabs')
    index_filename = os.path.join(usersys,'index.py')
    dummy_for_cleaned_data = {'databaseconfiguration':True,'umlists':botsglobal.ini.getboolean('settings','codelists_in_plugin',True),'databasetransactions':False}
    pluglib.make_index(dummy_for_cleaned_data,index_filename)
コード例 #4
0
ファイル: views.py プロジェクト: divadrei/bots
def plugout_index(request,*kw,**kwargs):
    if request.method == 'GET':
        filename = botslib.join(botsglobal.ini.get('directories','usersysabs'),'index.py')
        botsglobal.logger.info(_(u'Start writing configuration index file "%s".'),filename)
        try:
            dummy_for_cleaned_data = {'databaseconfiguration':True,'umlists':True,'databasetransactions':False}
            pluglib.make_index(dummy_for_cleaned_data,filename)
        except Exception,msg:
            notification = _(u'Error writing configuration index file: "%s".')%str(msg)
            botsglobal.logger.error(notification)
            messages.add_message(request, messages.INFO, notification)
        else:
            notification = _(u'Configuration index file "%s" is written successful.')%filename
            botsglobal.logger.info(notification)
            messages.add_message(request, messages.INFO, notification)
        return django.shortcuts.redirect('/home')
コード例 #5
0
ファイル: plugoutindex.py プロジェクト: LH-Ventures/bots-edi
def start(configdir):
    """A utility to generate the index file of a plugin;
    this can be seen as a database dump of the configuration.
    This is eg useful for version control.
    """
    botsinit.generalinit(configdir)
    import pluglib  # import here, import at start of file gives error; first initialize.

    usersys = botsglobal.ini.get('directories', 'usersysabs')
    index_filename = os.path.join(usersys, 'index.py')

    dummy_for_cleaned_data = {
        'databaseconfiguration':
        True,
        'umlists':
        botsglobal.ini.getboolean('settings', 'codelists_in_plugin', True),
        'databasetransactions':
        False,
    }

    pluglib.make_index(dummy_for_cleaned_data, index_filename)