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 8972643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:15:53+00:00 2026-06-15T18:15:53+00:00

Ming supports GridFS start from 0.3 version, and i’ve used it in several Turbogears

  • 0

Ming supports GridFS start from 0.3 version, and i’ve used it in several Turbogears apps so far, but can’t find any documentation of how to use GridFS with Ming,

This is what i’ve done so far, in my model store.py module :

#import statements

BookFile = fs.filesystem('books',DBSession.impl,)

class Book(MappedClass):
    """
    Book definition.
    """
    class __mongometa__:
        session = DBSession
        name = 'books'
        unique_indexes = [('title',),('author',),]

    _id = FieldProperty(s.ObjectId)
    title = FieldProperty(s.String)
    author = FieldProperty(s.String)
    isbn = FieldProperty(s.String)
    vendor = FieldProperty(s.String)
    _file = FieldProperty(s.ObjectId)

    def _get_file(self):
        return BookFile.m.find(dict(_id=self._file)).one()
    def _set_file(self, name, data):
        f = BookFile.m.put(name,data)
        self._file = f

    bookf = SynonymProperty(_get_file, _set_file)

As you can see, the fs.filesystem can’t take an ODMSession (ThreadLocalODMSession in this case), so i have to drop down to basic ming.Session class by doing DBSession.impl.

What i’m worried is, Turbogears has been using ThreadLocalODMSession to adapt to multi-threaded environment, but what i’m doing above is giving the GridFS Connection the non thread-safe Session.

is that okay?
how should i do this correctly/safely?
Anyhelp would be appreciated,
Thanks 🙂

  • 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-15T18:15:54+00:00Added an answer on June 15, 2026 at 6:15 pm

    The DBSession.impl should be fine, as the ming.Session doesn’t store any data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me where to find the following files in Cygwin setup.exe ?
I'm running a TurboGears app with mod_wsgi and apache, using pymongo wrapped with Ming
setup A TurboGears2 project using ming as an ORM for mongodb. I'm used to
Hey I guys I wrote a function to force out a json file, but
I'm trying to run a pull request from git using PHP's exec on windows
I can't load a dbl file into a SWFBitmap object. Here's the code: <?php
I'm using Windows 7, wamp server version 2.2, PHP version 5.2.9. When I try
I am new to LINQ but am trying to tackle a tough one right
Possible Duplicate: how can I iterate through two lists in parallel in Python? i
I've tough time with ggplot2 when used in function or S4. Here is my

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.