Univention Bugzilla – Attachment 4312 Details for
Bug 26703
UMC Modul: Notifier austauschbar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
notifier implementation
notifier.patch (text/plain), 4.04 KB, created by
Andreas Büsching
on 2012-04-04 21:07 CEST
(
hide
)
Description:
notifier implementation
Filename:
MIME Type:
Creator:
Andreas Büsching
Created:
2012-04-04 21:07 CEST
Size:
4.04 KB
patch
obsolete
>Index: scripts/univention-management-console-module >=================================================================== >--- scripts/univention-management-console-module (Revision 31915) >+++ scripts/univention-management-console-module (Arbeitskopie) >@@ -43,23 +43,22 @@ > import sys > > import notifier >+import notifier.log as nflog > > if __name__ == '__main__': > if os.getuid() != 0: > sys.stderr.write( '%s must be started as root\n' % os.path.basename( sys.argv[ 0 ] ) ) > sys.exit( 1 ) > >- notifier.init( notifier.GENERIC ) >- > parser = OptionParser( usage = "usage: %prog [options]" ) >- parser.add_option( '-s', '--socket', type = 'string', action = 'store', >- dest = 'socket', help = 'defines the socket to bind to' ) >- parser.add_option( '-l', '--language', type = 'string', action = 'store', >- dest = 'language', default = 'C', >+ parser.add_option( '-s', '--socket', type = 'string', action = 'store', dest = 'socket', >+ help = 'defines the socket to bind to' ) >+ parser.add_option( '-l', '--language', type = 'string', action = 'store', dest = 'language', default = 'C', > help = 'defines the language to use' ) >- parser.add_option( '-m', '--module', type = 'string', >- action = 'store', dest = 'module', >+ parser.add_option( '-m', '--module', type = 'string', action = 'store', dest = 'module', > help = 'set the UMC daemon module to load' ) >+ parser.add_option( '-n', '--notifier', type = 'string', action = 'store', dest = 'notifier', default = 'generic', >+ help = 'defines the notifier implementation to use' ) > > default_debug = MODULE_DEBUG_LEVEL > parser.add_option( '-d', '--debug', action = 'store', type = 'int', dest = 'debug', default = default_debug, >@@ -71,8 +70,21 @@ > daemon = DaemonContext( detach_process = False, umask = 0077 ) > daemon.open() > >+ # MUST be called after initializing the deamon >+ if options.notifier.lower() == 'generic': >+ notifier.init( notifier.GENERIC ) >+ elif options.notifier.lower() == 'qt': >+ import PyQt4.Qt as qt >+ qApp = qt.QCoreApplication( sys.argv ) >+ notifier.init( notifier.QT ) >+ > # init logging > debug_fd = log_init( '%s-%s' % ( options.logfile, options.module ), options.debug ) >+ # no notifier logging >+ nflog.instance.handlers = [] >+ # to activate notifier logging >+ # nflog.set_level( nflog.DEBUG ) >+ # nflog.open() > > localeok = False > try: >Index: src/univention/management/console/protocol/session.py >=================================================================== >--- src/univention/management/console/protocol/session.py (Revision 31915) >+++ src/univention/management/console/protocol/session.py (Arbeitskopie) >@@ -98,7 +98,10 @@ > def __init__( self, module, debug = '0', locale = None ): > socket = '/var/run/univention-management-console/%u-%lu.socket' % ( os.getpid(), long( time.time() * 1000 ) ) > # determine locale settings >+ mod = moduleManager[ module ] > args = [ MODULE_COMMAND, '-m', module, '-s', socket, '-d', str( debug ) ] >+ if mod.notifier: >+ args.extend( [ '-n', mod.notifier ] ) > if locale: > args.extend( ( '-l', '%s' % locale ) ) > self.__locale = locale >Index: src/univention/management/console/protocol/modserver.py >=================================================================== >--- src/univention/management/console/protocol/modserver.py (Revision 31915) >+++ src/univention/management/console/protocol/modserver.py (Arbeitskopie) >@@ -135,7 +135,7 @@ > except ( ParseError, UnknownCommandError ), e: > MODULE.error( 'Failed to parse message: %s' % str( e ) ) > res = Response( msg ) >- res.id( -1 ) >+ res.id = -1 > res.status = e.args[ 0 ] > self.response( res ) > >Index: src/univention/management/console/module.py >=================================================================== >--- src/univention/management/console/module.py (Revision 31915) >+++ src/univention/management/console/module.py (Arbeitskopie) >@@ -134,6 +134,10 @@ > return self.find( 'module' ).get( 'id' ) > > @property >+ def notifier( self ): >+ return self.find( 'module' ).get( 'notifier' ) >+ >+ @property > def icon( self ): > return self.find( 'module' ).get( 'icon' ) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 26703
: 4312