Example #1
0
def delete_all_export_data_schemas():
    from .models import ExportDataSchema

    db = ExportDataSchema.get_db()
    for row in db.view('schemas_by_xmlns_or_case_type/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #2
0
def delete_all_export_instances():
    from .models import ExportInstance

    db = ExportInstance.get_db()
    for row in db.view('export_instances_by_domain/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #3
0
def delete_all_export_instances():
    from .models import ExportInstance

    db = ExportInstance.get_db()
    for row in db.view('export_instances_by_domain/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #4
0
def delete_all_inferred_schemas():
    from .models import InferredSchema

    db = InferredSchema.get_db()
    for row in db.view('inferred_schemas_by_case_type/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #5
0
def delete_all_export_data_schemas():
    from .models import ExportDataSchema

    db = ExportDataSchema.get_db()
    for row in db.view('schemas_by_xmlns_or_case_type/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #6
0
def delete_all_inferred_schemas():
    from .models import InferredSchema

    db = InferredSchema.get_db()
    for row in db.view('inferred_schemas_by_case_type/view', reduce=False):
        doc_id = row['id']
        safe_delete(db, doc_id)
Example #7
0
def _delete_all(db, viewname):
    deleted = set()
    for row in db.view(viewname, reduce=False):
        doc_id = row['id']
        if id not in deleted:
            try:
                safe_delete(db, doc_id)
                deleted.add(doc_id)
            except ResourceNotFound:
                pass
Example #8
0
def _delete_all(db, viewname):
    deleted = set()
    for row in db.view(viewname, reduce=False):
        doc_id = row['id']
        if id not in deleted:
            try:
                safe_delete(db, doc_id)
                deleted.add(doc_id)
            except ResourceNotFound:
                pass
Example #9
0
 def _delete_all_from_view(db, view, view_kwargs=None):
     view_kwargs = view_kwargs or {}
     deleted = set()
     for row in db.view(view, reduce=False, **view_kwargs):
         doc_id = row['id']
         if doc_id not in deleted:
             try:
                 safe_delete(db, doc_id)
                 deleted.add(doc_id)
             except ResourceNotFound:
                 pass
Example #10
0
 def _delete_all_from_view(db, view, view_kwargs=None):
     view_kwargs = view_kwargs or {}
     deleted = set()
     for row in db.view(view, reduce=False, **view_kwargs):
         doc_id = row['id']
         if doc_id not in deleted:
             try:
                 safe_delete(db, doc_id)
                 deleted.add(doc_id)
             except ResourceNotFound:
                 pass
Example #11
0
    def setUp(self):
        # We want to support Python 2.6 a bit longer so we cannot use dictConfig here...
        # but it is so handy that we put it in settings.py instead of wrestle with crappy
        # imperative config
        self.logger = logging.getLogger('couchlog.tests')
        self.original_log_level = logging.root.getEffectiveLevel()
        for handler in list(self.logger.handlers):
            if isinstance(handler, CouchHandler):
                self.logger.removeHandler(handler)
        logging.root.setLevel(logging.ERROR)
        init_handler()

        self.db = ExceptionRecord.get_db()
        for row in self.db.view("couchlog/all_by_date").all():
            safe_delete(self.db, row['id'])
Example #12
0
 def setUp(self):
     db = ExceptionRecord.get_db()
     for row in db.view("couchlog/all_by_date").all():
         safe_delete(db, row['id'])
Example #13
0
def _delete_all(db, viewname, id_func=None):
    for row in db.view(viewname, reduce=False):
        try:
            safe_delete(db, id_func(row) if id_func else row['id'])
        except ResourceNotFound:
            pass
Example #14
0
def _delete_all(db, viewname, id_func=None):
    for row in db.view(viewname, reduce=False):
        try:
            safe_delete(db, id_func(row) if id_func else row['id'])
        except ResourceNotFound:
            pass
 def tearDown(self):
     db = ExportDataSchema.get_db()
     for row in db.view('schemas_by_xmlns_or_case_type/view', reduce=False):
         doc_id = row['id']
         safe_delete(db, doc_id)