I'm not sure how ZCM could help me in my CMS-plugin system...
I want to match url for each plugin on page. For example:
request.url = '/page/arg1/val1/'
And plugin1 has routes:
'page/' => 'plugin1.view_without_args',
'page/arg1/{val}/' => 'plugin1.view_with_args'
So after matched '/page/arg1/{val}/' plugin will render something
inside `view_with_args`.
I'm reading about Pyramid and ZCM but still don't know how to deal
with this. My only one idea is to write my own @cms_add_route
decorator and do for each method of plugin something ilke:
@cms_add_route('/page/arg1/{val}/', request_method='GET')
def view_with_args(request):
return 'rendered template'
which will add `view_with_args` method to separated CMS RoutesMapper.
But this is a little without sense if exists in pyramid decorator like
@action. So what is the best way to make CMS architecture like above?
I would be grateful for some example.
On 31 Gru 2010, 12:25, Danny Navarro <[email protected]> wrote:
> On Fri, Dec 31, 2010 at 11:21 AM, grassoalvaro <[email protected]> wrote:
> > I'm creating a CMS system and the idea is:
>
> > main Configurator has route '/some-cms-page/' which is calling
> > cms_view method:
>
> > == pseudocode ==
> > def cms_view(request):
> > page = Page.get_page(request)
> > response = ''
> > for plugin in page.plugins:
> > plugin = init_plugin()
> > view = plugin_conf.get_view_method('current/url/address/')
> > response += view(request)
> > return response
>
> > So, plugin MUST have own Configurator. And again my question is that
> > Configurator has something similar to method 'get_view_method'?
>
> I suspect you are in the wrong lead with the configurator. AFAIK the
> configurator is used only when creating the WSGI app. To change the
> 'configuration' of the app at run-time I suspect you have to deal with
> the application registry and understand ZCA.
>
> http://docs.pylonshq.com/pyramid/dev/narr/zca.html
>
>
>
>
>
> > On 31 Gru, 11:03, Chris McDonough <[email protected]> wrote:
> >> On Fri, 2010-12-31 at 01:53 -0800, grassoalvaro wrote:
> >> > Ok, i bad described my problem. In example above with Configurator in
> >> > each plugin i want something like:
>
> >> > def my_view(request):
> >> > plugin_conf = init_plugin()
> >> > # plugin_conf is a Configurator
> >> > view = plugin_conf.get_view_method('current/url/address/')
> >> > rendered_plugin = view(request)
>
> >> > Has pyramid in Configurator (can't find it) method like
> >> > 'get_view_method' or something similar?
>
> >> If you're trying to configure "plugins", use config.include instead of
> >> trying to create some separate configurator that has some other sort
> >> of.. something... inside a
> >> view.http://docs.pylonshq.com/pyramid/dev/narr/advconfig.html#including-co...
>
> >> - C
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "pylons-discuss" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/pylons-discuss?hl=en.
>
> --
> Danny Navarro | http://dannynavarro.net
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.