Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Conflict when using declarative configuration and subclassing
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
yorjo  
View profile  
 More options Oct 23 2012, 3:12 pm
From: yorjo <jor...@gmail.com>
Date: Tue, 23 Oct 2012 12:12:45 -0700 (PDT)
Local: Tues, Oct 23 2012 3:12 pm
Subject: Conflict when using declarative configuration and subclassing

Hi,

Don't know if it's something that I should not do or a bug but I notice a
weird behavior when using declarative configuration and subclassing.

The code:

#in __init__.py of a tutorial project
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    config = Configurator(settings=settings)
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('view_in_base', '/base')
    config.add_route('fake_view_in_derived1', '/derived1')
    config.add_route('view_in_derived2', '/derived2')
    config.scan()
    return config.make_wsgi_app()

# in views.py
class BaseView(object):
    def __init__(self, request):
        self._request = request

    @view_config(route_name='view_in_base')
    def view_in_base(self):
        pass

class DerivedView1(BaseView):    
    def __init__(self, request):
        super(DerivedView, self).__init__(request)

#    @view_config(route_name='fake_view_in_derived1')
#    def fake_view_in_derived1(self):
#        pass

class DerivedView2(DerivedView1):    
    def __init__(self, request):
        super(DerivedView2, self).__init__(request)

    @view_config(route_name='view_in_derived2')
    def view_in_derived2(self):
        pass

If I run proutes development.ini on the project I have the following
conflict:

pyramid.exceptions.ConfigurationConflictError: Conflicting configuration
actions
  For: ('view', None, '', None, <InterfaceClass pyramid.interfaces.IView>,
None, None, None, 'view_in_base', 'view_in_base', False, None, None, None,
None)
    Line 15 of file /u/joroy/workspace/new_pyramid/new_pyramid/views.py:
        @view_config(route_name='view_in_base')
    Line 15 of file /u/joroy/workspace/new_pyramid/new_pyramid/views.py:
        @view_config(route_name='view_in_base')

If I uncomment the code in class DerivedView1 to have at least one call to
view_config in the intermediate class(DerivedView1) I have no conflict.

Is this the accepted behavior?

Regards,

Jonathan

FYI: I use pyramid-1.3.4


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »