lostdorje
lostdorje

Reputation: 6470

pyramid_formalchemy assumptions about requests

I'm using pyramid_formalchemy 0.4.1...well I'm trying to use it.

When requests come in to my app I keep seeing pyramid_formalchemy making strange assumptions about what will be in the request object. My requests fail because in pyramid_formalchemy.views (starting at line: 58) the ModelView class has a constructor with the following code:

def __init__(self, context, request):
    self.context = context
    self.request = request
    self.session = request.session_factory

    self.fieldset_class = request.forms.FieldSet
    self.grid_class = request.forms.Grid

The thing is my request object has a 'session' not a 'session_factory'. It also doesn't have 'forms'

Here is what I've done:

  1. Create a RootFactory that extends pyramid_formalchemy.resources.Models
  2. I call config.formalchemy_admin() passing it my RootFactory and my DBSession
  3. I created an empty forms.py file.

What am I missing in my setup? Any ideas?

Thanks.

Upvotes: 2

Views: 138

Answers (1)

gawel
gawel

Reputation: 2048

This stuff is configurable.

See the source

Not sure it's really documented..

Upvotes: 1

Related Questions