pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

support for Mapper(..., explicit=True) #80

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am following the pylons book's recommendations (chapter 9 page 207) and
therefore I have explicit=True and map.minimization=False.

It seems that the FA pylons admin interface relies on at least one of these
features to work though, because I get url_for: unable to generate urls
without the attached patch (which is only lightly tested, I may have missed
more applications of the same error).

I'm new to pylons + FA + Routes though so feel free to tell me I'm making a
stupid mistake.

If not, consider this a request to update the code+templates to explicitly
specificy a controller ;-)

Original issue reported on code.google.com by stijn.h...@gmail.com on 21 Mar 2009 at 3:50

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by jbel...@gmail.com on 23 Mar 2009 at 6:19

GoogleCodeExporter commented 9 years ago
i've added a controller=name to all url_for.

thanks for report

Original comment by gael.pas...@gmail.com on 16 Apr 2009 at 6:36

GoogleCodeExporter commented 9 years ago
Thanks for this, there's one small nit I just discovered:
formalchemy/ext/pylons/base.mako contains an url_for that doesn't resolve with 
the
default mappings; I think the intention of the link was to go back to the model 
list.
See patch below (it's so simple I didn't bother to make an attachment, but poke 
me if
you want one):

diff --git a/formalchemy/ext/pylons/base.mako b/formalchemy/ext/pylons/base.mako
index 92cab4b..7ad1a4b 100644
--- a/formalchemy/ext/pylons/base.mako
+++ b/formalchemy/ext/pylons/base.mako
@@ -28,7 +28,7 @@ ${custom_js}
     <div id="title"><h1>${self.title()}</h1></div>
     <div id="nav">
     %if modelname:
-      <a href="${url_for(controller=controller, modelname=None, action=None, id
=None)}">
+      <a href="${url_for(controller=controller, action='index')}">
         ${F_('Models')}
       </a>
     %endif

Original comment by stijn.h...@gmail.com on 16 Jun 2009 at 12:26

GoogleCodeExporter commented 9 years ago
And another instance of controller= missing:

diff --git a/formalchemy/ext/pylons/admin.py b/formalchemy/ext/pylons/admin.py
index 8db4af2..de265a6 100644
--- a/formalchemy/ext/pylons/admin.py
+++ b/formalchemy/ext/pylons/admin.py
@@ -149,7 +149,7 @@ class AdminController(object):
                 message = F_(message) % (modelname.encode('utf-8', 'ignore'),
                                          _pk(c.fs.model))
                 flash(message)
-                redirect_to(modelname=modelname,
+                redirect_to(controller=self._name, modelname=modelname,
                             action='list', id=None)
         return self._engine('admin_edit', c=c,
                                     action=title, id=id,

Original comment by stijn.h...@gmail.com on 16 Jun 2009 at 12:46