Re: Mailer for Pylons
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: jsonify Decimals and datetime.date
HI: This might give you a start: import simplejson class FancyEncoder(simplejson.JSONEncoder): Handle datetime objects. def default(self, obj): if isinstance(obj, datetime.datetime): return obj.isoformat() # Add more type-specific handlers here, for example for Decimals return simplejson.JSONEncoder.default(self, obj) json = simplejson.dumps(data_to_encode, cls=FancyEncoder) As you can see it replaces the datetimes with their ISO format representations as strings. Hope this helps, Domhnall. 2009/4/30 Uwe Feldtmann u...@microshare.com.au Hi all. I've been struggling with a controller that gets a result set from a database and should simply return that result set as json data and I keep getting this traceback TypeError: Decimal(0.00) is not JSON serializable the data returned from the db is: (1492, 'BAKER', 'MR. AND MRS BAKER', Decimal(843.50), Decimal(5000.00), Decimal(0.00), datetime.date(1998, 8, 24), datetime.date(1998, 8, 31)) Is this an issue with @jsonify or am I missing something? I am using simplejson-2.0.8 and py2.5 Thanks in advance. -- Quidquid latine dictum sit, altum sonatur. (Whatever is said in Latin sounds profound) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
jsonify Decimals and datetime.date
Hi all. I've been struggling with a controller that gets a result set from a database and should simply return that result set as json data and I keep getting this traceback ||TypeError: Decimal(0.00) is not JSON serializable the data returned from the db is: (1492, 'BAKER', 'MR. AND MRS BAKER', Decimal(843.50), Decimal(5000.00), Decimal(0.00), datetime.date(1998, 8, 24), datetime.date(1998, 8, 31)) Is this an issue with @jsonify or am I missing something? I am using simplejson-2.0.8 and py2.5 Thanks in advance. --~--~-~--~~~---~--~~ 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 dbm cache
Hi, I'm using beaker and found out that restarting pylons clears the cache completely. It seems that the cache is not stored in the filesystem at all Here is my config: beaker.type = dbm beaker.session.key = doupy cache_dir = /var/dou Interesting that session files are stored in the filesystem. What's wrong with my config? How can have beaker store the cache in the filesystem? -- Max.Ischenko // twitter.com/maxua --~--~-~--~~~---~--~~ 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: beaker dbm cache
Interesting that session files are stored in the filesystem. What's wrong with my config? How can have beaker store the cache in the filesystem? I do have these lines in the middleware.py: app = SessionMiddleware(app, config) app = CacheMiddleware(app, config) --~--~-~--~~~---~--~~ 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: jsonify Decimals and datetime.date
Thanks Domhnall. Not sure if it will help as I'm using the jsonify decorator on a method in the controller and it is what is failing when attempting to wrap the result set. I managed to get the dates to work out by simply checking for data type and then assigning in the controller. Decimals on the other hand are not working for me. There doesn't appear to be a way to extract the value of a Decimal into another variable without copying the entire object. Any suggestions or pointers greatly appreciated. Domhnall Walsh wrote: HI: This might give you a start: import simplejson class FancyEncoder(simplejson.JSONEncoder): Handle datetime objects. def default(self, obj): if isinstance(obj, datetime.datetime): return obj.isoformat() # Add more type-specific handlers here, for example for Decimals return simplejson.JSONEncoder.default(self, obj) json = simplejson.dumps(data_to_encode, cls=FancyEncoder) As you can see it replaces the datetimes with their ISO format representations as strings. Hope this helps, Domhnall. 2009/4/30 Uwe Feldtmann u...@microshare.com.au mailto:u...@microshare.com.au Hi all. I've been struggling with a controller that gets a result set from a database and should simply return that result set as json data and I keep getting this traceback ||TypeError: Decimal(0.00) is not JSON serializable the data returned from the db is: (1492, 'BAKER', 'MR. AND MRS BAKER', Decimal(843.50), Decimal(5000.00), Decimal(0.00), datetime.date(1998, 8, 24), datetime.date(1998, 8, 31)) Is this an issue with @jsonify or am I missing something? I am using simplejson-2.0.8 and py2.5 Thanks in advance. -- Quidquid latine dictum sit, altum sonatur. (Whatever is said in Latin sounds profound) --~--~-~--~~~---~--~~ 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: jsonify Decimals and datetime.date
Well, maybe you should consider processing the tuple you plan to return somehow to change the datetimes and Decimals to something more palatable to @jsonify before returning it (via the decorator). If your controller action is only returning JSON, then this shouldn't be a problem? Domhnall. 2009/4/30 Uwe Feldtmann u...@microshare.com.au Thanks Domhnall. Not sure if it will help as I'm using the jsonify decorator on a method in the controller and it is what is failing when attempting to wrap the result set. I managed to get the dates to work out by simply checking for data type and then assigning in the controller. Decimals on the other hand are not working for me. There doesn't appear to be a way to extract the value of a Decimal into another variable without copying the entire object. Any suggestions or pointers greatly appreciated. Domhnall Walsh wrote: HI: This might give you a start: import simplejson class FancyEncoder(simplejson.JSONEncoder): Handle datetime objects. def default(self, obj): if isinstance(obj, datetime.datetime): return obj.isoformat() # Add more type-specific handlers here, for example for Decimals return simplejson.JSONEncoder.default(self, obj) json = simplejson.dumps(data_to_encode, cls=FancyEncoder) As you can see it replaces the datetimes with their ISO format representations as strings. Hope this helps, Domhnall. 2009/4/30 Uwe Feldtmann u...@microshare.com.au Hi all. I've been struggling with a controller that gets a result set from a database and should simply return that result set as json data and I keep getting this traceback TypeError: Decimal(0.00) is not JSON serializable the data returned from the db is: (1492, 'BAKER', 'MR. AND MRS BAKER', Decimal(843.50), Decimal(5000.00), Decimal(0.00), datetime.date(1998, 8, 24), datetime.date(1998, 8, 31)) Is this an issue with @jsonify or am I missing something? I am using simplejson-2.0.8 and py2.5 Thanks in advance. -- Quidquid latine dictum sit, altum sonatur. (Whatever is said in Latin sounds profound) -- Quidquid latine dictum sit, altum sonatur. (Whatever is said in Latin sounds profound) --~--~-~--~~~---~--~~ 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: beaker dbm cache
I do have these lines in the middleware.py: app = SessionMiddleware(app, config) app = CacheMiddleware(app, config) Nevermind my question. I probably didn't use correct prefix in my .ini file, passing type='dbm' to the constructor did the trick. --~--~-~--~~~---~--~~ 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: jsonify Decimals and datetime.date
On Apr 30, 2009, at 5:13 AM, Uwe Feldtmann wrote: Thanks Domhnall. Not sure if it will help as I'm using the jsonify decorator on a method in the controller and it is what is failing when attempting to wrap the result set. Unfortunately our @jsonify just sucks in that you can't specify args to dumps. Otherwise this would be even slightly easier than Domhnall's example: # Don't even need a subclass def myenc(d): if if isinstance(d, decimal.Decimal): return float(str(d) # etc raise TypeError() simplejson.dumps(data, default=myenc) We need to fix jsonify -- what's a little problematic is it's built to take no arguments, which is significantly different from a decorator that's built to take arguments. We may be able to make the decorator work both ways for 0.10 but it'd tricky/annoying. Pylons 1.0 could definitely break it, however: @jsonify - @jsonify() -- Philip Jenvey --~--~-~--~~~---~--~~ 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: beaker dbm cache
On Apr 30, 2009, at 4:31 AM, Max Ischenko wrote: I'm using beaker and found out that restarting pylons clears the cache completely. It seems that the cache is not stored in the filesystem at all Here is my config: beaker.type = dbm beaker.session.key = doupy cache_dir = /var/dou This should be beaker.session.type = db, or beaker.cache.type = db. Otherwise it won't be seen by one middleware or the other, thus it defaults to memory based. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature