Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:34:17+00:00 2026-06-13T16:34:17+00:00

I thought I understood this but I’m beginning to wonder ! If you consider

  • 0

I thought I understood this but I’m beginning to wonder !

If you consider the repoze.catalog doco example :

from repoze.catalog.catalog import FileStorageCatalogFactory
from repoze.catalog.catalog import ConnectionManager

from repoze.catalog.indexes.field import CatalogFieldIndex
from repoze.catalog.indexes.text import CatalogTextIndex

factory = FileStorageCatalogFactory('catalog.db', 'mycatalog')

_initialized = False

def initialize_catalog():
    global _initialized
    if not _initialized:
        # create a catalog
        manager = ConnectionManager()
        catalog = factory(manager)
        # set up indexes
        catalog['flavors'] = CatalogFieldIndex('flavor')
        catalog['texts'] = CatalogTextIndex('text')
        # commit the indexes
        manager.commit()
        manager.close()
        _initialized = True

class Content(object):
    def __init__(self, flavor, text):
        self.flavor = flavor
        self.text = text

if __name__ == '__main__':
    initialize_catalog()
    manager = ConnectionManager()
    catalog = factory(manager)
    content = {
         1:Content('peach', 'i am so very very peachy'),
         2:Content('pistachio', 'i am nutty'),
         }
    for docid, doc in content.items():
        catalog.index_doc(docid, doc)
    manager.commit()

This shows you how to generate the catalog entries for two instances of the Content class but what is the correct mechanism for actually saving the object ?

I started out having a completely seperate ZODB database into which I stored the objects keyed on the docid used to catalog them under repoze.catalog but when it comes to transactions this is less than satisfactory because when adding an object I have to issue a commit on both the catalog and the ZODB database being used to store the objects.

I had assumed that I would be able to access the ZODB catalog which is within the repoze.catalog structures and use that to store the actual objects but I’m having difficulties finding out how to do that .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:34:19+00:00Added an answer on June 13, 2026 at 4:34 pm

    A catalogue like repoze.catalog is intended for indexing content, not storing it. It’s intent is to make finding back your content (stored elsewhere) easy and performant, by indexing certain aspects of that content.

    The example given is completely standalone, and stores it’s data in a separate ZODB file. This is to support the usecase where the catalog is used for data that itself is not stored in the ZODB.

    However, you are free to store the catalog in the same ZODB you store your content in. Your content objects should follow the basic rules for persistent objects, but you are otherwise free to architect the storage structures.

    To create a repoze.catalog catalog for yourself, not using the provided FileStorageCatalogFactory, simply instantiate repoze.catalog.catalog.Catalog:

    from repoze.catalog.catalog import Catalog
    
    if 'mycatalog' not in zodbroot:
        zodbroot['mycatalog'] = Catalog()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always thought about this but never understood why. Simple example: public IEnumerator<Effect> GetEnumerator
I always thought I understood how this works...but lately I have started really using
I thought I understood ViewState, but this is a bit of a weird one.
I thought I understood how to do this but I'm getting some unexpected behavior
Ok, so I thought I understood this (no pun intended), but apparently not. var
I thought I understood this technology, but maybe I don't. What's the difference between
I thought I understood this but obviously not... I have a method signature like
I thought I understood Perl RE to a reasonable extent, but this is puzzling
I thought I understood how to escape things, but this is just blowing my
I thought, I understood unicode and python. But this issue confuses me a lot.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.