Exemplo n.º 1
0
    def __create_variable_info(self, options):
        all_info = ConfigRegistryInfo(registered_only=False)
        info = ConfigRegistryInfo(install_mode=True)
        info.read_customized()
        var = Variable()

        # description
        for line in options['descriptions']:
            text = line['text']
            if not text:
                continue
            if 'lang' in line:
                var['description[%s]' % line['lang']] = text
            else:
                var['description'] = text
        # categories
        if options['categories']:
            var['categories'] = ','.join(options['categories'])

        # type
        var['type'] = options['type']

        # are there any modifications?
        old_value = all_info.get_variable(options['key'])
        if old_value != var:
            # save
            info.add_variable(options['key'], var)
            info.write_customized()
Exemplo n.º 2
0
	def __create_variable_info( self, options ):
		all_info = ConfigRegistryInfo( registered_only = False )
		info = ConfigRegistryInfo( install_mode = True )
		info.read_customized()
		var = Variable()

		# description
		for line in options[ 'descriptions' ]:
			text = line[ 'text' ]
			if not text: continue
			if 'lang' in line:
				var[ 'description[%s]' % line[ 'lang' ] ] = text
			else:
				var[ 'description' ] = text
		# categories
		if options[ 'categories' ]:
			var[ 'categories' ] = ','.join( options[ 'categories' ] )

		# type
		var[ 'type' ] = options[ 'type' ]

		# are there any modifications?
		old_value = all_info.get_variable( options[ 'key' ] )
		if old_value != var:
			# save
			info.add_variable( options[ 'key' ], var )
			info.write_customized()