View | Details | Raw Unified | Return to bug 26268 | Differences between
and this patch

Collapse All | Expand All

(-)scripts/univention-management-console-client (-16 / +24 lines)
 Lines 156-176    Link Here 
156
				print '  ARGUMENTS: %s' % pprint.pformat( msg.arguments )
156
				print '  ARGUMENTS: %s' % pprint.pformat( msg.arguments )
157
			else:
157
			else:
158
				print '  ARGUMENTS: %s' % ' '.join( msg.arguments )
158
				print '  ARGUMENTS: %s' % ' '.join( msg.arguments )
159
		print '  STATUS   : %d' % msg.status
159
		print 'MIMETYPE   : %s' % msg.mimetype
160
		if msg.options:
160
		if msg.mimetype == umcp.MIMETYPE_JSON:
161
			print '  STATUS   : %d' % msg.status
162
			if msg.options:
163
				if self._options.prettyprint:
164
					print '  OPTIONS  : %s' % pprint.pformat( msg.options, indent = 2 )
165
				else:
166
					if isinstance( msg.options, ( list, tuple ) ):
167
						print '  OPTIONS  : %s' % ', '.join( map( lambda x: str( x ), msg.options ) )
168
					else:
169
						print '  OPTIONS  : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] )
170
			print '  MESSAGE  : %s' % msg.message
161
			if self._options.prettyprint:
171
			if self._options.prettyprint:
162
				print '  OPTIONS  : %s' % pprint.pformat( msg.options, indent = 2 )
172
				print '  RESULT   : %s' % pprint.pformat( msg.result, indent = 2 )
163
			else:
173
			else:
164
				if isinstance( msg.options, ( list, tuple ) ):
174
				print '  RESULT   : %s' % msg.result
165
					print '  OPTIONS  : %s' % ', '.join( map( lambda x: str( x ), msg.options ) )
175
			if msg.status is not None:
166
				else:
176
				raise ClientExit( msg.status - 200 )
167
					print '  OPTIONS  : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] )
168
		print '  MESSAGE  : %s' % msg.message
169
		if self._options.prettyprint:
170
			print '  RESULT   : %s' % pprint.pformat( msg.result, indent = 2 )
171
		else:
177
		else:
172
			print '  RESULT   : %s' % msg.result
178
			print 'BODY       : %s' % str( msg.body )
173
		raise ClientExit( msg.status - 200 )
179
		raise ClientExit()
174
180
175
if __name__ == '__main__':
181
if __name__ == '__main__':
176
	notifier.init( notifier.GENERIC )
182
	notifier.init( notifier.GENERIC )
 Lines 255-262    Link Here 
255
	try:
261
	try:
256
		notifier.loop()
262
		notifier.loop()
257
	except ClientExit, exit:
263
	except ClientExit, exit:
258
		exitcode = int( exit.args[ 0 ] )
264
		if exit.args:
259
		if exitcode == 200:
265
			exitcode = int( exit.args[ 0 ] )
260
			exitcode = 0
266
			if exitcode == 200:
261
		sys.exit( exitcode )
267
				exitcode = 0
268
			sys.exit( exitcode )
269
		sys.exit( 0 )
262
270
(-)src/univention/management/console/protocol/message.py (-3 / +3 lines)
 Lines 82-88    Link Here 
82
		self.command = command
82
		self.command = command
83
		self.arguments = arguments
83
		self.arguments = arguments
84
		self.mimetype = mime_type
84
		self.mimetype = mime_type
85
		self.options = options
85
		if mime_type == MIMETYPE_JSON:
86
			self.options = options
86
		if data:
87
		if data:
87
			self.parse( data )
88
			self.parse( data )
88
89
 Lines 129-142    Link Here 
129
				self.body[ key ] = value
130
				self.body[ key ] = value
130
		else:
131
		else:
131
			PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) )
132
			PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) )
132
			raise AttributeError( _( 'Attribute %s just available for MIME type %s' ) % ( key, MIMETYPE_JSON ) )
133
133
134
	def _get_key( self, key ):
134
	def _get_key( self, key ):
135
		if self.mimetype == MIMETYPE_JSON:
135
		if self.mimetype == MIMETYPE_JSON:
136
			return self.body.get( key )
136
			return self.body.get( key )
137
		else:
137
		else:
138
			PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) )
138
			PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) )
139
			raise AttributeError( _( 'Attribute %s just available for MIME type %s' ) % ( key, MIMETYPE_JSON ) )
139
			return None
140
140
141
	# property: message
141
	# property: message
142
	message = property( lambda self: self._get_key( 'message' ), lambda self, value: self._set_key( 'message', value ) )
142
	message = property( lambda self: self._get_key( 'message' ), lambda self, value: self._set_key( 'message', value ) )
(-)src/univention/management/console/protocol/server.py (-1 / +1 lines)
 Lines 264-270    Link Here 
264
		request.'''
264
		request.'''
265
		# FIXME: error handling is missing!!
265
		# FIXME: error handling is missing!!
266
		if not msg.id in state.requests and msg.id != -1:
266
		if not msg.id in state.requests and msg.id != -1:
267
			CORE.process( 'The given response is invalid or not known' )
267
			CORE.info( 'The given response is invalid or not known (%s)' % msg.id )
268
			return
268
			return
269
269
270
		try:
270
		try:
(-)src/univention/management/console/modules/__init__.py (+2 lines)
 Lines 141-146    Link Here 
141
			res = Response( object )
141
			res = Response( object )
142
			res.result = response
142
			res.result = response
143
			res.message = message
143
			res.message = message
144
		else:
145
			res = response
144
146
145
		if not res.status:
147
		if not res.status:
146
			if status is not None:
148
			if status is not None:

Return to bug 26268