Re: Trouble with Routes

2007-08-28 Thread Marcin Kasperski


(after additional reconsideration)

I think that the - with respect to the current behaviour - whole
term 'named route' and mapper syntax is misleading.

Let's once more take a look at the original example:

   from routes import *
   m = Mapper()
   m.connect('gallery_thumb', 'images/gallery/:(image_id)_thumbnail.jpg')
   m.connect('gallery', 'images/gallery/:(image_id).jpg')
   url_for('gallery_thumb', image_id=1)
  '/images/gallery/1_thumbnail.jpg'

Is the name 'gallery_thumb' in any way related to the url
'images/gallery/:(image_id)_thumbnail.jpg'? Is there any
association made between the two?

No! The syntax above does not - with the current algorithm - bring any
association between the name and the url (route).

So ... isn't the name 'named route' just misleading?

Let's now see what is it bringing us? Quoting your example:

   m.connect('gallery_thumb', 
'images/gallery/:(image_id)_:(image_size).jpg', image_size='thumbnail')
   m.connect('gallery', 'images/gallery/:(image_id).jpg')
   url_for('gallery_thumb', image_id=1)
  '/images/gallery/1_thumbnail.jpg'
   url_for('gallery', image_id=1)
  '/images/gallery/1.jpg'

As you already explained, the 'gallery_thumb' name is bringing us
*only* one thing: default parameter image_size='thumbnail'.

What surely could be better expressed by some other syntax. For
example:

   m.alias('gallery_thumb', image_size='thumbnail')

Also, it is of course just an alias/macro/parameter set/ It is
in no way *named route*.

Note that in this very thread you already have three different
people who happened to be confused by the current behaviour.

I think that 'named routes' can be very useful in complicated url
construction cases, but only if they do what the name suggest
- enforce using the named rule.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: i18n, FormEncode, Genshi

2007-08-28 Thread Alberto Valverde

On Aug 28, 2007, at 5:32 AM, Max Ischenko wrote:

 Hi Alberto,

 On 8/27/07, Alberto Valverde [EMAIL PROTECTED] wrote:

 You'll then have to add FormEncode's messages to your app's message
 catalog, compile it, etc... and that should do it.

 BTW, I'd love to hear of a way to configure Pylons's _ function to
 use the message catalog inside FormEncode's egg instead of copying it
 inside my app's catalog, is there any?

 I submitted a patch that does roughly this, see
 http://pylonshq.com/project/pylonshq/ticket/296

Yeah, this is more or less what I was talking about. However, my  
thoughts were more on the direction of the domain kw. that TG's  
gettext had (and that formencode is built around) which lets you  
choose which egg's catalog to use for translations.

OTOH, Ben's suggestion of an utility that consolidated all the messge  
catalogs used by the application into one sounds like the best idea  
to me since it gives you full control of the final catalog (eg: to  
override ceratin strings) and would scale better when using various  
eggs each with their own catalog (although none implemented yet,  
widget packages come to mind...)

I haven't used Babel yet so I don't feel I'm in the best position to  
open a feature request for this at their tracker just now... perhaps  
someone that also thinks it's a good idea can do it? :)

Albert


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: i18n, FormEncode, Genshi

2007-08-28 Thread Alberto Valverde


On Aug 27, 2007, at 10:44 PM, Daniel Haus wrote:

 Now there's still this Genshi translation-filter issue. The Pylons
 i18n tutorial does cover message extraction from Genshi, but there are
 no hints on configuration of that filter, which i think would be
 necessary. Is this a common problem, or am I missing something
 obvious?

Take a look at http://genshi.edgewall.org/wiki/Documentation/ 
i18n.html#translation and the  source of genshi's Buffet plugin.  
Apparently (haven't tried, so tell us how it goes...:) you should be  
able to do something like:

from genshi.filters import Translator
from pylons.i18n import _

def template_loaded(template):
 template.filters.insert(0, Translator(_))

Then you would need to pass this callback when initializing genshi's  
buffet plugin:

inside middleware.py (or load_environment):

options = {genshi.loader_callback: template_loaded}
# options.update(options_from_config_file)
config.add_template_engine(genshi, yourapp.templates, options)

HTH,
Alberto

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Place to store file-based data

2007-08-28 Thread Mike Orr

On 8/26/07, Frederik [EMAIL PROTECTED] wrote:
 Currently, I try to build a pylons app that stores it's content in xml
 files. So I'd like to know where the best place for these files would
 be. This is somewhat similar to file-based Wiki data. Is there a
 standard place to keep such files?

I would make a subdirectory under the data directory and reference it
in the config file.

coolapp.data = %(here)s/data/coolapp

Don't assume the data directory exists when your component is
initialized; you may have to create it (os.makedirs).

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Problems again installing pylons on Debian

2007-08-28 Thread voltron

I am having problems installing Pylons on Debian Etch again:

Extracting Pylons-0.9.6rc3-py2.4.egg to /usr/lib/python2.4/site-
packages
Sorry: IndentationError: ('unindent does not match any outer
indentation level', ('/usr/lib/python2.4/site-packages/Pylons-0.9.6rc3-
py2.4.egg/pylons/controllers.py', 131, 39, '
func.__name__, args)\n'))Adding Pylons 0.9.6rc3 to easy-install.pth
file

Installed /usr/lib/python2.4/site-packages/Pylons-0.9.6rc3-py2.4.egg
Reading http://www.pylonshq.com/download/
Processing dependencies for pylons
Searching for Mako=0.1.8
Reading http://www.python.org/pypi/Mako/
Reading http://www.makotemplates.org/
Reading http://www.python.org/pypi/Mako/0.1.8
Best match: Mako 0.1.8
Downloading 
http://pypi.python.org/packages/source/M/Mako/Mako-0.1.8.tar.gz#md5=b4f3528ec0986a91e38c7f329a3f2b82
Processing Mako-0.1.8.tar.gz
Running Mako-0.1.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-
DnocEG/Mako-0.1.8/egg-dist-tmp-o86CGi
Adding Mako 0.1.8 to easy-install.pth file

Installed /usr/lib/python2.4/site-packages/Mako-0.1.8-py2.4.egg
Searching for nose=0.9.2,=0.9.9
Best match: nose 0.9.2
Downloading http://pylonshq.com/download/0.9.6rc2/nose-0.9.2.tar.gz
Processing nose-0.9.2.tar.gz
Running nose-0.9.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-
BcGbfU/nose-0.9.2/egg-dist-tmp-NQTwJS
The required version of setuptools (=0.6c5) is not available, and
can't be installed while this script is running. Please install
 a more recent version first.


I wonder why this is, I have never had any problems on Windóws
systems. Is there going to be a fix for this soon?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: SQLAlchemy tutorial split into 0.4 and 0.3 versions

2007-08-28 Thread Ches Martin

Ok, no more Session.mapper in QuickWiki :-)

- Ches


On Aug 25, 8:44 pm, Ben Bangert [EMAIL PROTECTED] wrote:

 So, I've got to admit, I'm actually regretting telling Ches that
 Session.mapper was fine. I talked with Mike, and it turns out I
 really didn't understand a bunch of the intricacies of Session.mapper
 vs using the basic mapper function from SA 0.4. As such, if we want
 to show Session.mapper somewhere, thats fine, but I'm really thinking
 it's best we advocate the basic usage of mapper.





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: SQLAlchemy tutorial split into 0.4 and 0.3 versions

2007-08-28 Thread Gabriel Gellner

:-)
Thanks for the great work, this makes my ability to grok the new way of doing
things much easier!

Gabriel

On Tue, Aug 28, 2007 at 05:09:05PM -0700, Ches Martin wrote:
 
 Ok, no more Session.mapper in QuickWiki :-)
 
 - Ches
 
 
 On Aug 25, 8:44 pm, Ben Bangert [EMAIL PROTECTED] wrote:
 
  So, I've got to admit, I'm actually regretting telling Ches that
  Session.mapper was fine. I talked with Mike, and it turns out I
  really didn't understand a bunch of the intricacies of Session.mapper
  vs using the basic mapper function from SA 0.4. As such, if we want
  to show Session.mapper somewhere, thats fine, but I'm really thinking
  it's best we advocate the basic usage of mapper.
 
 
 
 
 
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---