def getSMW_WikiUser(wikiId="smw"): ''' get semantic media wiki users for SemanticMediawiki.org and openresearch.org ''' iniFile = WikiUser.iniFilePath(wikiId) wikiUser = None if not os.path.isfile(iniFile): wikiDict = None if wikiId == "smw": wikiDict = { "wikiId": wikiId, "url": "https://www.semantic-mediawiki.org", "scriptPath": "/w", "version": "MediaWiki 1.31.7" } if wikiId == "or": wikiDict = { "wikiId": wikiId, "url": "https://www.openresearch.org", "scriptPath": "/mediawiki/", "version": "MediaWiki 1.31.1" } if wikiDict is None: raise Exception("%s missing for wikiId %s" % (iniFile, wikiId)) else: wikiUser = WikiUser.ofDict(wikiDict, lenient=True) if getpass.getuser() == "travis": wikiUser.save() else: wikiUser = WikiUser.ofWikiId(wikiId, lenient=True) return wikiUser
def getSMW_WikiUser(wikiId="cr"): ''' get semantic media wiki users for SemanticMediawiki.org and openresearch.org ''' iniFile = WikiUser.iniFilePath(wikiId) wikiUser = None if not os.path.isfile(iniFile): wikiDict = None if wikiId == "smwcopy": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "http://smw.bitplan.com", "scriptPath": "", "version": "MediaWiki 1.35.0" } elif wikiId == "cr": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "http://cr.bitplan.com", "scriptPath": "", "version": "MediaWiki 1.33.4" } elif wikiId == "smw": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "https://www.semantic-mediawiki.org", "scriptPath": "/w", "version": "MediaWiki 1.31.7" } elif wikiId == "or": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "https://www.openresearch.org", "scriptPath": "/mediawiki/", "version": "MediaWiki 1.31.1" } elif wikiId == 'wiki': wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "http://wiki.bitplan.com", "scriptPath": "", "version": "MediaWiki 1.27.3" } if wikiDict is None: raise Exception("%s missing for wikiId %s" % (iniFile, wikiId)) else: wikiUser = WikiUser.ofDict(wikiDict, lenient=True) user = getpass.getuser() print("user is: %s" % user) # check the continuous integration users if user == "travis" or user == "runner": wikiUser.save() else: wikiUser = WikiUser.ofWikiId(wikiId, lenient=True) return wikiUser
def testWikiUser(self): ''' test the wiki user handling ''' if getpass.getuser() == "travis": return wikiUsers = WikiUser.getWikiUsers() for wikiUser in wikiUsers.values(): print(wikiUser) testUser = WikiUser.ofWikiId("test") print(testUser) pass
def testWikiUser(self): ''' test the wiki user handling ''' if TestWikiUser.inPublicCI(): return wikiUsers = WikiUser.getWikiUsers() for wikiUser in wikiUsers.values(): if self.debug: print(wikiUser) testUser = WikiUser.ofWikiId("test") if self.debug: print(testUser) self.assertEqual("http://test.bitplan.com", testUser.getWikiUrl()) pass
def getSMW_WikiUser(wikiId="smw"): ''' get semantic media wiki users for SemanticMediawiki.org and openresearch.org ''' iniFile = WikiUser.iniFilePath(wikiId) wikiUser = None if not os.path.isfile(iniFile): wikiDict = None if wikiId == "smwcopy": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "http://smw.bitplan.com", "scriptPath": "", "version": "MediaWiki 1.35.0" } if wikiId == "smw": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "https://www.semantic-mediawiki.org", "scriptPath": "/w", "version": "MediaWiki 1.31.7" } if wikiId == "or": wikiDict = { "wikiId": wikiId, "email": "*****@*****.**", "url": "https://www.openresearch.org", "scriptPath": "/mediawiki/", "version": "MediaWiki 1.31.1" } if wikiDict is None: raise Exception("%s missing for wikiId %s" % (iniFile, wikiId)) else: wikiUser = WikiUser.ofDict(wikiDict, lenient=True) if TestWikiUser.inPublicCI(): wikiUser.save() else: wikiUser = WikiUser.ofWikiId(wikiId, lenient=True) return wikiUser
def ofWikiId(wikiId): wikiUser = WikiUser.ofWikiId(wikiId) wikibot = WikiBot(wikiUser) return wikibot
def ofWikiId(wikiId,lenient=True,debug=False): wikiUser=WikiUser.ofWikiId(wikiId,lenient=lenient) wikibot=WikiClient(wikiUser,debug=debug) return wikibot
def ofWikiId(wikiId, lenient=True): wikiUser = WikiUser.ofWikiId(wikiId, lenient=lenient) wikibot = WikiBot(wikiUser) return wikibot