def test_versionTupleToString(self): self.assertEquals(common.versionTupleToString((1, )), "1") self.assertEquals(common.versionTupleToString((1, 2, )), "1.2") self.assertEquals(common.versionTupleToString((1, 2, 3, )), "1.2.3") self.assertEquals(common.versionTupleToString((1, 2, 3, 0, )), "1.2.3") self.assertEquals(common.versionTupleToString((1, 2, 3, 1, )), "1.2.3.1")
def getWebLink(section, anchor, version=None, projectURL=None): """ Get a documentation link based on the parameters. @param section: section, usually the name of the html file @type section: string @param anchor: name of the anchor, part of a section @type anchor: string @param version: optional, version to use. If this is not specified the version from configure.version will be used @type version: string @param projectURL, url for the project this link belongs to. @type projectURL: string @returns: the constructed documentation link @rtype: string """ if version is None: version = configure.version # FIXME: if the version has a nano, do something sensible, like # drop the nano or always link to trunk version versionTuple = version.split('.') version = common.versionTupleToString(versionTuple[:3]) if projectURL is None: projectURL = 'http://www.flumotion.net/doc/flumotion/manual' if anchor: anchor = '#%s' % anchor return '%s/%s/%s/html/%s.html%s' % (projectURL, getLL(), version, section, anchor)
def getWebLink(section, anchor, version=None, projectURL=None): """ Get a documentation link based on the parameters. @param section: section, usually the name of the html file @type section: string @param anchor: name of the anchor, part of a section @type anchor: string @param version: optional, version to use. If this is not specified the version from configure.version will be used @type version: string @param projectURL, url for the project this link belongs to. @type projectURL: string @returns: the constructed documentation link @rtype: string """ if version is None: version = configure.version # FIXME: if the version has a nano, do something sensible, like # drop the nano or always link to trunk version versionTuple = version.split('.') version = common.versionTupleToString(versionTuple[:3]) if projectURL is None: projectURL = 'http://www.flumotion.net/doc/flumotion/manual' if anchor: anchor = '#%s' % anchor return '%s/%s/%s/html/%s.html%s' % ( projectURL, getLL(), version, section, anchor)
def test_versionTupleToString(self): self.assertEquals(common.versionTupleToString((1, )), "1") self.assertEquals(common.versionTupleToString(( 1, 2, )), "1.2") self.assertEquals(common.versionTupleToString(( 1, 2, 3, )), "1.2.3") self.assertEquals(common.versionTupleToString(( 1, 2, 3, 0, )), "1.2.3") self.assertEquals(common.versionTupleToString(( 1, 2, 3, 1, )), "1.2.3.1")
def _writeComponent(self, component, isFeedComponent=True): config = component.get('config') attrs = [('name', component.get('name')), ('type', component.get('type')), ('label', config.get('label', component.get('name'))), ('worker', component.get('workerRequested')), ('project', config['project']), ('version', common.versionTupleToString(config['version']))] self.pushTag('component', attrs) for name, feeders in config['eater'].items(): self._writeEater(name, feeders) self._writeProperties(config['properties'].items()) if isFeedComponent: if config['clock-master'] == config['avatarId']: value = 'true' else: value = 'false' self.writeTag('clock-master', data=value) self._writePlugs(config['plugs'].items()) self._writeVirtualFeeds(config['virtual-feeds'].items()) self.popTag() self.writeLine()
def _addComponent(self, conf, parent, identity): """ Add a component state for the given component config entry. @rtype: L{flumotion.common.planet.ManagerComponentState} """ self.debug('adding component %s to %s' % (conf.name, parent.get('name'))) if identity != LOCAL_IDENTITY: self.adminAction(identity, '_addComponent', (conf, parent), {}) state = planet.ManagerComponentState() state.set('name', conf.name) state.set('type', conf.getType()) state.set('workerRequested', conf.worker) state.setMood(moods.sleeping.value) state.set('config', conf.getConfigDict()) state.set('parent', parent) parent.append('components', state) avatarId = conf.getConfigDict()['avatarId'] self.clearMessage('loadComponent-%s' % avatarId) configDict = conf.getConfigDict() projectName = configDict['project'] versionTuple = configDict['version'] projectVersion = None try: projectVersion = project.get(projectName, 'version') except errors.NoProjectError: m = messages.Warning(T_(N_( "This component is configured for Flumotion project '%s', " "but that project is not installed.\n"), projectName)) state.append('messages', m) if projectVersion: self.debug('project %s, version %r, project version %r' % ( projectName, versionTuple, projectVersion)) if not common.checkVersionsCompat( versionTuple, common.versionStringToTuple(projectVersion)): m = messages.Warning(T_(N_( "This component is configured for " "Flumotion '%s' version %s, " "but you are running version %s.\n" "Please update the configuration of the component.\n"), projectName, common.versionTupleToString(versionTuple), projectVersion)) state.append('messages', m) # add to mapper m = ComponentMapper() m.state = state m.id = avatarId self._componentMappers[state] = m self._componentMappers[avatarId] = m return state