Example #1
0
#!/usr/bin/env python
'''
    Create a zodb database storage file.
'''

import sys
import os
from ZODB import FileStorage, DB

if len(sys.argv) < 2:
    zodbfs = 'test.fs'
else:
    zodbfs = sys.argv[1]
if os.path.exists(zodbfs):
    print "WARNING: file %s exists!" % zodbfs
    exit()

storage = FileStorage.FileStorage(zodbfs)
db = DB(storage)
conn = db.open()
root = conn.root()
conn.close()
Example #2
0
    def __init__(self):

        directory = get_directory()

        self.logger = logging.getLogger('ZODB.FileStorage')
        fh = logging.FileHandler(directory + 'db.log')
        self.logger.addHandler(fh)

        self.storage = FileStorage.FileStorage(directory + 'db.fs')
        self.db = DB(self.storage)
        self.connection = self.db.open()

        dbroot = self.connection.root()

        if 'job_key' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['job_key'] = OOBTree()
            dbroot['job_key']['val'] = 0

        self.job_key = dbroot['job_key']

        # Ensure that a 'job_db' key is present
        # in the root
        if 'job_db' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['job_db'] = OOBTree()

        self.job_db = dbroot['job_db']

        if 'user_db' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['user_db'] = OOBTree()
            self.user_db = dbroot['user_db']
            self.user_db['user'] = User('unknown', 'unknown', 'unknown')

        self.user_db = dbroot['user_db']

        if 'site_db' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['site_db'] = OOBTree()
            self.site_db = dbroot['site_db']

        self.site_db = dbroot['site_db']

        if scheduler is not None:
            self.site_db[scheduler.name()] = Site(scheduler.name(),
                                                  scheduler.scheduler_type())

        if 'queue_db' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['queue_db'] = OOBTree()
            self.queue_db = dbroot['queue_db']

        self.queue_db = dbroot['queue_db']

        from .version import get_git_version
        if 'version' not in dbroot:
            dbroot['version'] = get_git_version()
        else:
            current_version = dbroot['version']
            new_version = get_git_version()
            # Add any migrations required here
            if current_version != new_version:
                pass

            dbroot['version'] = new_version

        if 'remote_site_db' not in dbroot:
            from BTrees.OOBTree import OOBTree
            dbroot['remote_site_db'] = OOBTree()
            self.remote_site_db = dbroot['remote_site_db']

        self.remote_site_db = dbroot['remote_site_db']
Example #3
0
	def __init__(self, path):
		self.storage = FileStorage.FileStorage(path)
		self.db = DB(self.storage)
		self.connection = self.db.open()
		self.dbroot = self.connection.root()
Example #4
0
File: Risk.py Project: GongCQ/Risk
def GetRoot(path):
    strg = fs.FileStorage(path)
    zDb = ZODB.DB(strg)
    zConn = zDb.open()
    return zConn.root(), zDb
Example #5
0
from ZODB import FileStorage,DB
import transaction
from c_pessoa import Pessoa

storage = FileStorage.FileStorage('dados/meubd.fs')
db=DB(storage)
connection=db.open()
root=connection.root()

p = Pessoa()
p.nome = "João da Silva"
p.email = "*****@*****.**"
p.peso = 70

# cria uma entrada (dicionário, tabela) chamada pessoas
root['pessoas'] = [p]

# salva!
transaction.commit()

print(root.items)

# percorrer as pessoas
for pe in root['pessoas']:
    print(pe)

connection.close()
Example #6
0
        s = round(size_bytes / p, 2)
        return "%s %s" % (s, size_name[i])

    result = convert_size(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)

    return result


class cdict(dict):
    def __init__(self, *args, **kwargs):
        super().__init__()
        self._p_changed = 0


storage = FileStorage.FileStorage(os.path.join(BASE_DIR, "storage",
                                               "Storage.fs"),
                                  pack_keep_old=False)
zopedb = DB(storage)
connection = zopedb.open()

root = connection.root()
# breakpoint()

# requests_cache.install_cache('demo_cache')

headers = {
    'x-rapidapi-host': "api-football-v1.p.rapidapi.com",
    'x-rapidapi-key': TOKEN
}

Example #7
0
 def __init__(self, archivo):
     self.storage = FileStorage.FileStorage(archivo)
     self.db = DB(self.storage)
     self.connection = self.db.open()
     self.root = self.connection.root()
Example #8
0
        Segment4 = df.ix[index]['subject id']
    elif row['Segment'] == str(5):
        Segment5 = df.ix[index]['subject id']
    elif row['Segment'] == str(6):
        Segment6 = df.ix[index]['subject id']
    elif row['Segment'] == str(7):
        Segment7 = df.ix[index]['subject id']
    elif row['Segment'] == str(8):
        Segment8 = df.ix[index]['subject id']

print('>> ' + datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
      '- Retrieving fasta sequences from the database...')

# To retrieve fasta sequences from database.
try:
    storage = FileStorage.FileStorage(programFolder +
                                      'FASTADatabase/FASTA.dat')
    db = DB(storage)
    connection = db.open()
    root = connection.root()
except:
    logging.info('FASTA.dat database file was not found')
    errorFile = open('Error.txt', 'a')
    errorFile.write(
        'FASTA.dat database file was not found. Suggested solution: Please make sure that FASTA.dat '
        'is placed in the correct PATH' + '\n')
    errorFile.close()
    exit(1)

with open(outputDirectory + '/' + sampleID + '_Reference.fa',
          'w') as fastaFile:
    try:
Example #9
0
"""
import transaction
from time import time
from ZODB import FileStorage, DB
from zc.dict import Dict

if __name__ == '__main__':
    big_state = Dict()

    num = 10**9
    start = time()
    for i in range(num):
        big_state[i] = "boom"
    end = time()
    elapsed = end - start
    print "inserted %d records in %.2f seconds: %.2f rec/sec" % (num, elapsed,
                                                                 num / elapsed)

    start = time()
    storage = FileStorage.FileStorage('ZODB-test.fs')
    db = DB(storage)
    connection = db.open()
    root = connection.root()
    root["big_state"] = big_state
    transaction.manager.commit()
    connection.close()
    end = time()
    elapsed = end - start
    print "saved %d records in %.2f seconds: %.2f rec/sec" % (num, elapsed,
                                                              num / elapsed)
Example #10
0
 def __init__(self, file):
     self.db = DB(FileStorage.FileStorage(file))
     self.connection = self.db.open()
     self.data = self.connection.root()
Example #11
0
 def __init__(self, path):
     self.storage = FileStorage.FileStorage(path)
     self.db = DB(self.storage, create=True, large_record_size=999)
     self.connection = self.db.open()
     self.dbroot = self.connection.root()
Example #12
0
 def __init__(self, filename):
     storage = FileStorage.FileStorage(filename)
     self.db = DB(storage)
     self.conn = self.db.open()
     self.root = self.conn.root()
Example #13
0
from ZODB import FileStorage, DB
import transaction

# Definindo o armazenamento do banco
storage = FileStorage.FileStorage("people.fs")
db = DB(storage)
#Conectando
conn = db.open()
#Referência para a raiz da árvore
root = conn.root()
#Um registro persistente
root["singer"] = "Kate Bush"
# Efetuando a alteração
transaction.commit()
print(root["singer"])
# Mudando um item
root["singer"] = "Tori Amos"
print(root["singer"])
# Abortando...
transaction.abort()
# O item voltou ao que era antes da transação
print(root["singer"])
Example #14
0
# github.com/zhufyakvv
# 22.10.2017

#
# База даних містить інформацію про товари на складі у вигляді:
# назва товару, ціна, кількість на складі, дата приходу товару, номер партії, прізвище і ім’я відповідального.
# Для заданої дати визначте найдорожчий товар, а також підрахуйте загальну вартість товарів на складі.
# В завданні 1 використайте “Об'єктно-орієнтовані бази даних (ZODB)”.
#

from ZODB import FileStorage, DB
from Entities.Product import Product
from datetime import datetime
import transaction

storage = FileStorage.FileStorage('mydata.fs')
db = DB(storage)
connection = db.open()
root = connection.root
if not root.products:
    root.products = {}

n = int(input('Set amount of products...'))
for i in range(n):
    product = Product(input("Set product naming..."),
                      input("Set product price for piece..."),
                      input("Set product amount..."), datetime.now(),
                      input("Set product set..."),
                      input("Set responsible name..."))
    try:
        root.products[product.name].amount += product.amount
Example #15
0
from employee import Employee
from adminEmpl import AdminEmpl
from engrEmpl import EngrEmpl

bob = Employee(50, 'Bob', 'Smith')
ann = Employee(60, 'Ann', 'Smith')
sue = AdminEmpl(20, 60, 'Sue', 'Jones')
tom = EngrEmpl(80000, 'Tom', 'Jones')
joe = EngrEmpl(90000, 'Joe', 'Blo')

from ZODB import FileStorage, DB
storage = FileStorage.FileStorage('zodb1.fs')
db = DB(storage)
connection = db.open()
root = connection.root()

for emp in (bob, sue, tom, ann, joe):
    root[str(emp.name)] = emp  # eg: db['Smith, Bob'] = bob

import transaction
transaction.commit()
storage.close()
Example #16
0
from ZODB import FileStorage, DB
for key in root.keys():
    print('%s => %s' % (key.ljust(10), root[key]))

storage = FileStorage.FileStorage(
    r'E:\Users\Олег\Documents\hello\.vscode\mydb.fs')
db = DB(storage)
connection = db.open()
root = connection.root()
object1 = (1, 'spam', 4, 'YOU')
object2 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
object3 = {'name': ['Bob', 'Doe'], 'age': 42, 'job': ('dev', 'mgr')}
root['mystr'] = 'spam' * 3
root['mylist'] = object2
root['mydict'] = object3
print(root['mydict'])
import transaction
transaction.commit()
storage.close()
Example #17
0
def oldfs():
    return FileStorage(
        os.path.join(os.path.dirname(__file__), 'gen3.fs'),
        read_only=True,
    )
Example #18
0
def _get_huge_db_root():
    storage = FileStorage.FileStorage(HUGE_DATABASE_NAME)
    db = DB(storage)
    connection = db.open()
    root = connection.root()
    return db, connection, root
Example #19
0
 def __init__(self):
     storage = FileStorage.FileStorage('database.fs')
     db = DB(storage)
     self.dba = db
     db.pack()
     self.connection = db.open()
Example #20
0
from ZODB import FileStorage, DB

storage = FileStorage.FileStorage(r'C:\Mark\temp\mydb.fs')
db = DB(storage)
connection = db.open()
root = connection.root()

print len(root), root.keys()
print root['mylist']

for key in root.keys():
    print key, '\t=>', root[key]

rec = root['mydict']
rec['age'] += 1
rec['job'] = None
root['mydict'] = rec  # change in memory, write back
# does not update db: root['bob']['age'] += 1
import transaction  # get_transaction() deprecated, gone in 3.6

transaction.commit()  # same as older: get_transaction().commit()
storage.close()  # 3.6 transaction.get() = get_transaction()
Example #21
0
def render_circuitikz(latex, dest = None, equation = None, display = None):
    actions = list()
    if dest:
        filePath, fileName = os.path.split(dest)
        imageSessPath = filePath
        imagePath = os.path.join(imageSessPath, fileName + '.png')
    else:
        equation = cherrypy.session['equation']
        display = cherrypy.session['display']
        fileName = 'Diagram-Circuit%s'%time.strftime('%y%m%d%H%M%S')
        imageSessPath = os.path.join(get_server_setting('imagesdir'), cherrypy.session.id)
        actions.append(new_action('actCircuitTikzSubmit', 'Circuit', id =cherrypy.session['circuit'].id))      
        actions.append(new_action('actCircuitTikzSubmit', 'Solver', id =cherrypy.session['circuit'].id))
    imagePath = os.path.join(imageSessPath, fileName + '.png')
    if not os.path.isdir(imageSessPath):
        os.mkdir(imageSessPath)
        cherrypy.log.error('Making directory %s'%imageSessPath, 'DIAGRAM', logging.DEBUG)
    if latex == '':
        return {'actions':actions}
    else:
        # look in cache for existing results
        storage = FileStorage.FileStorage(os.path.join(get_server_setting('cachedir'), 'cache.fs'))
        db = DB(storage)
        connection = db.open()
        root = connection.root()
        cache = root.cache_image.get(latex, None)
        if cache:
            imgFile = open(imagePath, 'wb+')
            imgFile.write(cache.image)
            cache.update() # update timestamp
            root.cache_image[latex] = cache
            transaction.commit()
        else:            
            head =  \
"""\\documentclass[border=4pt]{standalone}
\\usepackage{tikz}
\\usepackage{circuitikz}
\\usepackage{siunitx}
\\pagestyle{empty}
\\begin{document}
\\begin{circuitikz}[%s]
\\newcommand*{\\doublelabel}[3][3em]{\\parbox{#1}{\\raggedleft #2 \\\\ #3}}
"""
            head = head%('american')
            tail = \
"""
\\end{circuitikz}
\\end{document}
"""
            latexDoc = head + latex + tail
            latexDoc = execute_latex_controls(latexDoc, equation, display)
            imagePath = os.path.join(imageSessPath, fileName + '.png')
            args = '-interaction=nonstopmode -halt-on-error -jobname %s -output-directory=%s '%(fileName, imageSessPath)
            # string -> txt (\todo: fix, should render as a string
            if texMode == 'file':
                texFileLoc = os.path.join(imageSessPath, fileName + '.tex')
                f = open(texFileLoc, 'w')
                f.write(latexDoc)
                f.close()
                # tex -> pdf processingsa
                cmd = '"%s" %s %s'%(os.path.join(latexPath, latexEngine), args, texFileLoc)
            elif texMode == 'string':
                # string -> pdf processing
                cmd = '"%s" %s "%s"'%(os.path.join(latexPath, latexEngine), args, latexDoc.replace('\n', ' '))
            cherrypy.log.error("Running %s"%cmd, 'DIAGRAM', logging.DEBUG)
            p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
            stdoutdata, stderrdata  = p.communicate()
            if stderrdata:
                cherrypy.log.error('Error: %s'%stderrdata, 'DIAGRAM', logging.ERROR)
            idx = stdoutdata.find('!')
            if idx >0 :
                cherrypy.log.error('Error: %s'%stdoutdata[idx:], 'DIAGRAM', logging.ERROR, True)
                raise Exception('Latex Error ' + stdoutdata[idx:])
            else:
                imgMagicCmd = 'convert -trim -density 128 "%s.pdf" -background none -undercolor none -pointsize 6 label:"               " -gravity SouthEast -append -pointsize 6 label:"(c) OneSolver.com" -gravity SouthEast -append "%s"'
                if not dest:
                    # latex did not have any errors, save to ram
                    if cherrypy.session.has_key('circuit'):
                        dbCircuit = cherrypy.session['circuit']
                    else:
                        session_new()
                    dbCircuit.latex = latex
                    dbCircuit.equation.instance = equation.instance
                    cherrypy.session['circuit'] = dbCircuit
                    # pdf -> png processing (imagemagick)   
                    cmd = imgMagicCmd%(os.path.join(imageSessPath, fileName), imagePath)
                    cherrypy.log.error('Running %s'%cmd, 'DIAGRAM', logging.DEBUG)
                    p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
                    stdoutdata, stderrdata  = p.communicate()
                    if stdoutdata:
                        cherrypy.log.error('Output: %s'%stdoutdata, 'DIAGRAM', logging.INFO)
                    if stderrdata:
                        cherrypy.log.error('Error: %s'%stderrdata, 'DIAGRAM', logging.ERROR)
                else:
                    cmd = imgMagicCmd%(os.path.join(imageSessPath, fileName), imagePath)
                    p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
                    stdoutdata, stderrdata  = p.communicate()
                    if stdoutdata:
                        cherrypy.log.error('Output: %s'%stdoutdata, 'DIAGRAM', logging.INFO)
                    if stderrdata:
                        cherrypy.log.error('Error: %s'%stderrdata, 'DIAGRAM', logging.ERROR)
                cache = ModelCore.CacheImage(imagePath)
                root.cache_diagram[latex] = cache
                transaction.commit()
        connection.close() #close cache
        db.close()
        storage.close()
        return {'actions':actions}
Example #22
0
 def __init__(self, filename):
     from ZODB import FileStorage, DB
     self.storage = FileStorage.FileStorage(filename)
     db = DB(self.storage)
     connection = db.open()
     self.root = connection.root()
Example #23
0
print('Importing finished, creating faker')

fake = Faker()
table = PrettyTable()
table.field_names = [
    "Lp", "User ID", "Name", "Lastname", "Email", "Registration date",
    "Uni name", "Uni town", "Uni address", "Uni country"
]

if not os.path.exists("data"):
    print("Data directory does not exist, creating")
    os.makedirs("data")

print('Connecting to the file database')
storage = FileStorage.FileStorage('data/mydata.fs')
db = DB(storage)
connection = db.open()
root = connection.root()
print('Connected')

print('Creating collections')
if 'admin' not in root:
    root['admin'] = {}
if 'classroom' not in root:
    root['classroom'] = {}
if 'domain' not in root:
    root['domain'] = {}
if 'event' not in root:
    root['event'] = {}
if 'grade' not in root:
Example #24
0
import time
import sys
import telepot
from config import *
import facebook
import requests
from BTrees.OOBTree import OOBTree
from ZODB import FileStorage, DB
import transaction
from persistent import Persistent
import os

storage = FileStorage.FileStorage("memr.fs")
db = DB(storage)
conn = db.open()
dbroot = conn.root()

if "pages" not in dbroot:
    print "pages not in dbroot"
    dbroot["pages"] = OOBTree()

if "aliases" not in dbroot:
    print "aliases not in dbroot"
    dbroot["aliases"] = OOBTree()

pages = dbroot["pages"]
aliases = dbroot["aliases"]
transaction.commit()


class Page(Persistent):
Example #25
0
def mech_design_get(idxMech=None):
    actions = list()
    user = cherrypy.session['user']
    mechDesign = cherrypy.session['mechDesign']
    equation = cherrypy.session['equation']
    solution = equation.solution_get('S')
    ds = Geometric.DraftSpace(backend='Agg')
    ds.clear()
    ds.showGrid = False
    ds.showTick = False
    ds.showAnchor = False
    mechPath = os.path.join(get_server_setting('imagesdir'),
                            cherrypy.session.id)
    ds.path = mechPath
    ds.authorOrigin = equation.instance.owner.firstName + ' ' + equation.instance.owner.lastName
    ds.authorModify = user.firstName + ' ' + user.lastName
    ds.dateOrigin = equation.instance.timestamp.strftime("%m-%d-%Y")
    ds.title = equation.instance.title
    if not os.path.exists(mechPath):
        os.mkdir(mechPath)
    idxList = list()
    if idxMech != None:
        idxList.append(idxMech)
    else:
        for drawing in mechDesign.drawings:
            idxList.append(drawing.id)
    storage = FileStorage.FileStorage(
        os.path.join(get_server_setting('cachedir'), 'cache.fs'))
    db = DB(storage)
    connection = db.open()
    root = connection.root()
    for idxMech in idxList:
        for drawing in mechDesign.drawings:  #search for drawing
            if drawing.id == idxMech:
                break
        mechOptions = cherrypy.session['mechOptions'][idxMech]
        ds.ratio = mechOptions['ratio']
        ds.perspective = drawing.perspective.capitalize()
        ds.name = 'Mechanical-Drawing' + drawing.perspective.capitalize(
        ) + time.strftime('%y%m%d%H%M%S')
        imgUrl = 'api/image?app=Mechanical&tab=Drawing&id1=%d&id2=%d' % (
            mechDesign.id, drawing.id) + '&image=' + ds.name + '.' + DRAWMODE
        values = dict()
        symbols = dict()
        baseUnit = equation.unumDict[int(mechOptions['unit'])]
        for variableSol in solution.variables:
            for variableMech in drawing.variables:
                desig = variableMech.desig.longhand + str(variableMech.number)
                if variableMech.id == variableSol.variable.id:
                    symbols[desig] = variableMech.desig.latex.replace(
                        '#', str(variableMech.number))
                    if variableSol.variable.desig.name == 'Length':
                        unumSelected = equation.variable_get_unit(
                            variableSol, 'selected-unum')
                        unumValue = variableSol.value * unumSelected
                        unumValue = unumValue.asUnit(baseUnit)
                        value = unumValue._value
                    else:
                        value = variableSol.value

                    values[desig] = value

        key = '%s\n%s\n%s\n%s\n%s' % (
            mechOptions['size'], mechOptions['checkOptions'],
            mechOptions['ratio'], mechOptions['unit'],
            ds.get_cmd(drawing.drawing, values))
        cache = root.cache_image.get(key, None)
        imgFileLoc = os.path.join(ds.path, ds.name + '.' + DRAWMODE)
        if cache:
            fId = open(imgFileLoc, 'wb+')
            fId.write(cache.image)
            cache.update()  # update timestamp
            root.cache_image[key] = cache
            transaction.commit()
        else:
            cherrypy.log.error('Draw %s, %s' % (drawing, values), 'MECHANICAL',
                               logging.DEBUG)
            ds.load(drawing.drawing, values)
            cherrypy.log.error('Set background.', 'MECHANICAL', logging.DEBUG)
            ds.draw_background(mechOptions['size'])
            ds.save(fmt=DRAWMODE)
            root.cache_image[key] = ModelCore.CacheImage(imgFileLoc)
            transaction.commit()
        ds.clear()
        actions.append(
            new_action('actDrawingAdd',
                       'Drawing',
                       idx=idxMech,
                       image=imgUrl,
                       variables=None,
                       code=drawing.drawing,
                       perspective=drawing.perspective))
        actions.append(
            new_action('actRatioChange',
                       'Drawing',
                       idx=idxMech,
                       ratio=mechOptions['ratio']))
        actions.append(
            new_action('actSizeFill',
                       'Drawing',
                       idx=idxMech,
                       options=Geometric.options,
                       value=mechOptions['size']))
        actions.append(
            new_action('actUnitFill',
                       'Drawing',
                       idx=idxMech,
                       options={
                           100000: 'm',
                           302800: 'ft',
                           300103: 'cm',
                           302700: 'in',
                           300102: 'mm',
                           302900: 'mil'
                       },
                       value=int(mechOptions['unit'])))
    connection.close()  #close cache
    db.close()
    storage.close()
    return {'actions': actions}
Example #26
0
import sched, time, persistent
from ZODB import FileStorage, DB

storage = FileStorage.FileStorage("coworking-data.fs")
db = DB(storage)
connection = db.open()
root = connection.root


class Application(persistent.Persistent):
    print("Bienvenido al SGR")
Example #27
0
from ZODB import FileStorage, DB
from patient import Patient
from datetime import date
import transaction

storage = FileStorage.FileStorage('mydatabase.fs')
db = DB(storage)
connection = db.open()
root = connection.root()

zero = Patient('Surname', 'Name', date(2019, 11, 4), 'Street', 170, 80)
first = Patient('Surname1', 'Name1', date(2019, 11, 4), 'Street1', 171, 81)
root['patients'] = [zero, first]
totalWeight = 0
tallestPatient = root['patients'][0]
for dbPatient in root['patients']:
    totalWeight = totalWeight + dbPatient.weight
    if (tallestPatient.height < dbPatient.height):
        tallestPatient = dbPatient

print(tallestPatient)
print(totalWeight)
transaction.commit()
connection.close()
Example #28
0
 def __init__(self,path):
     self.storage = FileStorage.FileStorage(path)#存储数据库数据的方法
     self.db = DB(self.storage)#围绕存储并为存储提供实际数据库行为“db”包装
     self.connection = self.db.open()#启动与该数据库的特定会话的“connection”对象
     self.dbroot = self.connection.root()#允许我们访问包含在数据库中的对象层次结构的根的“dbroot”对象
Example #29
0
# FOR A PARTICULAR PURPOSE
#
############################################################################

import ZODB
import Globals
from ZODB import FileStorage, DB
import transaction

import Products.Sessions.BrowserIdManager
import Products.Sessions.SessionDataManager
import Products.TemporaryFolder.TemporaryFolder
import os.path
import sys

fs = FileStorage.FileStorage(os.path.join(Globals.data_dir, 'Data.fs.in'))
db = DB(fs)

conn = db.open()

root = conn.root()

app = root['Application']

print "Patching Data.fs.in"

tf = Products.TemporaryFolder.TemporaryFolder.MountedTemporaryFolder(
    'temp_folder', 'Temporary Folder')
bid = Products.Sessions.BrowserIdManager.BrowserIdManager(
    'browser_id_manager', 'Browser Id Manager')
sdm = Products.Sessions.SessionDataManager.SessionDataManager(
Example #30
0
 def getdb(self):
     storage = FileStorage.FileStorage('Data.fs')
     self.db = ZODB.DB(storage)