Re: newbie

2006-06-07 Thread askel
Bilboon wrote: Is there a simple way to protect methods of controllers using permission ? There is always more than one way, despite Python's manifesto :) You can use AuthKit. Search for AuthKit in this group's archives for more information. I personally didn't like that it depends on extra

Re: newbie

2006-06-08 Thread askel
I have a slightly different version that does a transparent authentication/authorization. By transparent I meant that there is no redirect sent to user when authentication is required. WHenever user tries to access protected action, authentication form is shown and user gets stright to the action

ini-file as startup script on UNIX/Linux

2006-06-28 Thread askel
Hello everybody, According to PasteScript documentation, ini-file can be easily converted into startup script on UNIX/Linux platforms by adding magic-line at the very top, adding [exe] section and setting execution bit. However, that wont work for ini-files generated using Pylons. The reason is

Re: redirect_to and HTTP-HTTPS

2006-07-06 Thread askel
That was fast. Thank you Ben --~--~-~--~~~---~--~~ 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

Re: Sending intermediate content

2006-08-17 Thread askel
Ben Bangert wrote: def action(self): req = request.current_obj() def long_func(): env = req.environ yield some content # do something that takes awhile yield more content resp = Response() resp.content = long_func() return

Re: confusing routes behavior

2006-10-02 Thread askel
Jon, That is a feature. All unspecified parameters are inherited from current request unless controller name is prefixed with /. In your case, story is not specified and map has no placeholder for story so it is placed as get parameter. Put / in front of controller name to make sure that nothing

Re: Secure File Download

2006-10-11 Thread askel
Muhammad, I'd do that this way from paste.wsgilib import add_close f = open(filename) r = Response(mimetype='application/octet-stream') r.content = add_close(f, lambda: f.close()) return r --~--~-~--~~~---~--~~ You received this message because you are

Re: Secure File Download

2006-10-12 Thread askel
Philip, You are right. add_close is useless in that case. Thanks for correcting me. r = Request(mimetype='application/octet-stream') r.content = open(filename) return r --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Status Code Other than 200?

2006-10-20 Thread askel
wyatt-bC wrote: Howdy. I'm doing some AJAXy stuff and I can't seem to get a status code other than 200. The relevant controller looks like this (sort of): def show(self, blah, blah): # do stuff and set ``code`` depending on what happens # ... return

Re: Controller attributes and their persistence...

2006-12-28 Thread askel
James Gardner wrote: Hi jw, This is because a new instance of the controller object is created on each request, if it wasn't, your controllers would not be thread safe because class members set by one thread might be read by another. Hi James, Is that right that the only reason why

Re: How to use Myghty to generate HTML and Text emails?

2007-01-03 Thread askel
http://www.myghty.org/docs/programmatic.myt#configuration_programmatic_interpreter_standalone --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to

Returning generator as Response.content

2007-02-19 Thread askel
Hello everyone, I'm trying to implement server-push functionality using multipart/x- mixed-replace content type as following: # in theory, this function should run forever or until connection is closed def generate_stream(boundary): boundary = '\n%s\n' % boundary yield boundary # returns

Starting your own thread

2007-03-02 Thread askel
Hello everybody, Let's say I need some task to be executed periodically while my WSGI application is serving requests. In a nutshell, I need to start a thread that . What is the best place to start such a thread? I ended up implementing paste.server_runner endpoint where I start my thread and

Re: New Pylons site launched

2007-03-23 Thread askel
Congrats! Nicely done indeed! The great thing about Pylons (and Python for that matter) is how less effort has to be put in to make it working the way you want it. Yesterday I deployed second project that is powered by Pylons. Unfortunately, I cannot invite everybody to see it because it is

Re: Proxy helper

2007-03-26 Thread askel
Rick, If I couldn't use a regular proxy in front of such an application, I'd rather go for paste.proxy instead of trying to implement it on Pylons level. On Mar 25, 5:31 pm, ram [EMAIL PROTECTED] wrote: I've got a requirement to have our Pylons app act as an occasional proxy to a different

Re: multiple submit buttons in one form

2007-04-03 Thread askel
if 'get_merges' in request.params: get_merges() elif 'plot_merges' in request.params: plot_merges() else: # initial form request On Apr 3, 3:55 pm, ben adam [EMAIL PROTECTED] wrote: This is what i have in my template: input class=submit name=get_merges type=submit value= Get Merges

Re: TurboCheetah

2007-04-04 Thread askel
On Apr 4, 1:29 am, Mike Orr [EMAIL PROTECTED] wrote: I tried incorporating TurboCheetah into Cheetah and (re)discovered it's using dotted notation (section.index) rather than the URI notation (/section/index.tmpl) that Pylons at least is standardizing on. I'm hesitant to put dotted

Re: Paster, SQLAlchemy $HOME/.python.eggs

2007-05-04 Thread askel
On May 3, 9:27 am, C. Handel [EMAIL PROTECTED] wrote: When i try to start a paster-service using the --user flag i run into some permission problems I tried to use this command to start the service: paster serve server.ini --user=www Paster will create a temporary objectstore in the

Re: Paster, SQLAlchemy $HOME/.python.eggs

2007-05-04 Thread askel
Another way is to set environment variable PYTHON_EGG_CACHE to something accessible by user that paster switches to after starting the daemon. On May 4, 7:59 am, askel [EMAIL PROTECTED] wrote: On May 3, 9:27 am, C. Handel [EMAIL PROTECTED] wrote: When i try to start a paster-service using

Re: Access to active sessions

2007-06-14 Thread askel
it is really needed would make a nice improvement. On Jun 13, 5:10 pm, Daniel Tang [EMAIL PROTECTED] wrote: On 6/12/07, askel [EMAIL PROTECTED] wrote: Hello everyone, How do I access active sessions? I need to be able to update or close some sessions. Suppose I disable some user account and I

Re: Free blog application

2007-07-05 Thread askel
All I can say, it is classical FUD. On Jul 4, 1:16 pm, Mike Orr [EMAIL PROTECTED] wrote: On 6/26/07, Jonas [EMAIL PROTECTED] wrote: On 26 jun, 01:38, David Smith [EMAIL PROTECTED] wrote: Jonas wrote: I comment you the infrastructure that I would use in case we could

Re: sqlalchemy is returning the wrong data

2007-08-06 Thread askel
let me guess, you do not clear database session before/after each request On Aug 6, 12:02 pm, jose [EMAIL PROTECTED] wrote: I have a perplexing problem and I'm really hopping that there is a setting or something stupid that I've missed. Here is the issue, I have an application most of my

Re: SQLAlchemy 0.3 transactions inside Pylons controllers

2007-09-09 Thread askel
i'm just wondering if rollback should be called if commit fails, i.e. if there is difference between: try: ... except: t.rollback() else: t.commit() and try: ... t.commit() except: t.rollback() On Sep 8, 6:23 am, Jose Figueras [EMAIL PROTECTED] wrote: t =

Re: New SQLAlchemy tutorial

2008-02-25 Thread askel
Mike, Thank you for posting tips like that and keeping them up to date. There is small typo in load_environment section -- init_model is referred as init_engine. I'm using little different approach. Instead of defining init_model() and calling scoped_session() with bind parameter I simply

Re: show_button is not defined -- error in prototype.js?

2008-02-25 Thread askel
Eric, Apparently, your javascript code is calling Element.update() with second argument that contains script tag with show_button('extra_data_text', 'text version') as its text. Most likely it is coming from Web server response to Ajax request. On Feb 26, 2:47 am, Eric Ongerth [EMAIL PROTECTED]

Re: advice with configuration/scaling a live Pylons app.

2008-05-31 Thread askel
Hi Sam, On May 28, 6:12 pm, SamDonaldson [EMAIL PROTECTED] wrote: Yes, lighttpd serving static and all dynamic requests forwarded to the paster process talking SCGI. Should I make the switch to nginx as it seems like everybody has something good to say about nginx, and it's a good load

Re: parameterized controllers

2008-05-31 Thread askel
Hi Wichert, What I use to avoid such repetitions is: # in BaseController # sequence of (param, attr, getter) _fetch = [] def __before__(self): for param, attr, getter in self._fetch: setattr(c, attr, getter(getattr(c, param))) # in CustomerController _getters = ( ('id',

Beaker session API feature request

2008-06-28 Thread askel
Hello everyone, I'm not sure if it is the right place to ask this question but trac at http://beaker.groovie.org/ seems to be virgin. Long story short. There is need for some API to enumerate all Beaker sessions. Sessions are very useful when one needs to transform stateless HTTP protocol into

Re: response status when form validation fails

2008-08-22 Thread askel
Hello guys, Do you mind if I chime in? I agree that verify should not use 400 HTTP status code to indicate failure of verifying variable values. I don't think that even an failure to parse HTTP request body should be indicated in such a way as long as there were no failure on HTTP protocol

Re: Redirect being raised from outside a controller

2008-10-18 Thread askel
Well, apparently, my idea on that didn't make it working because it isn't much different if you use global or local reference to the same proxy object. At the time that function is called real session and request are referenced by them. On Oct 18, 9:56 am, askel [EMAIL PROTECTED] wrote: Adam

Re: CMS/CMF on top of Pylons

2009-03-21 Thread askel
On Mar 20, 1:04 pm, lengani leng...@gmail.com wrote: What sort of CMS/CMF do you secretly hope to be built on top of Pylons? If you need CMS why not use what was specifically designed that way? I believe people who seek out-of-box CMS should not look at Pylons because they dont need its power

Re: CMS/CMF on top of Pylons

2009-03-23 Thread askel
It all depends on how much of CMS you need in your app. It could be as simple as Wiki Pylons tutorial which I believe is classical (yet rudimentary) CMS. My point is that Pylons is possible but not best bet as long as CMS is concerned. On Mar 20, 1:04 pm, lengani leng...@gmail.com wrote: Hi

Re: Catch unimplemented action

2009-03-25 Thread askel
Edgar, I'd define controller's __getattr__ method and return some dummy action as following: def _dummy_action(self): ... def __getattr__(self, name): return self._dummy_action It will catch all other non-existant attribute requests but this is probably simpliest working solution. Cheers

Re: Catch unimplemented action

2009-03-27 Thread askel
Original poster says he wants to avoid NotImplementedError exception which only happens in debug mode instead of returning 404. On Mar 25, 4:27 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Mar 25, 11:06 am, askel dummy...@mail.ru wrote: Edgar, I'd define controller's

Re: Many-to-Many count

2009-12-07 Thread askel
Alexander, Do you want to know how many children some Parent instance has? If that's what you're looking for then len(parent.children) is one of many ways to get answer. It is probably the best one if children are eager loaded but it is most likely the worst one if they are lazy loaded. Cheers

Pylons + SQLAlchemy on top of gevent.pywsgi

2010-11-19 Thread askel
Hello everybody, I wasn't able to find any information on how to run Pylons app that uses SQLAlchemy ORM on top of single-thread coroutine based WSGI server like gevent.pywsgi.WSGIServer so I decided this information could be usable for somebody else. I was about to start small backoffice

Re: Pylons + SQLAlchemy on top of gevent.pywsgi

2010-11-19 Thread askel
I forgot to mention that make_psycopg2_green has to be called somewhere like at the beginning of init_model call. And the fun part was that I was able to do something like the following: # myproject/lib/app_globals.py from gevent.event import Event class Globals(object): def __init__(self,

Re: Pylons + SQLAlchemy on top of gevent.pywsgi

2010-12-05 Thread askel
Hi Nik, That code while it looks pretty much the same in WSGI server setup would not work well for SQLAlchemy application because all database access calls would be done in synchronous mode and that means for instance that single query that takes long time to execute would block entire web

Re: Pylons + SQLAlchemy on top of gevent.pywsgi

2010-12-06 Thread askel
Nik, gevent documentations says the following: The difference between wsgi.WSGIServer and pywsgi.WSGIServer is that the first one is very fast as it uses libevent’s http server implementation but it shares the issues that libevent-http has. In particular: * does not support streaming: the

FastCGI/WSGI server implementation using gevent

2012-03-15 Thread askel
Hello everybody, It's been a while since this gevent-based library has been announced. It's an FastCGI/WSGI server implementation using gevent. It has reached beta-testing stage and everyone is welcome to try it. It can be used as replacement for flup.fcgi. I have published new version of

Announcement: new deployment option for your Pylons/Pyramid apps

2012-07-16 Thread askel
I'm pleased to announce gevent-fastcgi library. It allows you to deploy your WSGI application using FastCGI protocol. It is still in Beta stage and I'll greatly appreciate bug reports and ideas on how it could be improved. What makes it special? Well, gevent means greenlet co-routines are used in

Re: Default, or fallback, view in traversal?

2012-07-17 Thread askel
Hi Isaac, I'm not a Pyramid expert but I'd play with mapper parameter of add_view or view_config for that. Alex K On Tuesday, July 17, 2012 9:53:49 AM UTC-4, Isaac Jurado wrote: Hello, I would like to know if there is a way to add a fallback view name when a context is found but none

Almost off-topic: OSS benefits

2012-08-16 Thread askel
Hello everybody, It's probably (most likely) not the best place to post this so please excuse my annoyance. Some time ago I made one of the projects I've been working on available to everyone through Github.com and PyPi. There is seems to be some interest in it -- according to PyPi download

Re: Almost off-topic: OSS benefits

2012-08-16 Thread askel
Hi Daniel, Thanks for your reply and the advice. That project is part of my paid job so it's definitely worthwhile to me. I am a lucky one that's being paid for what he loves to do. - Alex K On Aug 16, 1:26 pm, Daniel Holth dho...@gmail.com wrote: I feel your pain, but you are doing amazingly

Re: Almost off-topic: OSS benefits

2012-08-16 Thread askel
...@plope.com wrote: On 08/16/2012 12:29 PM, askel wrote: Hello everybody, It's probably (most likely) not the best place to post this so please excuse my annoyance. Some time ago I made one of the projects I've been working on available to everyone through Github.com and PyPi

Re: Almost off-topic: OSS benefits

2012-08-16 Thread askel
Hi Jonathan, Thanks for great idea to have home page that makes it super easy to post comment. I'll work on that. - Alex K On Aug 16, 1:59 pm, Jonathan Vanasco jonat...@findmeon.com wrote: there are a large number of automatic downloads from web crawlers that will index or re-host the

Almost offtopic: OSS benefits

2012-08-18 Thread askel
Hello everybody, It's probably (most likely) not the best place to post this so please excuse my annoyance. Some time ago I made one of the projects I've been working on available to everyone through Github.com and PyPi. There is seems to be some interest in it -- according to PyPi download

OSS benefits?

2012-08-18 Thread askel
Hello everybody, It's probably (most likely) not the best place to post this so please excuse my annoyance. Some time ago I made one of the projects I've been working on available to everyone through Github.com and PyPi. There is seems to be some interest in it -- according to PyPi download

ANN: Breve template engine renderer for Pyramid just released

2012-09-11 Thread askel
Hello everybody, I used Breve template engine for most of my Pylons projects and I missed it when I switched to Pyramid so I wrote small module that makes my life little easier. It can be installed from PyPi as following: easy_install pyramid_breve or pip install pyramid_breve Once installed

Correct way of detecting application package in third party package

2012-09-18 Thread askel
I'm developing renderer library for Pyramid framework. It's just kind of adapter to use existing template engine in Pyramid applications. The library is using asset specs for template names. And I'd like it to use application package name in case asset spec is missing package part. Originally, I

Re: Correct way of detecting application package in third party package

2012-09-18 Thread askel
UTC-4, Chris McDonough wrote: On Tue, 2012-09-18 at 06:57 -0700, askel wrote: I'm developing renderer library for Pyramid framework. It's just kind of adapter to use existing template engine in Pyramid applications. The library is using asset specs for template names. And I'd like

ANN: Pyramid-breve update

2012-10-25 Thread askel
New version of Breve renderer for Pyramid framework has been released. It's now possible to control important breve.Template parameters, namely tags, xmlns and doctype. For those who's never heard of pyramid-brevehttp://pypi.python.org/pypi/pyramid-breve. It's a package that adds Breve

Re: Problem running pyramid 1.4 project with nginx+uwsgi

2013-07-11 Thread askel
Michael, It seems to me that while Nginx is configured to connect to uwsgi via socket file /tmp/uwsgi.sock you make uwsgi bind/listen to TCP port 8080. - Alex On Saturday, April 20, 2013 5:46:47 PM UTC-4, Michael wrote: Hi, I get Internal Server Error running a pyramid sqlalchemy scaffold

Re: Correct way of detecting application package in third party package

2013-07-23 Thread askel
On Tuesday, September 18, 2012 3:57:21 PM UTC+2, askel wrote: I'm developing renderer library for Pyramid framework. It's just kind of adapter to use existing template engine in Pyramid applications. The library is using asset specs for template names. And I'd like it to use application

Re: [pylons-discuss] Templates in demo apps (without a package)

2013-12-30 Thread askel
I had similar problem when I was implementing Breve template engine renderer (http://github.com/momyc/pyramid-breve). The challenge was that I standard Pyramid technique of detecting calling package was failing because call stack was deeper than it usually is and that renderer library package

[pylons-discuss] Re: Templates in demo apps (without a package)

2013-12-30 Thread askel
I had similar problem when I was implementing Breve template engine renderer (http://github.com/momyc/pyramid-breve). The challenge was that Pyramid's technique of detecting calling package was failing because call stack was deeper (and not even constant) than it usually is and that renderer

[pylons-discuss] Re: Class-based tag helpers

2013-12-31 Thread askel
Mike, take a look at Breve template enginehttp://breve.twisty-industries.com/. It does pretty much what you want. On Tuesday, December 10, 2013 4:20:34 AM UTC-4, Mike Orr wrote: Would you like class-based tag helpers to compose an HTML tag imperatively over several statements? If so, what

Re: [pylons-discuss] Re: Class-based tag helpers

2014-01-01 Thread askel
would add a dependency to a whole template language I'm afraid, avoiding dependency on some package by baking your own is otherwise called reinventing the wheel it looks like you have to put templates in a *.b file rather than directly in your Python code. Breve language IS a 100% Python

Re: [pylons-discuss] Re: Class-based tag helpers

2014-01-01 Thread askel
That flatten function is not needed. print page works just well. On Wednesday, January 1, 2014 7:59:36 PM UTC-4, askel wrote: would add a dependency to a whole template language I'm afraid, avoiding dependency on some package by baking your own is otherwise called reinventing the wheel

Re: [pylons-discuss] Re: Class-based tag helpers

2014-01-01 Thread askel
, 2014 at 3:59 PM, askel homo.pro...@gmail.com javascript: wrote: would add a dependency to a whole template language I'm afraid, avoiding dependency on some package by baking your own is otherwise called reinventing the wheel Except when you depend on something large to avoid writing