本文整理匯總了Python中eulexistdb.db.ExistDB.createCollection方法的典型用法代碼示例。如果您正苦於以下問題:Python ExistDB.createCollection方法的具體用法?Python ExistDB.createCollection怎麽用?Python ExistDB.createCollection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eulexistdb.db.ExistDB
的用法示例。
在下文中一共展示了ExistDB.createCollection方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ModelTest
# 需要導入模塊: from eulexistdb.db import ExistDB [as 別名]
# 或者: from eulexistdb.db.ExistDB import createCollection [as 別名]
class ModelTest(unittest.TestCase):
COLLECTION = EXISTDB_TEST_COLLECTION
def setUp(self):
self.db = ExistDB(server_url=EXISTDB_SERVER_URL,
username=EXISTDB_SERVER_USER, password=EXISTDB_SERVER_PASSWORD)
self.db.createCollection(self.COLLECTION, True)
test_dir = os.path.dirname(os.path.abspath(__file__))
fixture = os.path.join(test_dir, 'exist_fixtures', 'goodbye-english.xml')
loaded = self.db.load(open(fixture), self.COLLECTION + '/goodbye-english.xml')
fixture = os.path.join(test_dir, 'exist_fixtures', 'goodbye-french.xml')
loaded = self.db.load(open(fixture), self.COLLECTION + '/goodbye-french.xml')
# temporarily set test collection as root exist collection
self._root_collection = settings.EXISTDB_ROOT_COLLECTION
settings.EXISTDB_ROOT_COLLECTION = self.COLLECTION
def tearDown(self):
self.db.removeCollection(self.COLLECTION)
settings.EXISTDB_ROOT_COLLECTION = self._root_collection
def test_manager(self):
partings = Parting.objects.all()
self.assertEquals(2, partings.count())
def test_sibling_query(self):
# test sibling node access via 'also'
exc = Exclamation.objects.filter(text='Au revoir').also('next').get()
self.assertEqual('monde', exc.next)
示例2: ModelTest
# 需要導入模塊: from eulexistdb.db import ExistDB [as 別名]
# 或者: from eulexistdb.db.ExistDB import createCollection [as 別名]
class ModelTest(unittest.TestCase):
COLLECTION = settings.EXISTDB_TEST_COLLECTION
def setUp(self):
self.db = ExistDB()
self.db.createCollection(self.COLLECTION, True)
test_dir = os.path.dirname(os.path.abspath(__file__))
fixture = os.path.join(test_dir, 'exist_fixtures', 'goodbye-english.xml')
loaded = self.db.load(open(fixture), self.COLLECTION + '/goodbye-english.xml', True)
fixture = os.path.join(test_dir, 'exist_fixtures', 'goodbye-french.xml')
loaded = self.db.load(open(fixture), self.COLLECTION + '/goodbye-french.xml', True)
# temporarily set test collection as root exist collection
self._root_collection = settings.EXISTDB_ROOT_COLLECTION
settings.EXISTDB_ROOT_COLLECTION = self.COLLECTION
def tearDown(self):
self.db.removeCollection(self.COLLECTION)
settings.EXISTDB_ROOT_COLLECTION = self._root_collection
def test_manager(self):
partings = Parting.objects.all()
self.assertEquals(2, partings.count())
示例3: use_test_collection
# 需要導入模塊: from eulexistdb.db import ExistDB [as 別名]
# 或者: from eulexistdb.db.ExistDB import createCollection [as 別名]
def use_test_collection(self):
self.stored_default_collection = getattr(settings, "EXISTDB_ROOT_COLLECTION", None)
if getattr(settings, "EXISTDB_TEST_COLLECTION", None):
settings.EXISTDB_ROOT_COLLECTION = settings.EXISTDB_TEST_COLLECTION
else:
settings.EXISTDB_ROOT_COLLECTION = getattr(settings, "EXISTDB_ROOT_COLLECTION", "/default") + "_test"
print >> sys.stderr, "Creating eXist Test Collection: %s" % \
settings.EXISTDB_ROOT_COLLECTION
# now that existdb root collection has been set to test collection, init db connection
db = ExistDB()
# create test collection (don't complain if collection already exists)
db.createCollection(settings.EXISTDB_ROOT_COLLECTION, True)
示例4: ExistDB
# 需要導入模塊: from eulexistdb.db import ExistDB [as 別名]
# 或者: from eulexistdb.db.ExistDB import createCollection [as 別名]
from os import walk
from eulexistdb.db import ExistDB
#
# Timeout higher?
#
#
# http://username:[email protected]:8080/exist
#
# YOU NEED TO INSERT THE USER AND PASSWORD HERE
#xmldb = ExistDB('http://admin:@46.137.59.250:8080/exist')
xmldb = ExistDB('http://admin:[email protected]:8080/exist')
xmldb.createCollection('docker', True)
xmldb.createCollection('docker/texts', True)
os.chdir('../dublin-store')
for (dirpath, dirnames, filenames) in walk('浙江大學圖書館'):
xmldb.createCollection('docker/texts' + '/' + dirpath, True)
if filenames:
for filename in filenames:
with open(dirpath + '/' + filename) as f:
print "--" + dirpath + '/' + filename
xmldb.load(f, 'docker/texts' + '/' + dirpath + '/' + filename, True)
#
# Load resources
#