pylons.config and development.ini

2010-11-18 Thread Tomasz Narloch

Hello,

In file: envinronment.py,
def load_environment:

- I set up a few configuration variables like
config['my_var1'] = u'something'
config['my_var2'] = u'something2'

# I want that every var has been unicode type.

Last time I moved a few above variables to development.ini, but now I 
have a little problem with encoding

because I have to every variable that become from ini to decode('utf-8').

There exists some way to automatically convert or load variables from 
ini as unicode?


Best Regards,
Tomasz Narloch

--
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: Error - class 'sqlalchemy.exc.OperationalError': (OperationalError) (2006, 'MySQL server has gone away')

2010-10-15 Thread Tomasz Narloch

Timmy Chan pisze:

i'm running

apache2
SQLAlchemy 0.5.8
Pylons 1.0
Python 2.5.2

and on a simple page (just retrieve data from DB), I get:

Error - class 'sqlalchemy.exc.OperationalError': (OperationalError) 
(2006, 'MySQL server has gone away')


every few other requests, not after a long time as other posts I've 
searched for.  I still added


sqlalchemy.pool_recycle = 1800

but that did not fix the issue.  After a fresh apache restart, every 
5th or 6th requests gets a 500 from the above error.


thanks

See this: 
http://bogdan.org.ua/2008/12/25/how-to-fix-mysql-server-has-gone-away-error-2006.html


Best Regards,
Tomasz Narloch

--
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 threads for some external staff

2010-10-13 Thread Tomasz Narloch

Hello,

I have a problem with the transfer of variables config and app_globals 
to my own thread.

I need config and app_globals has been passed by reference.
Now, I like the one below, but it is not good because it throws a 
segmentation fault at the end of threads.


I read something about register config and agg_globals to threads in 
pylons but I do not know how to do that.

#Maybe I should remove reference to config and app_globals after thread end?

I want the same config and app_globals in my thread and
when I change some params of app_globals (only one of three threads do 
that) it has to be changed in other pylons threads.


Maybe exists some other way to do that?

my thread class:
--
# -*- coding: utf-8 -*-
import threading

class Mythread(threading.Thread):
   # class variables, not instances only

   # Mythread.results[self.myId] = function()
   results = []
   vlock = threading.Lock()
   id = 0 # I want to give an ID number to each thread, starting at 0

   def __init__(self, function, **args):
   # invoke constructor of parent class
   threading.Thread.__init__(self)
   # add instance variables
   self.myId = Mythread.id
   Mythread.id += 1
   Mythread.results.append(None)
   self.function = function
   self.args = args
   self.args['vlock'] = Mythread.vlock

   def run(self):
   # update results in an atomic manner
   # nie ma wyścigu więc nie trzeba blokować
   #Mythread.vlock.acquire()
   Mythread.results[self.myId] = self.function(**self.args)
   #Mythread.vlock.release()

   @staticmethod
   def flush():
   Mythread.results = []
   Mythread.id = 0
#end
--

I run thread from:
--
thread.Mythread.flush()
   e0 = thread.Mythread(fun_1,  names=lnames1,   name=param)
   e1 = thread.Mythread(fun_2,  names=l.names2,  name=param)
   e2 = thread.Mythread(fun_3,  names=lnames3,   name=param)

   for s in [e0, e1, e2]:
   # I add additional param environ to function fun_1, fun_2, fun_3
   s.args['environ'] = pylons.request.environ
   s.start()

   # wait for all threads to completed
   for s in [e0, e1, e2]:
   s.join()

   nresult = thread.Mythread.results[-3]
   hresult = thread.Mythread.results[-2]
   eresult = thread.Mythread.results[-1]

--

function as thread:

def fun_1(names, name, environ, vlock=None):
  some_file.config = environ['pylons.pylons'].config
  root = some_file.expensiveFunctionThatNeedConfig(names)
  

--

some_file content:

from pylons import config as conf, app_globals
...
#saveThreadConfig, for now I can replace empty conf to that from environ
# in theads area conf is almost empty so I rewrite it, but this probably 
generate segmentation fault after threads end

config = conf
g = app_globals
...

def expensiveFunctionThatNeedConfig(names):
   # some work with config and g (app_globals)
   ...
--

Best Regards,
Tomasz Narloch

--
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: Custom threads for some external staff

2010-10-13 Thread Tomasz Narloch

Tomasz Narloch pisze:

Hello,

I have a problem with the transfer of variables config and app_globals 
to my own thread.

I need config and app_globals has been passed by reference.
Now, I like the one below, but it is not good because it throws a 
segmentation fault at the end of threads.


I read something about register config and agg_globals to threads in 
pylons but I do not know how to do that.
#Maybe I should remove reference to config and app_globals after 
thread end?


I want the same config and app_globals in my thread and
when I change some params of app_globals (only one of three threads do 
that) it has to be changed in other pylons threads.


Maybe exists some other way to do that?

my thread class:
-- 


# -*- coding: utf-8 -*-
import threading

class Mythread(threading.Thread):
   # class variables, not instances only

   # Mythread.results[self.myId] = function()
   results = []
   vlock = threading.Lock()
   id = 0 # I want to give an ID number to each thread, starting at 0

   def __init__(self, function, **args):
   # invoke constructor of parent class
   threading.Thread.__init__(self)
   # add instance variables
   self.myId = Mythread.id
   Mythread.id += 1
   Mythread.results.append(None)
   self.function = function
   self.args = args
   self.args['vlock'] = Mythread.vlock

   def run(self):
   # update results in an atomic manner
   # nie ma wyścigu więc nie trzeba blokować
   #Mythread.vlock.acquire()

Uncommented

   Mythread.results[self.myId] = self.function(**self.args)
   #Mythread.vlock.release()

Uncommented


   @staticmethod
   def flush():
   Mythread.results = []
   Mythread.id = 0
#end
-- 



I run thread from:
-- 


thread.Mythread.flush()
   e0 = thread.Mythread(fun_1,  names=lnames1,   name=param)
   e1 = thread.Mythread(fun_2,  names=l.names2,  name=param)
   e2 = thread.Mythread(fun_3,  names=lnames3,   name=param)

   for s in [e0, e1, e2]:
   # I add additional param environ to function fun_1, fun_2, fun_3
   s.args['environ'] = pylons.request.environ
   s.start()

   # wait for all threads to completed
   for s in [e0, e1, e2]:
   s.join()

   nresult = thread.Mythread.results[-3]
   hresult = thread.Mythread.results[-2]
   eresult = thread.Mythread.results[-1]

-- 



function as thread:

def fun_1(names, name, environ, vlock=None):
  some_file.config = environ['pylons.pylons'].config

replaced by

pylons.config._push_object(environ['pylons.pylons'].config)
pylons.app_globals._push_object(environ['pylons.pylons'].config['pylons.app_globals'])
try:

  root = some_file.expensiveFunctionThatNeedConfig(names)
  

finally:
   
pylons.app_globals._pop_object(environ['pylons.pylons'].config['pylons.app_globals'])

   pylons.config._pop_object(environ['pylons.pylons'].config)



-- 



some_file content:

from pylons import config as conf, app_globals

replace by default
from pylons import config as config, app_globals

...
#saveThreadConfig, for now I can replace empty conf to that from environ
# in theads area conf is almost empty so I rewrite it, but this 
probably generate segmentation fault after threads end

config = conf
g = app_globals
...

removed above


def expensiveFunctionThatNeedConfig(names):
   # some work with config and g (app_globals)
   ...
-- 



Best Regards,
Tomasz Narloch


After this changes works.

Best Regards,
Tomasz Narloch

--
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.



Formencode class

2010-02-10 Thread Tomasz Narloch

Have you ever happened to you?

My example:

class GoodUserForm(FancyValidator):
   def validate_python(self, value, state):
   errors = {}
   [...]
   try:
   String(not_empty=True, min=2).to_python(value['company']) # 
raise KeyError

   except formencode.Invalid, e:
   errors.update({'company': unicode(e)})
   [...]


class UserFormUpdate(formencode.Schema):
   allow_extra_fields = True

   individual = StringBool(if_missing=False, if_empty=False)
   [...]
   company = String(max=128, if_missing=None, strip=True), # -- The 
error is a comma!!!, but I can create pyc and use it

   [...]
   chained_validators = [GoodUserForm()]

This file can be compile, but it is not works as expected.

Best Regards,
Tomasz Narloch



--
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: Formencode class

2010-02-10 Thread Tomasz Narloch

Ian Wilson pisze:

I'm not quite sure if what I'm about to discuss is what you're asking
so correct me if I'm wrong.  A trailing comma will sometimes create a
tuple depending on the context which doesn't have much to do with
formencode.  

Yes I agree.

Ha also yes that comma thing has happened to me.  The
company attribute is receiving a tuple instead of String.
  

Thanks,
difference between:
x = 1
and
x = 1,
in code is hard to find sometimes, but this is PYTHON syntax :(

Best Regards,
Tomasz Narloch

--
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.



Pylons 0.9.7 on production.ini and email notification

2009-07-02 Thread Tomasz Narloch

I have working pylons on mod_wsgi
In production.ini I have:

[DEFAULT]
debug = true
# Uncomment and replace with the address which should receive any error 
reports
email_to = my_em...@server
smtp_server = localhost
error_email_from = er...@server
...

this is working on mod_wsgi only when I have set full_stack = true, but 
this is not  a problem

I wondering can I set  variable email_to to more that one email?
Example:
email_to: first_ad...@server, second_ad...@server
Is it work?

How can I (in simple way) set my own template for error page [500, 404, 
...]?

Best Regards,
Tomek


--~--~-~--~~~---~--~~
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: problem with routes rule

2009-05-24 Thread Tomasz Narloch

c pisze:
 hello everyone!

 i'm new to pylons and routes and i'd encountered a problem trying to
 configure routes to my needs.
 i'd like to have admin panel section in my site (with subsections like
 overall settings, gallery settings etc.), and wanted an urls too look
 like that:

 www.example.com/panel/overall/save - that would trigger action save of
 controller panel_gallery
   
I use that configuration:

map.connect('/panel/overall/{action}/{id}',
controller='panel/overall', action='index', id=None, _minimize=True)
 www.example.com/panel/gallery/add - that would trigger action add of
 controller panel_gallery
   
you maybe add also:

map.connect('/panel/{action}', controller='panel_auth', action='index', 
_minimize=True)

for

www.example.com/panel

   
And create controller command:
$ paster controller panel/gallery

List of files:

controllers/panel_auth.py
controllers/panel/gallery.py


 after reading routes manual I wasn't able to come up with a solution
 i'd be grateful for any suggestions

 best regards
 c

 


   


--~--~-~--~~~---~--~~
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: No secure_form token after use htmlfill.render with defaults.

2009-05-22 Thread Tomasz Narloch

Jan Koprowski pisze:
 Hi Everyone !

   I downgrade FormEncode from 1.2.2 to 1.2.1 and all is right. In
 version 1.2.1 parameter force_defaults doesn't exists and work fine
 with secure_form. I also send ticket to bugtrack
 https://sourceforge.net/tracker/?func=detailaid=2795224group_id=91231atid=596416
   I hope this help someone.

 Greetings from Poland !
 --
 Jan Koprowski
 


   
I think the problem is in @authenticate_form.
This function/decorator remove request.POST['_authentication_token'].
Htmlfill doesn't have this value and set empty string.

Ex:
html = render('/my_template.mako') # - _authentication_token is set
return htmlfill.render(html, defaults=request.POST, errors=errors, 
force_defaults=False) # - without force_defaults=False 
_authentication_token will be cleared.

Best Regards,
Tomasz Narloch




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cookie and domain with www or without

2009-05-16 Thread Tomasz Narloch

I have a problem with cookies on pylons.

I go to ex. http://mydomain.com where I create my cookie.
When I go to http://www.mydomain.com  my cookie is not visible.

I know that is option for cookie on subdomains but this is not the same.

What should I change?

Best Regads,
Tomek

--~--~-~--~~~---~--~~
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: Mailer for Pylons

2009-04-30 Thread Tomasz Narloch

karikris...@gmail.com pisze:
 Hi All,

 I have email messages send around 10 places. We use mako templates.
 Currently we use smtplib and rendered output to send email.

   
I had similar problem.
I create email table in database and add every email to database (with 
subject, text, sender, recipients, time  to send, time expired, etc.).
Every 2 minutes crontab send a new emails.
 Do we have any mailer component integrate email and mako together?


   
I don't know.


--~--~-~--~~~---~--~~
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: Routes and Controllers

2009-03-30 Thread Tomasz Narloch

edgarsmolow pisze:
 One more thought...

 Would it be necessary to add an entry to Routes for each controller?
 Or, can one (or just a few) entries be added which contain dynamic
 parts?

 Thanks.
 Edgar


 On Mar 30, 11:43 am, edgarsmolow edgarsmo...@gmail.com wrote:
   
 In my project, there are a number of controllers (and corresponding
 templates) that can be grouped together since they share a common
 purpose.  To keep things organized, I've put the controllers in a
 subdirectory (of the controllers directory) called ai.  For example,
 here are the locations of three controllers:
   /myproject/controllers/ai/q01.py
   /myproject/controllers/ai/q23.py
   /myproject/controllers/ai/w02.py

 How should Routes be set up so that the following URL is mapped to the
 q01 controller above?

 http://www.somedomain.com/ai/q01

 Would the following be correct (assuming it's placed higher in the
 list)?
 map.connect('/ai/{controller}/{action}')


 
Maybe it is not the best routes but it's works:
map.connect('/error/{action}', controller='error')
map.connect('/error/{action}/{id}', controller='error')
...
map.connect('/admin/page/{action}/{id}',
controller='admin/page', action='index', id=None, _minimize=True)
map.connect('/admin/price/{action}/{id}',
controller='admin/price', action='index', id=None, _minimize=True)
map.connect('/admin/mail/{action}/{id}',
controller='admin/mail', action='index', id=None, _minimize=True)
map.connect('/admin/client/{action}/{id}',
controller='admin/client', action='index', id=None, _minimize=True)

map.connect('/admin/{action}', controller='administrator', 
action='index', _minimize=True)

...
map.connect('/', controller='home', action='index')
map.connect('Default', '/{controller}/{action}')

if I go to /admin - then controller=administrator, method=index
if I go to /admin/page - then controller=admin/page, method=index

Best Regards


--~--~-~--~~~---~--~~
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: paster controller: sub-folder, same controller name.

2009-03-23 Thread Tomasz Narloch

Joe Riopel pisze:
 Hi,

 I have a controller foo in my application's controller directory. I
 want to make a separate admin controller named foo, in the
 controllers/admin directory, as well. So I issued the command paster
 controller admin/foo and paster is telling me that An error
 occurred. Controller foo already exists.. I could name the controller
 fooadmin, but I am curious as to why I can't do this.
   
Have you tried:
$ paster controller admin/foo
 Is this because of routes and the URL mapping?

 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
-~--~~~~--~~--~--~---



beaker_cache and invalidate_on_startup=True

2009-02-19 Thread Tomasz Narloch

Hi,
I have some code:

@beaker_cache(key=['category_name_link', 'title_link'], type='file', 
expire=3600)
def content(self, category_name_link, title_link):

and all is OK, but:

@beaker_cache(key=['category_name_link', 'title_link'], type='file', 
invalidate_on_startup=True, expire=3600)
def content(self, category_name_link, title_link):

is not work that I want.
invalidate_on_startup == True then method is cached to next restart 
application and it's work for

paster serve --reload deployment.ini

but not for mod_wsgi on apache2:

If I add invalidate_on_startup=True to @beaker_cache then my content 
method is not cached or maybe not use it.
I don't know what I'm doing wrong. I want to usability to clear cached 
contents after sudo apachectl restart.
I have the same config ini for paster and mod_wsgi.

Best Regards,
Tomasz Narloch

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Redirect with additional headers for ajax

2009-01-19 Thread Tomasz Narloch

I use ajax for few pages in my app.
Sometimes I need to redirect page from example: index to index2
The problem is when I get index with request.is_xhr == True and have to 
redirect to index 2.

In next page request.is_xhr == False. 
jQuery do not add 'X-Requested-With': XMLHttpRequest' to redirected page.

Is some possibility to add headers with XMLHttpRequest to method of 
controller:
[...]
# add header
return redirect_to('page/index2')

and then would be works when I check request.is_xhr?

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



mod_wsgi and download attached content

2009-01-16 Thread Tomasz Narloch

Hi,

mod_wsgi: When I want to download a invoice in pdf I get: 404 Not Found
On paster server: I'm getting my invoice in pdf without any problem

I generate invoice in pdf on the fly.
I use reportlab and my function is something like that:

def getInvoice():
[...]
buffer = StringIO.StringIO()
doc = SimpleDocTemplate(
buffer,
showBoundary=0,
topMargin=0.75*inch,
rightMargin=0.5*inch,
leftMargin=0.5*inch,
bottomMargin=0.75*inch,
allowSplitting=1,
pagesize=A4,
pageCompression=1 # in my pdf not work with ttf font without 
images, plain text with tables, paragraphs
)
[...]
buffer.seek(0)
return buffer

# NEXT in controller method:

[...]
response.headers['Content-type'] = 'application/pdf'
response.headers['Content-disposition'] = 'attachment; filename=%s' 
% filename
   
buffer = invoice.getInvoice(...)
   
## !!! SOMEWHERE IS PROBLEM !!! ##
content = buffer.getvalue()
   
response.headers['Content-Length'] = str(len(content)) # without 
this line also  not work
   
buffer.close()
return content


I don't know where is problem. Maybe something is missing?

When I saving pdf to disk and next method get pdf then it's work:

fapp = fileapp.FileApp(path_to_pdf)
fapp.content_disposition(filename=filename_of_pdf)
return fapp(request.environ, self.start_response)
 
but I don't want to save pdf to disk.

Best Regards,
Tomek




--~--~-~--~~~---~--~~
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: mod_wsgi and download attached content

2009-01-16 Thread Tomasz Narloch

Tomasz Narloch pisze:
 Hi,

 mod_wsgi: When I want to download a invoice in pdf I get: 404 Not Found
 On paster server: I'm getting my invoice in pdf without any problem

 I generate invoice in pdf on the fly.
 I use reportlab and my function is something like that:

 def getInvoice():
 [...]
 buffer = StringIO.StringIO()
 doc = SimpleDocTemplate(
 buffer,
 showBoundary=0,
 topMargin=0.75*inch,
 rightMargin=0.5*inch,
 leftMargin=0.5*inch,
 bottomMargin=0.75*inch,
 allowSplitting=1,
 pagesize=A4,
 pageCompression=1 # in my pdf not work with ttf font without 
 images, plain text with tables, paragraphs
 )
 [...]
 buffer.seek(0)
 return buffer

 # NEXT in controller method:

 [...]
 response.headers['Content-type'] = 'application/pdf'
 response.headers['Content-disposition'] = 'attachment; filename=%s' 
 % filename

 buffer = invoice.getInvoice(...)

 ## !!! SOMEWHERE IS PROBLEM !!! ##
 content = buffer.getvalue()

 response.headers['Content-Length'] = str(len(content)) # without 
 this line also  not work

 buffer.close()
 return content


 I don't know where is problem. Maybe something is missing?

 When I saving pdf to disk and next method get pdf then it's work:

 fapp = fileapp.FileApp(path_to_pdf)
 fapp.content_disposition(filename=filename_of_pdf)
 return fapp(request.environ, self.start_response)
  
 but I don't want to save pdf to disk.

 Best Regards,
 Tomek
   
I missing add that I get error by Apache:
TypeError: expected string object for header value

Version of mod_wsgi 2.2




--~--~-~--~~~---~--~~
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: mod_wsgi and download attached content

2009-01-16 Thread Tomasz Narloch

Tomasz Narloch pisze:
 Tomasz Narloch pisze:
   
 Hi,

 mod_wsgi: When I want to download a invoice in pdf I get: 404 Not Found
 On paster server: I'm getting my invoice in pdf without any problem

 I generate invoice in pdf on the fly.
 I use reportlab and my function is something like that:

 def getInvoice():
 [...]
 buffer = StringIO.StringIO()
 doc = SimpleDocTemplate(
 buffer,
 showBoundary=0,
 topMargin=0.75*inch,
 rightMargin=0.5*inch,
 leftMargin=0.5*inch,
 bottomMargin=0.75*inch,
 allowSplitting=1,
 pagesize=A4,
 pageCompression=1 # in my pdf not work with ttf font without 
 images, plain text with tables, paragraphs
 )
 [...]
 buffer.seek(0)
 return buffer

 # NEXT in controller method:

 [...]
 response.headers['Content-type'] = 'application/pdf'
 response.headers['Content-disposition'] = 'attachment; filename=%s' 
 % filename
 
I solve the problem:)
Probably filename have a unicode chars and this was a problem.

Regards,
Tomek


--~--~-~--~~~---~--~~
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, SQLAlchemy and deleting

2009-01-07 Thread Tomasz Narloch

Piotr Kęplicz pisze:
 Joe Riopel, środa 07 stycznia 2009 17:45:
   
 Session.query(Person).filter_by(...).delete()
   
 Isn't that code still doing the select first, to get the object, and
 then deleting it?
 

 No. It's a Query object turned into a DELETE statement, just like first(), 
 all() or one() would turn it into a SELECT statement.
   
pylons 0.9.7, sqlalchemy 0.5
This is copy paste from console:

Pylons Interactive Shell
Python 2.5 (release25-maint, Jul 20 2008, 20:47:25)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]

  All objects from pyupo.lib.base are available
  Additional Objects:
  mapper -  Routes mapper object
  wsgiapp-  This project's WSGI App instance
  app-  paste.fixture wrapped around wsgiapp

  from pyupo.model.meta import Session
  from pyupo.model.emailbag import EmailBag as e
  s = Session.query(e).filter(e.order_id == 1).filter(e.active == 
True).filter(e.dispatched == False)
  s.delete()
07:10:35,545 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] BEGIN
07:10:35,546 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] SELECT em
ailbag.id AS emailbag_id
FROM emailbag
WHERE emailbag.order_id = %s AND emailbag.active = %s AND emailbag.dis
patched = %s
07:10:35,546 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] [1, 1, 0]
07:10:35,547 DEBUG [sqlalchemy.engine.base.Engine.0x...6acL] Col 
('emailbag_id',)
07:10:35,547 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] DELETE FROM 
emailbag WHERE emailbag.order_id = %s AND emailbag.active = %s AND 
emailbag.dispatched = %s
07:10:35,547 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] [1, 1, 0]
0L
  s.update({'active': False})
07:12:15,965 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] SELECT 
emailbag.id AS emailbag_id FROM emailbag
WHERE emailbag.order_id = %s AND emailbag.active = %s AND 
emailbag.dispatched = %s
07:12:15,965 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] [1, 1, 0]
07:12:15,965 DEBUG [sqlalchemy.engine.base.Engine.0x...6acL] Col 
('emailbag_id',)
07:12:15,966 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] UPDATE 
emailbag SET active=%s, updated_at=CURRENT_DATE WHERE emailbag.order_id 
= %s AND emailbag.active = %s AND emailbag.dispatched = %s
07:12:15,966 INFO  [sqlalchemy.engine.base.Engine.0x...6acL] [0, 1, 1, 0]
0L


This examples say something else.
What is wrong with this query?

Best Regards,
Tomek


--~--~-~--~~~---~--~~
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 with gzip compression?

2008-12-19 Thread Tomasz Narloch

Dalius Dobravolskas pisze:
 Hi,

   
 I am beginning and I have one question about running Pylons(paster)
 v0.9.6 with gzip compression(for pages) How to do it? :)
 
 Two ways:
 1) Search for gzipmiddleware here:
 http://pylonsbook.com/alpha1/wsgi

 Actually it would be nice if this middleware were available in Pylons
 by default. Maybe it is?
   
I know that above example from book works but compressing  the same  
static css and js each request is not that I need.
How can I add cache for this gziped file?

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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: sqlalchemy objects in beaker cache

2008-12-16 Thread Tomasz Narloch

Andrey Plotnikov pisze:
 Hi,

 Is it safe to cache objects getting from sqlalchemy session query in
 beaker cache?

   
I was done that but in that way I loose  connection with sqlalchemy 
(Session) so

from ... import User
from ... import t_user

mapper(User, t_user,
properties={
'roleList': relation(Role, backref='userList')})

us = User()

#us  - to backer_cache

now if you want us.roleList you get error
and if you change

us.username = 'other_name'
Session.commit()

then it not affected any change

Above is only my experience.

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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: authauth middleware details

2008-12-11 Thread Tomasz Narloch

Tomasz Narloch pisze:
 Dalius Dobravolskas pisze:
   
 def loginurl_by_context(environ):
 if environ['beaker.session'].startswith('/panel'):
   
 
 Error in my code:
 if environ['beaker.session']['referer'].startswith('/panel'):

   
 
 return '/panel/login'
 else:
 return '/shop/login'

 What you think about that?


   
 
 Better, my  solution  wasn't good.
 
   
 OK. Wait a little bit I will fix that.

   
 
 Maybe I have better solution, without session.
 Add to login form hidden fieled input type=hidden 
 name=if_error_back_to value=/panel/login /

 In process function  check this value and if exist then use it or use 
 loginurl otherwise.
 What you think about that?

 Tomek


   
This is little not secure maybe so create in config variable:

routes = dict(panel='/panel/login', admin='/admin/login')

and put:

input type=hidden 
name=if_error_back_to value=panel /

in form and check if request.POST['if_error_back_to'] in routes then 
redirect to routes[request.POST['if_error_back_to']]

this is more flexible and secure.

Tomek

--~--~-~--~~~---~--~~
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: authauth middleware details

2008-12-11 Thread Tomasz Narloch

Dalius Dobravolskas pisze:
 Maybe I have better solution, without session.
 Add to login form hidden fieled input type=hidden
 name=if_error_back_to value=/panel/login /
 
 That will not work on @authorize decorator. The problem is that we
 have more than one path how /process is reached. I'm adding loginurl
 function.

   
Okey, I don't know authorize as good as you.
But how can you check referer for prefix:
referer: /order/index2 = translate to /order/login
referer: /admin/   = translate to /admin/login
referer: /panel/= translate to /panel/login

2) will be option to set:
referer /order/index2  = translate to 
/order/other_method_name_for_login # not default name for method to login
referer /admin/= transate to /admin/login   # as usual


Tomek

--~--~-~--~~~---~--~~
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: authauth middleware details

2008-12-11 Thread Tomasz Narloch

Dalius Dobravolskas pisze:
 Hello, Tomasz,

 I have updated code now:
 http://hg.sandbox.lt/authform-middleware/rev/50e261dbd126

   
 Okey, I don't know authorize as good as you.
 
 Authentication ;-)

   
 But how can you check referer for prefix:
 referer: /order/index2 = translate to /order/login
 referer: /admin/   = translate to /admin/login
 referer: /panel/= translate to /panel/login
 

 It could be something like that:

 def loginurl_func(environ):
 if environ['beaker.session']['referer'].endswith('/order/index2'):
 return '/order/login'
 elif environ['beaker.session']['referer'].endswith('/admin'):
 return '/admin/login'
 else:
 return '/panel/login'

 I'm not sure how much safe is to use endswith. Maybe it is more
 reasonable to use some routes method to parse referer.

   
 2) will be option to set:
 referer /order/index2  = translate to
 /order/other_method_name_for_login # not default name for method to login
 referer /admin/= transate to /admin/login   # as usual
 
 It's up to you to control options. You have function (loginurlfunc)
 and you can do anything you want with that.

   
That is good for me.
I always set referer to relative link so I can

if environ['beaker.session']['referer'] == '/order/index2':

but it's not matter.
When you publish new version, today or tomorrow or ...?

Thanks for your time

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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: Problem with Authkit 0.4.2 and Pylons 0.9.7rc4 on Apache2 and mod_wsgi 2.3

2008-12-10 Thread Tomasz Narloch

I check your authauth middleware.

Maybe I will like it. 
That I need.
For users I need only authenticated but for admins I need authorized also.
User can buy some products from shop or go to own panel (customers area panel) 
but admins do not only (admin area).

Admins - table admin in database [authkit at now] - I have plan to change this 
to your authauth middleware.
Users - table user in database [actually I have written my own authenticated 
function, pure but working, without middleware]

My question:
1. I need download authform-middleware and authorize-middleware or only 
authorize-middleware?
2. At now I can't use easy_install so where is the best place for this libs? 
Maybe on pylons .../lib/authorize-middleware/ and .../lib/authform-middleware/ 
at the moment?

Best Regards,
Tomek




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



authauth middleware details

2008-12-10 Thread Tomasz Narloch

I start to learn authauth

1) I have one login form for client  to panel
and second if someone want to buy something then go step by step and 
next can login or create new account (different url, design)

There is a variable:
authform.loginurl= /panel/login

How sholud I change it if I want  different authform.loginurl for one page?
Code from authform.py:
[...]
def process(self, environ, start_response):
baseurl = self.baseurl or construct_url(environ, 
with_query_string=False, with_path_info=False)

params = dict(paste.request.parse_formvars(environ))

session = environ[self.session_middleware]
authenticated, data = self.is_authenticated(environ, 
params['username'], params['password'])
if authenticated:
session['REMOTE_USER'] = params['username']
if data:
session['x-wsgiorg.user_data'] = data
if 'referer' in session:
redirect_url = session.pop('referer')
else:
redirect_url = self.baseurl + self.loggedin_url
start_response('301 Redirect', [('Content-type', 
'text/html'), ('Location', redirect_url)])
return []
else:
session['x-wsgiorg.auth_error'] = data

+if 'loginurl' in session:
+   loginurl = session.pop('loginurl')
+else:
+   loginurl = self.loginurl
+
+start_response('301 Redirect', [('Content-type', 'text/html'), 
('Location', loginurl)])
-start_response('301 Redirect', [('Content-type', 'text/html'), 
('Location', self.loginurl)])
return []

[...]

2) Where can I put @authenticate_form?

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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: authauth middleware details

2008-12-10 Thread Tomasz Narloch

Dalius Dobravolskas pisze:
 def loginurl_by_context(environ):
 if environ['beaker.session'].startswith('/panel'):
   
 Error in my code:
 if environ['beaker.session']['referer'].startswith('/panel'):

   
 return '/panel/login'
 else:
 return '/shop/login'

 What you think about that?


   
 Better, my  solution  wasn't good.
 
 OK. Wait a little bit I will fix that.

   
Maybe I have better solution, without session.
Add to login form hidden fieled input type=hidden 
name=if_error_back_to value=/panel/login /

In process function  check this value and if exist then use it or use 
loginurl otherwise.
What you think about that?

Tomek







--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem with Authkit 0.4.2 and Pylons 0.9.7rc4 on Apache2 and mod_wsgi 2.3

2008-12-09 Thread Tomasz Narloch

My admin controller:

[...]
class AdministratorController(BaseController):

@authorize(h.auth.is_valid_user)
def index(self):
return render('/admin/index.mako')

def signout(self):
return redirect_to(controller='administrator', action='index')
#end

On development version:
paster serve --reload development.ini
all work good
but when I go to page by apache2 I get error:
...
[Wed Dec 10 05:38:44 2008] [error] [client [...]] mod_wsgi (pid=8169): 
Exception occurred processing WSGI script 
'/home/.../public_html/pyupo/apache2/pyupo.wsgi'.
[Wed Dec 10 05:38:44 2008] [error] [client 88.199.174.122] TypeError: 
sequence of string values expected, value of type literal found
...

The error only exist if I view authorized pages, but when I remove 
@authorize then work good,
on development version authorized work good.

.../apache/pyupo.wsgi:

import os, sys
sys.path.append('/home/.../public_html/pyupo')
os.environ['PYTHON_EGG_CACHE'] = 
'/home/.../public_html/pyupo/apache2/python-eggs'

from paste.deploy import loadapp

application = loadapp('config:/home/.../public_html/pyupo/deployment.ini')
#end


.../pyupo/config/middleware.py:

def make_app(global_conf, full_stack=True, **app_conf):
# Configure the Pylons environment
load_environment(global_conf, app_conf)

# The Pylons WSGI app
app = PylonsApp()

# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)

if asbool(full_stack):
# Handle Python exceptions
app = ErrorHandler(app, global_conf, **config['pylons.errorware'])

# Display error documents for 401, 403, 404 status codes (and
# 500 when debug is disabled)
if asbool(config['debug']):
app = StatusCodeRedirect(app)
else:
app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])

# dodane
app = authkit.authenticate.middleware(app, app_conf)

# Establish the Registry for this application
app = RegistryManager(app)

# Static files (If running in production, and Apache or another web
# server is handling this static content, remove the following 3 lines)
static_app = StaticURLParser(config['pylons.paths']['static_files'])
app = Cascade([static_app, app])

# dodane
if not asbool(full_stack):
app = authkit.authenticate.middleware(app, app_conf)

# dodane
#app = GzipMiddleware(app, compresslevel=5)
return app


.../deployment.ini:

[...]
[app:main]
lang = pl
use = egg:pyupo
full_stack = false
cache_dir = %(here)s/data
[...]

authkit.setup.enable = true
authkit.setup.method = form, cookie

authkit.form.authenticate.user.data =
admin:xxx  admin editor

authkit.cookie.secret = [secret...]
authkit.cookie.signoutpath = /admin/signout
authkit.cookie.params.expires = 6000
authkit.cookie.includeip = true
authkit.cookie.enforce = true
authkit.form.template.obj = pyupo.lib.auth:render_signin
[...]

.../development.ini is almost the same, difference is only:
full_stack = true,
#set debug = false

Where is the problem?
Could someone help me?

Best Regards,
Tomek

--~--~-~--~~~---~--~~
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: Problem with Authkit 0.4.2 and Pylons 0.9.7rc4 on Apache2 and mod_wsgi 2.3

2008-12-09 Thread Tomasz Narloch

Dalius Dobravolskas pisze:
 Hello, Tomasz,

 I see several problems.

   
 On development version:
 paster serve --reload development.ini
 all work good
 but when I go to page by apache2 I get error:
 ...
 [Wed Dec 10 05:38:44 2008] [error] [client [...]] mod_wsgi (pid=8169):
 Exception occurred processing WSGI script
 '/home/.../public_html/pyupo/apache2/pyupo.wsgi'.
 [Wed Dec 10 05:38:44 2008] [error] [client 88.199.174.122] TypeError:
 sequence of string values expected, value of type literal found
 ...

 The error only exist if I view authorized pages, but when I remove
 @authorize then work good,
 on development version authorized work good.

 .../apache/pyupo.wsgi:

 import os, sys
 sys.path.append('/home/.../public_html/pyupo')
 os.environ['PYTHON_EGG_CACHE'] =
 '/home/.../public_html/pyupo/apache2/python-eggs'

 from paste.deploy import loadapp

 application = loadapp('config:/home/.../public_html/pyupo/deployment.ini')
 #end


 .../pyupo/config/middleware.py:

 def make_app(global_conf, full_stack=True, **app_conf):
# Configure the Pylons environment
load_environment(global_conf, app_conf)

# The Pylons WSGI app
app = PylonsApp()

# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)

if asbool(full_stack):
# Handle Python exceptions
app = ErrorHandler(app, global_conf, **config['pylons.errorware'])

# Display error documents for 401, 403, 404 status codes (and
# 500 when debug is disabled)
if asbool(config['debug']):
app = StatusCodeRedirect(app)
else:
app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])

# dodane
app = authkit.authenticate.middleware(app, app_conf)
 
 
 1) Wrong place for middleware. Add it under # CUSTOM MIDDLEWARE HERE
 line. Much better place. At least immediately after if
 asbool(full_stack): line.
   
It's done. I place it after  # CUSTOM MIDDLEWARE HERE
 2) Next problem is that you set full_stack to false in deployment.ini.
 Why? Actually it is the biggest problem.

   
Okey, it's done
 3) You shoud disable debug in deployment.ini. There is no reason to
 run application in debug mode under WSGI.

   
It's misunderstanding, I have had set debug = false on deployment.ini
 HTH.

   
Result:
Instead Apache 404 error now I get pylons 404 error on page.
The same error exist in logs.

Error come from mod_wsgi.c:

while ((item = PyIter_Next(iterator))) {
if (!PyString_Check(item)) {
PyErr_Format(PyExc_TypeError, sequence of string 
 values expected, value of type 
%.200s 
 found, item-ob_type-tp_name);
Py_DECREF(item);
break;
}

but I don't understand way.
 As well, you might find my authauth middlewares more usable for you
 http://trac.sandbox.lt/auth/wiki/AuthFormMiddleware,
 http://trac.sandbox.lt/auth/wiki/AuthorizeMiddleware. 
Maybe I check it.
 That's different
 from AuthKit a little bit but at least I will be able both answer and
 fix your problems if you will have them.

   
Thanks,

Best Regards
Tomek

--~--~-~--~~~---~--~~
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: problem with AuthKit conf Pylons 0.9.7

2008-11-23 Thread Tomasz Narloch

Maciej Dziergwa pisze:
 Hi,

 When I put

 authkit.cookie.params = expires: 10
 comment: test comment


   
Try  something like:

authkit.cookie.secret = secret_string
authkit.cookie.signoutpath = /signout
authkit.cookie.params.expires = 60
authkit.cookie.includeip = true
authkit.cookie.enforce = true
authkit.form.template.obj = pyupo.lib.auth:render_signin
...

Best Regards
Tomek

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



sqlAlchemy and mysql syntax

2008-07-15 Thread Tomasz Narloch

I have problem with creating object relation query

I want to receive below query from sqlAlchemy:

SELECT * FROM price WHERE price_category_id BETWEEN 1 AND 5 AND 
(beginner=1 OR (beginner=0 AND price_category_id NOT IN (SELECT 
price_category_id FROM price WHERE price_category_id BETWEEN 1 AND 5 AND 
beginner=1 ORDER BY id)))

desc: all rows with beginner == 1 and rows with beginner == 0 if rows 
with that price_category_id doesn't have beginner == 1

I start with:

Session.query(Price.id, Price.price_category_id).\
filter(and_(Price.price_category_id = 5, 
Price.price_category_id =1)).\
filter( or_(Price.beginner == 1,
and_(Price.beginner == 0, Price.price_category_id 
...!!!)
)
).all()

Please some advice.

--~--~-~--~~~---~--~~
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: Ide

2008-06-22 Thread Tomasz Narloch

Raoul Snyman pisze:
 On Thu, Jun 19, 2008 at 10:26 AM, Antonio Beamud Montero
 [EMAIL PROTECTED] wrote:
   
 What Ide I can use with pylons
   

 I use Quanta+ (in the kdewebdev package in Kubuntu) with it's project
 system. Works well.

   
I use quanta (Kubuntu) too.
I have highlight for mako tempates, project could be uploaded to server 
from local files very fast.
Krusader for comparing files.

I before try eric4 (ide in python) but it's not support html files.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---