[Pyramid] I wonder if I can loa d imperative python configuration instructions from include package=… / in Z CML file ?

2011-01-06 Thread Stéphane Klein

Hi,

I wonder if I can load imperative python configuration instruction from 
include package=… / in ZCML file ?


Regards,
Stephane
--
Stéphane Klein steph...@harobed.org
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: [Pyramid] I wonder if I can load imperative python configuration instructions from include package=… / in ZCML file ?

2011-01-06 Thread Chris McDonough
On Thu, 2011-01-06 at 09:30 +0100, Stéphane Klein wrote:
 Hi,
 
 I wonder if I can load imperative python configuration instruction from 
 include package=… / in ZCML file ?

No, sorry.  Use config.include(somefunc) instead.

- C


 
 Regards,
 Stephane
 -- 
 Stéphane Klein steph...@harobed.org
 blog: http://stephane-klein.info
 Twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.com
 


-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: [Pyramid] I wonder if I c an load imperative python configuration instr uctions from include package=… / in ZCML file ?

2011-01-06 Thread Stéphane Klein

Le 06/01/2011 09:37, Chris McDonough a écrit :

On Thu, 2011-01-06 at 09:30 +0100, Stéphane Klein wrote:

Hi,

I wonder if I can load imperative python configuration instruction from
include package=… /  in ZCML file ?


No, sorry.  Use config.include(somefunc) instead.


Ok, thanks.

I would like to have your suggestion about this problem :

* I have a main application based on Pyramid

  In configure.zcml of this application I have :

  ::

 include package=mypackage/

* In mypackage initialisation I would like do :

::

reload_templates = config.settings.get('reload_templates', False)
directories = config.settings.get('jinja2.directories')

...

environment = Environment(loader=loader,
  auto_reload=reload_templates,
  autoescape=autoescape,
  extensions=extensions)
config.registry.registerUtility(environment, IJinja2Environment)

I can't do that if I use zcml to initialize mypackage. I need to say 
to my mypackage users to do something like :


::

config.include('mypackage.initialise')

This question is in relation with
https://github.com/Pylons/pyramid_jinja2/issues/issue/13

Thanks for your help.

Regards,
Stephane

--
Stéphane Klein steph...@harobed.org
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



babel clear's translations

2011-01-06 Thread Alexander Zhabotinskiy
Sometimes during

python setup.py extract_messages
python setup.py update_catalog

babel clear's my .po files with translations. Why it happens?

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



pyramid.exceptions.Forbidden question

2011-01-06 Thread Eric Lemoine
Hi

So in Pyramid we have the Forbidden exception (and its associated
built-in view). I've been surprised that raising Forbidden results in
a 401 response, given the name of the exception I'd have expected a
403 response. So I find the exception name misleading, no?

Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



[Pyramid] Genshi Template Auto-restart

2011-01-06 Thread jerry
Hi,

I'm using the Genshi template via --

myapp/__init__.py
config.add_renderer('.genshi', MyGenshiRenderer)
...
class MyGenshiRenderer:
def __init__(self, info):
loader =
TemplateLoader(os.path.abspath(os.path.dirname(__file__)))
self.tmpl = loader.load(info.name)

def __call__(self, value, system):
return self.tmpl.generate(**value).render('html')
myapp/__init__.py

How can I auto-restart pyramid whenever my template changes?

Thanks!

Jerry

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



custom cleanup in Pylons error-handling stack

2011-01-06 Thread Justin Francis
I have recently started using Pylons and am having trouble finding
information about the exact structure of the error handling stack.
When an exception occurs anywhere, what is the sequence of calls that
Pylons makes (from the time the exeception occurs until the error
screen is shown)? How does this sequence differ between debug mode and
release mode?

This leads me to my question: I want to do a custom cleanup right
before Pylons displays the error page. I have some database objects on
which I want to issue a Rollback(). Where in the Pylons code would I
place this rollback, so that it gets called whenever Pylons handles an
exception?

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: Session with flash request.

2011-01-06 Thread Francesco Mazzoli
I don't think I understand how would that work.
You are proposing to include the random id in the request, store it
somewhere and then check that it is the right one when receiving the
request?

On Jan 4, 7:51 pm, Daniel Holth dho...@gmail.com wrote:
 I suggest you just give the upload its own random id:

 import uuid
 random_id = str(uuid.uuid4())

 don't use the session at all in the fancyupload handler, and use the upload
 id to associate that (group) of uploads with the user or the user's session
 later.

 Daniel

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Access server:main in pylons controller

2011-01-06 Thread pan pan
Hi All,

I need to send out information of port and ssl information through
pylons controller. These information can easily be found in
[server:main] section in the config file. However, it seems that by
default a pylons controller can only access [app:main] section. Is
there any way that I can get around it?

Thanks in advance!
Pan

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.