Re: tw middleware append genshi filter

2009-02-04 Thread zordsdavini

Ačiū Dalius for help. This I already made.

But we found how to make it. The problem was tw middleware do genshi
render itself, so it doesn't touch pylons config of genshi.

The result (in middleware.py):

app = make_tw_middleware(app,
{
'toscawidgets.framework':
'pylons',
'toscawidgets.framework.default_view':
'genshi',
'toscawidgets.framework.translator': lazify
(translate),
 
'toscawidgets.framework.engine_options':
{'genshi.loader_callback':
template_loaded},
'toscawidgets.middleware.inject_resources': True})

there translate is my own translator and template_loaded is appended
filter to genshi:

def template_loaded(template):
Genshi TemplateLoader callback. Inserts the translator filter.

template.filters.insert(0, Translator(translate))

May be it will help to somebody

Arns


On Feb 4, 7:46 am, Dalius Dobravolskas dalius.dobravols...@gmail.com
wrote:
 On Wed, Feb 4, 2009 at 4:06 AM, zordsdavini zordsdav...@gmail.com wrote:

  Hi all,

  How to append genshi translator during init of toskawidgets? This
  problem comes from custom tw.forms templates. They are not
  translating. I feel there should be some simple step.

  I'm not sure what you mean by genshi translator but my guess is that you

 must use lazystring:

 Something like that:

     23 
 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l23class
 CommentForm(forms.ListForm):
     24 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l24
     25 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l25
    class fields(WidgetsList):
     26 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l26
        name = forms.TextField(label_text = lazystring(_('Name')),
 help_text = lazystring(_('Required')),
     27 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l27
                validator = UnicodeString(not_empty=True)
     28 http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py#l28
                )

 More code here:http://hg.sandbox.lt/pekla/file/012a56a06089/pekla/lib/forms.py

 If that does not help maybe other person will help you here ;-)

 --
 Daliushttp://blog.sandbox.lt
--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



pylons and hoteditor

2009-02-04 Thread przemek.ch

There's a nice wysiwyg/bbcode editor 
http://www.ecardmax.com/hoteditor/index.html.

But I'm confused about one thing.

The editor works like that:
td
script
   var getdata =[B]Test me[/B];
   Instantiate(min,editor, getdata , 600px, 200px);
/script
/td

So the editor will be loaded and the content form getdata will be
added.


But there's one big problem wilt new line and return carriage
characters.

Example:

1. Enter characters in new lines

a
b
c

2. Save it into db as bbcode.
It will be saved as a \n\r b \n\r c - of course \n\r will not be
visible as string '\n\r'

3. Then I want to load that content to the editor from DB

var getdata =${h.content_form_db};
Instantiate(min,editor, getdata , 600px, 200px);


And here's the problem, generated code looks like that:

var getdata =a
b
c;
Instantiate(min,editor, getdata , 600px, 200px);

So it's not a valid js code and it will fail.

Ok so I've done something like that:
Before i save bbcode content to db i replace \n to \\n and remove all
\r.
This works and now the generated code looks like that.

var getdata =a\nb\nc;
Instantiate(min,editor, getdata , 600px, 200px);

But there's a new problem.
If a user will put into editor '\n' or '\r' string my replace method
will fail...

Any suggestions?

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



clean up after session finished

2009-02-04 Thread sevi

Hello all,
I am new to pylons and want to develop an app which generates some
images.
For each session I generate a folder to contain the images for this
session, which
the user then can download. I want the folder and the images to be
deleted when
the user closes the browser. Is there a way to do this? Am I missing
something obvious?
Thanks,
sevi

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



2nd call for papers: PostgreSQL Conference East

2009-02-04 Thread Joshua D. Drake

PostgreSQL Conference East is being held at historic Drexel University
on April 3rd through 5th 2009 . This is the second call for papers. The
call for papers ends Feb 23rd and speakers will be notified on the 27th.
You may submit your talk here: http://www.postgresqlconference.org . We
are looking for a wide range of topics. Can you speak on any of the
below topics? What about a different topic? As long as it is centered
around Postgre SQL we want to hear about it.

Hacker topics:
MVCC
C Function development
Writing Procedural Languages
Creating types
The planner
Optimization tips
Explaining the process model

DBA topics:
Backing up PostgreSQL
Understanding and Configuring Autovacuum
Normalization
Trigger Happy (how to use triggers ;)
PITR -- happiness is a shipped transaction log
User / Groups / Roles
Security

End User development:
Web Frameworks with PostgreSQL
   Pylons
   Grails
   Rails
   Cake
   Turbo Gears
   Django

Solutions:

  Do you have a successful case study to present? 
  How did you solve a problem with PostgreSQL?
  Do you have an Open Source product that runs on PostgreSQL?

As always we let the presenters drive the feel of the conference. If you
have an itch, let's figure out how to scratch it (as long as it is with
PostgreSQL). Submit your paper today:
http://www.postgresqlconference.org/
-- 
PostgreSQL - XMPP: jdr...@jabber.postgresql.org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997


--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons reload signal?

2009-02-04 Thread Ian Bicking
On Wed, Feb 4, 2009 at 12:36 AM, Kevin Baker kba...@missionvi.com wrote:

 So are you saying that it is doing a restart when it detects a change...
 not just reloading the conf?

 If that is the case I guess I can just restart.

 I am trying to reload with as little impact on uptime as possible. With
 apache I do a /etc/init.d/apache2 reload rather than restart for the same
 effect.


Yes, that's how it works.  Apache actually works similarly, but it's a
multi-process system -- when it reloads the configuration it makes sure all
incoming requests are finished, holds any new incoming requests, and kills
all the child processes and then new processes are made with the new
configuration.

If you have a process in front of the Pylons process you can avoid
interruption, so long as the thing proxying to the process will do a retry.
I don't think mod_proxy does this, but FastCGI/SCGI and maybe some other
setups will do so.

-- 
Ian Bicking  |  http://blog.ianbicking.org

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



appcelerator anyone?

2009-02-04 Thread Kumar McMillan

Has anyone played around with Appcelerator?
http://doc.appcelerator.org/overview/index.html
http://appcelerator.org/

Kind of mega but still a neat idea, especially how you can pass
messages transparently from JavaScript to the server and back.

Looks like the Python web backend is built on Pylons:
http://doc.appcelerator.org/get_started/python/directory_structure.html

Kumar

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: clean up after session finished

2009-02-04 Thread Mike Orr

On Wed, Feb 4, 2009 at 4:30 AM, sevi seee...@gmx.net wrote:

 Hello all,
 I am new to pylons and want to develop an app which generates some
 images.
 For each session I generate a folder to contain the images for this
 session, which
 the user then can download. I want the folder and the images to be
 deleted when
 the user closes the browser. Is there a way to do this? Am I missing
 something obvious?

You don't know when the user closes the browser.  In fact, you don't
know anything after the user's last request, whether you will hear
from them again or not.  The normal way to handle this is a cron job
that deletes all sessions that have been idle for a period of time
(say 8 hours or whatever you want).  I haven't done this in Pylons,
but somehow you should be able to ask Beaker which sessions exist and
when they were last modified.

-- 
Mike Orr sluggos...@gmail.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-discuss@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: clean up after session finished

2009-02-04 Thread Severin Bannert

Mike Orr schrieb:
 On Wed, Feb 4, 2009 at 4:30 AM, sevi seee...@gmx.net wrote:
   
 Hello all,
 I am new to pylons and want to develop an app which generates some
 images.
 For each session I generate a folder to contain the images for this
 session, which
 the user then can download. I want the folder and the images to be
 deleted when
 the user closes the browser. Is there a way to do this? Am I missing
 something obvious?
 

 You don't know when the user closes the browser.  In fact, you don't
 know anything after the user's last request, whether you will hear
 from them again or not.  The normal way to handle this is a cron job
 that deletes all sessions that have been idle for a period of time
 (say 8 hours or whatever you want).  I haven't done this in Pylons,
 but somehow you should be able to ask Beaker which sessions exist and
 when they were last modified.

   
Ok, I was suspecting something like that. I will look into it, 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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: appcelerator anyone?

2009-02-04 Thread Iain Campbell

I'm building an intranet on Pylons and Appcelerator at the moment -  
very impressed. A bit pointless for a public facing site tho due to  
validation issues..

--
www.kandaba.com

web | iptv | mobile
development  consultancy

t: +44 (0) 203 051 7792
m: +44 (0) 7815 821 678
gtalk: i...@kandaba.com

On 4 Feb 2009, at 20:06, Kumar McMillan kumar.mcmil...@gmail.com  
wrote:


 Has anyone played around with Appcelerator?
 http://doc.appcelerator.org/overview/index.html
 http://appcelerator.org/

 Kind of mega but still a neat idea, especially how you can pass
 messages transparently from JavaScript to the server and back.

 Looks like the Python web backend is built on Pylons:
 http://doc.appcelerator.org/get_started/python/ 
 directory_structure.html

 Kumar

 

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: clean up after session finished

2009-02-04 Thread Matt Feifarek
On Wed, Feb 4, 2009 at 3:10 PM, Mike Orr sluggos...@gmail.com wrote:

 You don't know when the user closes the browser.  In fact, you don't
 know anything after the user's last request, whether you will hear
 from them again or not.


Right, but I've always wanted this... although it is stateless, there is
still an event we can use.

The appserver knows when it cleans up or expires the session... couldn't we
do an event hook there, something like on_expire()?

--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: clean up after session finished

2009-02-04 Thread Mike Orr

On Wed, Feb 4, 2009 at 6:02 PM, Matt Feifarek matt.feifa...@gmail.com wrote:
 On Wed, Feb 4, 2009 at 3:10 PM, Mike Orr sluggos...@gmail.com wrote:

 You don't know when the user closes the browser.  In fact, you don't
 know anything after the user's last request, whether you will hear
 from them again or not.

 Right, but I've always wanted this... although it is stateless, there is
 still an event we can use.

 The appserver knows when it cleans up or expires the session... couldn't we
 do an event hook there, something like on_expire()?

That would be useful for the case of sessions that have external
resources to clean up.  I got a private question this week about
having per-user SQLAlchemy engines.  Those can't be pickled so they
can't be stored in the session, so I suggested putting a dict on
pylons.app_globals for them, but again you have the problem of
expiring them.

Pylons/Paste doesn't have a cron scheduler to sweep through and expire
old sessions, but maybe it's time we added that.  Or rather... it
would only work with PasteHTTPServer.  mod_wsgi doesn't have a Python
server process to trigger the events or run them in.

-- 
Mike Orr sluggos...@gmail.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-discuss@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: clean up after session finished

2009-02-04 Thread Graham Dumpleton



On Feb 5, 1:40 pm, Mike Orr sluggos...@gmail.com wrote:
 On Wed, Feb 4, 2009 at 6:02 PM, Matt Feifarek matt.feifa...@gmail.com wrote:
  On Wed, Feb 4, 2009 at 3:10 PM, Mike Orr sluggos...@gmail.com wrote:

  You don't know when the user closes the browser.  In fact, you don't
  know anything after the user's last request, whether you will hear
  from them again or not.

  Right, but I've always wanted this... although it is stateless, there is
  still an event we can use.

  The appserver knows when it cleans up or expires the session... couldn't we
  do an event hook there, something like on_expire()?

 That would be useful for the case of sessions that have external
 resources to clean up.  I got a private question this week about
 having per-user SQLAlchemy engines.  Those can't be pickled so they
 can't be stored in the session, so I suggested putting a dict on
 pylons.app_globals for them, but again you have the problem of
 expiring them.

 Pylons/Paste doesn't have a cron scheduler to sweep through and expire
 old sessions, but maybe it's time we added that.  Or rather... it
 would only work with PasteHTTPServer.  mod_wsgidoesn't have a Python
 server process to trigger the events or run them in.

You could use WSGIDaemonProcess to create an additional daemon process
and then use WSGIImportScript to preload script that triggers
background thread to do any periodic processing. This daemon process
wouldn't be used to handle requests, just to do background stuff.

If only using a single process in daemon process group to handle
requests, you could always just run the background thread in it. You
only need a separate daemon process dedicated to it when using
embedded mode or daemon mode with multiple processes in daemon process
group.

I had started on a wiki document about doing just this sort of thing,
but only got it half way done. :-(

Graham
--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: clean up after session finished

2009-02-04 Thread Chris Miles


On 05/02/2009, at 1:40 PM, Mike Orr wrote:


 Pylons/Paste doesn't have a cron scheduler to sweep through and expire
 old sessions, but maybe it's time we added that.  Or rather... it
 would only work with PasteHTTPServer.  mod_wsgi doesn't have a Python
 server process to trigger the events or run them in.

How about just a new paster command to do the job?  Then the user can  
decide how and when it should be run (cron, by hand, etc).

Cheers,
Chris Miles


--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Pylons on CYGWIN

2009-02-04 Thread Tycon

For people developing on Windows, Cygwin is a valuable tool, but
beyond having access to unix shell utilities, you can also install
some advanced software packages on Cygwin, like Python, Ruby, SQLite,
etc. In fact it's possible to install Pylons and use that instead of
using the regular windows Python installation.

Does anyone have any experience with this kind of setup ? I assume the
performance would be bad since most apps running on Cygwin are slow
(possibly due to the overhead of linux-windows system call
translation)
--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: appcelerator anyone?

2009-02-04 Thread Kumar McMillan

On Wed, Feb 4, 2009 at 3:28 PM, Iain Campbell i...@kandaba.com wrote:

 I'm building an intranet on Pylons and Appcelerator at the moment -
 very impressed. A bit pointless for a public facing site tho due to
 validation issues..

validation, as in, security of how it does the message passing?


 --
 www.kandaba.com

 web | iptv | mobile
 development  consultancy

 t: +44 (0) 203 051 7792
 m: +44 (0) 7815 821 678
 gtalk: i...@kandaba.com

 On 4 Feb 2009, at 20:06, Kumar McMillan kumar.mcmil...@gmail.com
 wrote:


 Has anyone played around with Appcelerator?
 http://doc.appcelerator.org/overview/index.html
 http://appcelerator.org/

 Kind of mega but still a neat idea, especially how you can pass
 messages transparently from JavaScript to the server and back.

 Looks like the Python web backend is built on Pylons:
 http://doc.appcelerator.org/get_started/python/
 directory_structure.html

 Kumar

 

 


--~--~-~--~~~---~--~~
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 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---