def setUp(self): self.cwd=FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc=edmx.Document() mdPath=TEST_DATA_DIR.join('sample_server','metadata.xml') with mdPath.open('rb') as f: self.doc.Read(f) self.schema=self.doc.root.DataServices['SampleModel'] self.container=self.doc.root.DataServices["SampleModel.SampleEntities"] self.d=FilePath.mkdtemp('.d','pyslet-test_odata2_sqlds-') self.db=SQLiteEntityContainer(filePath=self.d.join('test.db'),containerDef=self.container)
def setUp(self): self.cwd=FilePath.getcwd() self.dList=[] self.d=FilePath.mkdtemp('.d','pyslet-test_imscpv1p2-') self.d.chdir() FilePath('package').mkdir() FilePath('mpackage').mkdir() mpath=FilePath('mpackage','imsmanifest.xml') f=mpath.open('wb') f.write(EXAMPLE_2) f.close() self.dList.append(self.d)
def setUp(self): self.cwd = FilePath.getcwd() self.dList = [] self.d = FilePath.mkdtemp(".d", "pyslet-test_imscpv1p2-") self.d.chdir() FilePath("package").mkdir() FilePath("mpackage").mkdir() mpath = FilePath("mpackage", "imsmanifest.xml") f = mpath.open("wb") f.write(EXAMPLE_2) f.close() self.dList.append(self.d)
def setUp(self): self.cwd = FilePath.getcwd() self.dList = [] self.d = FilePath.mkdtemp('.d', 'pyslet-test_imscpv1p2-') self.d.chdir() FilePath('package').mkdir() FilePath('mpackage').mkdir() mpath = FilePath('mpackage', 'imsmanifest.xml') f = mpath.open('wb') f.write(EXAMPLE_2) f.close() self.dList.append(self.d)
def setUp(self): # noqa self.cwd = FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sqlds', 'custom.xml') with md_path.open('rb') as f: self.doc.Read(f) self.schema = self.doc.root.DataServices['CustomModel'] self.container = self.doc.root.DataServices[ "CustomModel.FileContainer"] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = CustomisedContainer(file_path=self.d.join('test.db'), container=self.container)
def setUp(self): # noqa self.cwd = FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sample_server', 'metadata.xml') with md_path.open('rb') as f: self.doc.Read(f) self.schema = self.doc.root.DataServices['SampleModel'] self.container = self.doc.root.DataServices[ "SampleModel.SampleEntities"] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = SQLiteEntityContainer(file_path=self.d.join('test.db'), container=self.container)
def setUp(self): # noqa self.cwd = FilePath.getcwd() TEST_DATA_DIR.chdir() self.doc = edmx.Document() md_path = TEST_DATA_DIR.join('sqlds', 'custom.xml') with md_path.open('rb') as f: self.doc.read(f) self.schema = self.doc.root.DataServices['CustomModel'] self.container = self.doc.root.DataServices[ "CustomModel.FileContainer"] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = CustomisedContainer( file_path=self.d.join('test.db'), container=self.container)
def setUp(self): # noqa DataServiceRegressionTests.setUp(self) self.container = self.ds['RegressionModel.RegressionContainer'] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = SQLiteEntityContainer(file_path=self.d.join('test.db'), container=self.container) self.db.create_all_tables()
def setUp(self): # noqa DataServiceRegressionTests.setUp(self) self.container = self.ds['RegressionModel.RegressionContainer'] self.d = FilePath.mkdtemp('.d', 'pyslet-test_odata2_sqlds-') self.db = SQLiteEntityContainer( file_path=self.d.join('test.db'), container=self.container) self.db.create_all_tables()
def setUp(self): # noqa self.d = FilePath.mkdtemp('.d', 'pyslet-test_blockstore-') path = os.path.join(DATA_DIR, 'blockstore.xml') self.doc = edmx.Document() with open(path, 'rb') as f: self.doc.read(f) self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer'] self.block_size = random.randint(5, 100) logging.info("File block size: %i", self.block_size) self.f = self.d.join('blockstore.test').open('w+b') self.fox = (b"The quick brown fox jumped over the lazy dog " + ul("Caf\xe9").encode('utf-8'))
def setUp(self): # noqa self.d = FilePath.mkdtemp('.d', 'pyslet-test_blockstore-') path = os.path.join(DATA_DIR, 'blockstore.xml') self.doc = edmx.Document() with open(path, 'rb') as f: self.doc.Read(f) self.cdef = self.doc.root.DataServices['BlockSchema.BlockContainer'] self.block_size = random.randint(5, 100) logging.info("File block size: %i", self.block_size) self.f = self.d.join('blockstore.test').open('w+b') self.fox = (u"The quick brown fox jumped over the lazy dog " u"Caf\xe9".encode('utf-8'))
def __init__(self, dpath=None, **kwargs): super(FileBlockStore, self).__init__(**kwargs) if dpath is None: # create a temporary directory self.dpath = FilePath.mkdtemp('.d', 'pyslet_blockstore-') else: self.dpath = dpath self.tmpdir = self.dpath.join('tmp') if not self.tmpdir.exists(): try: self.tmpdir.mkdir() except OSError: # catch race condition where someone already created it pass self.magic = _magic()
def __init__(self, dpath=None, **kwargs): super(FileBlockStore, self).__init__(**kwargs) if dpath is None: # create a temporary directory self.dpath = FilePath.mkdtemp('.d', 'pyslet_blockstore-') else: self.dpath = dpath self.tmpdir = self.dpath.join('tmp') if not self.tmpdir.exists(): try: self.tmpdir.mkdir() except OSError: # catch race condition where someone already created it pass self.magic = _magic()
def render_template(self, context, path, page_context): """Renders a Jinja template context The :class:`~pyslet.wsgi.WSGIContext` of the request. path The relative path to the template (i.e., always forward slashes and relative to one of the template directories) context_dictionary The context dictionary object, e.g., returned by :meth:`new_context_dictionary`. Returns the page's data rendered with the given context dictionary. May return a string of bytes or a Unicode string.""" return self.env.get_template(str( OSFilePath(*path.split("/")))).render(page_context)
def setUp(self): # noqa self.d = FilePath.mkdtemp('.d', 'pyslet-test_blockstore-')
def setUp(self): # noqa self.d = FilePath.mkdtemp('.d', 'pyslet-test_blockstore-')