Monday, 2007-04-09

*** dds has quit IRC00:01
*** dds_ is now known as dds00:17
*** gakman has quit IRC00:50
*** rope has joined #pylons00:50
*** gakman has joined #pylons00:52
*** dds_ has joined #pylons01:09
*** dds has quit IRC01:22
*** dds_ has quit IRC01:31
btbyteshow do i turn on gzip for output of particular actions?01:51
*** pjenvey_ has quit IRC02:01
*** phrank13 has joined #pylons02:16
phrank13Good day for all. Wich is the speedest way to run Pylons application ? with apache's mod_python ?02:17
phrank13I need maximal performance for my application, which way of deployment you suggest ?02:19
xorAxAxfastcgi is usually faster than mod_py02:19
phrank13but pictures at http://bluszcz.net/wiki/Benchmarks_cgi_fastcgi_modpython_psp say that mod_python faster ?02:21
xorAxAxmy benchmarks said that fcgi is much faster02:22
phrank13thank you02:22
xorAxAxbut i was using moin02:22
xorAxAxand not flup02:23
phrank13what is flup and moin ?02:25
phrank13what do they do ?02:25
xorAxAxflup is used in that benchmark as a fcgi adapter02:25
xorAxAxand moin is a wiki engine which has a different native fcgi adapter02:26
xorAxAxthat can be configured e.g. not to use threads02:26
phrank13What about comparison of performance between "paster --server" and apache's fcgi ?02:27
xorAxAxi was comparing moin's builtin server which is based on the same code and fcgi and they didnt differ much in speed02:28
xorAxAxbut note that a wiki is a more real world benchmark than a hello world page02:28
phrank13now i run my app through paster --server, and it seems to me that it works too slow02:29
*** efm has quit IRC03:13
*** gjh has joined #pylons03:13
*** gldnspud has quit IRC03:24
*** Justin has quit IRC03:26
elefthphrank13, you may also want to check out mod_wsgi although I really don't know how stable or fast it is: http://code.google.com/p/modwsgi/03:31
phrank13elefth, How do you run your's applications ?03:32
*** gldnspud has joined #pylons03:32
elefthI use the Paste server at the moment.03:33
phrank13with ordinary paster --serve option ?03:35
elefthphrank13, yes, I have not deployed anything publicly yet.03:36
elefthphrank13, at work we deploy using mod_python but I don't know many details, the sysadmin does the production deployments.03:37
phrank13elefth, hm... I noticed that sometimes it works slow (paster --serve), but when you restart it - it works fine. Do you expirience such trouble ?03:38
elefthphrank13, no I have not noticed such a thing. Maybe you would like to ask in #pythonpaste03:39
phrank13elefth, and what about comparison between performance on paster  and mod_python ?03:40
phrank13elefth, do you notice any difference ?03:40
elefthI haven't really paid any attention to performance so far, I am sorry.03:41
phrank13elefth, thanks, one more question. Do you use apache's mod_python ?03:42
elefthI personally don't. We do at work as I mentioned earlier.03:42
phrank13ok03:43
*** rope has left #pylons03:50
*** shovelhead has joined #pylons04:07
*** marcin_ant has joined #pylons04:37
*** negus has joined #pylons05:00
negusare there any security tests of Pylons?05:02
*** int has quit IRC05:03
*** int has joined #pylons05:05
*** rdesh has joined #pylons05:15
*** sleek has joined #pylons05:30
*** sleek has left #pylons05:30
*** rdesh has quit IRC05:35
*** rdesh has joined #pylons05:51
*** rdesh has quit IRC06:09
*** timphnode has joined #pylons06:14
vednis_is there a Pylons equivalent to the Rails scripts/ directory?06:24
vednis_or should I look at hooking commands into paste.deploy?06:24
*** AlexCONRAD_ has quit IRC06:27
*** Kush- has joined #pylons07:00
*** fullpony has joined #pylons07:01
inti wonder if someone uses elixir + psycopg2 ?07:20
* int have "Segmentation fault" on create_all07:20
intbut it works with sqlite db..07:21
vednis_int, some people use elixir.  I use psycopg2 (without elixir)07:21
vednis_you could try re-installing psycopg2, in case the binaries are out of sync with libpg07:23
Kush-anyone here used lighttpd 1.5 with pylons/scgi?07:24
Chairosvednis: yeah, pylons uses paste.deploy07:26
Chairosphrank13: I suggest mod_proxy to one or more paster --serve instances07:28
Chairosphrank13: see http://pylonshq.com/project/pylonshq/wiki/DaemonTools and http://pylonshq.com/project/pylonshq/wiki/ApacheReverseProxy07:28
Chairosnegus: security tests?07:28
*** efm has joined #pylons07:30
*** pobrien has joined #pylons07:31
vednis_I wonder if you could write an 'unpack' option for paste.deploy.07:31
vednis_it would let you pull, say, your static files, and some helper scripts, into the project root directory07:31
*** creiht has joined #pylons07:32
vednis_then, when setting up on a new system, I don't have to go 'paster setup-app etc...'07:32
ChairosI don't think that would work very well with deploying from eggs.07:32
vednis_I can just do 'paster unpack myapp', and point my Apache at newdir/wwwroot/cgi-bin07:33
ChairosI'd suggest talking with windle/benbangert and ianbicking about that.07:33
ChairosBut, I don't think it will work well.07:33
vednis_Chairos, I don't think you can deploy entirely from eggs07:33
Chairosoh?07:34
Chairoswhy not?07:34
vednis_if you are using CGI, for instance, or you have custom data directories (as I do)07:34
ChairosI've got a pylons app right now deployed from the egg.07:34
Chairoscustom data directories aren't that hard.07:35
vednis_but they must be on the file-system; so, no egg-only install07:35
Chairossure there could be. have a 'custom data dir' option in your .ini file, and when you call websetup.py it can set up any files needed in that folder07:35
vednis_Chairos, true, and that's what I do.  But that isn't a pure-egg install07:36
vednis_you need to find ways to migrate other schemas at the edge of the system07:36
ChairosI guess I misunderstand what you mean by pure-egg, then.07:37
vednis_db migrations are one example07:37
vednis_filesystem structures are another07:37
vednis_and server deployment supporting components, cgi-scripts, for example, are a third07:37
vednis_I guess that's why capistrano grabs a check-out and push from svn07:38
vednis_using a tag07:39
*** __pv has joined #pylons07:44
*** efm has quit IRC07:48
*** efm has joined #pylons07:49
*** zzzeek_ has joined #pylons08:03
intcan someone look on my websetup.py? i still has segfault with it, but plain psycopg2 works. so i guess something wrong with setup http://pastebin.ca/43122808:05
vednis_oh, cool:  http://swapoff.org/wiki/blog/2007-03-20-activating-a-workingenv-from-python08:11
*** bradmw has joined #pylons08:14
steghmm, does anybody do redirect-after-post with toscawidgets forms ?08:19
stegI'm posting from a form to a different controller/action and I'd like to redirect on errors back to the posting page so it can redisplay with errors/user input08:19
stegI don't think it'll be hard to roll my own, just wondering if anybody knows if it already exists08:19
Chairoswell, it exists for formencode-validated forms08:20
stegoh, cool.. is that part of formencode ?08:20
__pvI think TW does have its own validate function that does this08:20
stegI don't think TW's validate function handles this08:20
Chairossteg: it's part of pylons: http://pylonshq.com/docs/0.9.4.1/module-pylons.decorators.html#validate08:20
Chairossee also "Validation the Quick Way" in http://pylonshq.com/docs/0.9.4.1/form_handling.html08:21
__pvChairos: but TW has a different validate function08:21
__pvfrom toscawidgets.mods.pylonshf import validate08:21
stegok, thanks08:21
__pvI'm using it like this: @validate(form, error_handler='index')08:22
steg__pv: yes, but that doesn't redirect does it?08:22
stegit just hands the request over to the index action to deal with08:22
__pvsteg: yes, reading the source, it seems that it doesn't redirect08:23
__pvbut I guess it's easy to roll your own08:23
stegyeah08:24
stegI didn't think the formencode one redirected either08:24
stegin fact, I don't think it does, I'll have to check08:24
Chairosthe formencode one does redisplay the form with user input and errors.08:25
__pvditto for the TW one, to my understanding08:25
stegI'd like to redirect, so I'll roll my own.08:26
stegit should be quite simple08:27
stegperhaps I'm looking at this the wrong way, though08:28
stegI have a shopping cart, handled by CartController, it has a .add() action that is designed to take a POST of product_id, number08:29
stegProducts can be added from several different pages, and I'd like a POST form on all these different pages that targets CartController.add()08:30
steghence if .add() doesn't validate, I want to redirect to whichever page submitted the form and display the errors there08:30
Chairosah.08:30
Chairosone way to do that would be to have all those forms POST to their own urls, and have the http://pylonshq.com/docs/0.9.4.1/module-pylons.decorators.rest.html#dispatch_on decorator forward the POSTs to .add()08:31
Chairosbut there is probably a cleaner way I'm not seeing at the moment.08:31
stegthat's what I'm worried about, I have a habit of missing the obvious sometimes :)08:32
stegChairos: What I was going to do is save the Invalid object in the session and redirect08:33
stegwhich should automatic-able for the most part08:35
stegbbiab08:35
*** zzzeek_ has quit IRC08:39
*** gldnspud has quit IRC08:39
*** zzzeek_ has joined #pylons08:40
wiggycan someone help me with authkit?08:47
wiggyit keeps going to the error-form after I login with the right credentials08:48
wiggyI'm guessing that is because it POSTs to the error document08:48
*** gldnspud has joined #pylons08:49
*** matt_good has joined #pylons08:52
*** marcin_ant has quit IRC08:54
*** ctc_patrick has joined #pylons08:55
*** btbytes_ has joined #pylons08:55
vednis_sometimes developing with sqlite really sucks08:59
vednis_at home, the datetime columns work perfectly with SA08:59
wiggySA?09:00
vednis_SQLAlchemy09:00
vednis_at work, sqlite gives me strings instead of datetimes.  Same code, different behaviour!!09:00
wiggydate handling in SQL is unfortunately not very well defined09:00
wiggyheh, that's nasty09:01
wiggyfor serious systems I tend to use unix times instead of datetime types, seems to be the only robust way to handle times in sql09:01
*** shovelhead has left #pylons09:01
wiggyat least when you need to do things like work with time deltas09:01
Chairosvednis: do you have different versions of sqlite installed?09:02
vednis_Chairos, I don't believe so, but I have no way to check from this end :(09:02
ChairosI've had that behavior, and it turned out that one of my sqlite installs was at least two minor revisions behind the other.09:02
xorAxAxwiggy: so you can sell a lot of consluting hours in 2038? :)09:02
vednis_hehe09:03
wiggy64bit integers will safe your ass someday :)09:03
wiggy2037 is the year things go boom iirc09:03
* wiggy curses authkit yet again09:03
xorAxAxhttp://en.wikipedia.org/wiki/Year_2038_problem09:04
Chairosjust use 64 bits09:04
xorAxAxChairos: yes, the db column needs to be 64 bits09:04
Chairos"In the positive direction, whether the approximately 293 billion representable years is truly sufficient depends on the ultimate fate of the universe, but it is certainly adequate for most practical purposes."09:04
vednis_$ sqlite3 -version09:05
vednis_3.3.309:05
vednis_darnit >:(09:05
xorAxAxcodename "half-devilish"09:05
*** gldnspud has quit IRC09:06
Chairosvednis: OS X Tiger ships with 3.1.3, so if that's one of your machines...09:06
vednis_Chairos, nope, Fedora 3 here, Fedora 5 at home09:06
*** gldnspud has joined #pylons09:06
vednis_I've been on linux for a long time :)09:06
ChairosFC3 ships with 3.1.209:07
vednis_yeah, I had to update it09:07
ChairosI have 3.3.13 installed, now.09:08
vednis_gah, stupid me09:08
*** windle has joined #pylons09:08
* wiggy wonders why the httpexception middleware is called when authkit is earlier in the middleware stack09:09
vednis_it wasn't sqlite, it was a variable name being passed in as a string before a check from a refactoring I did 2 seconds ago09:09
Chairosah09:09
Chairosheh09:09
*** btbytes has quit IRC09:10
vednis_odd, I tried activate_workingenv, but for some reason python won't pick up the changes09:16
*** windle has quit IRC09:18
wiggypfft, finally got authkit working09:22
wiggyof course it was my own mistake09:22
*** sloat has joined #pylons09:28
*** nathan^ has joined #pylons09:30
TownCrierpylons: PylonsContractors edited <http://pylonshq.com/project/pylonshq/wiki/PylonsContractors?version=9> || PylonsContractors edited <http://pylonshq.com/project/pylonshq/wiki/PylonsContractors?version=8> || PylonsContractors edited <http://pylonshq.com/project/pylonshq/wiki/PylonsContractors?version=7>09:41
*** benbangert has joined #pylons09:51
*** pjenvey_ has joined #pylons10:15
*** Kush- has quit IRC10:16
*** marcin_ant has joined #pylons10:40
*** efm has quit IRC10:59
*** Kush- has joined #pylons11:09
*** btbytes__ has joined #pylons11:21
*** btbytes__ is now known as btbytes11:21
*** btbytes_ has quit IRC11:30
*** marcin_ant has quit IRC11:53
*** Kush- has quit IRC12:03
*** efm has joined #pylons12:03
*** ronchilla has joined #pylons12:29
*** hinoglu has joined #pylons12:46
*** scane has quit IRC12:50
*** etrepum has quit IRC12:54
*** GSF has quit IRC13:05
*** hinoglu has quit IRC13:11
*** etrepum has joined #pylons13:46
Chairosbenbangert, zzzeek_: I have a question about the cache object.13:53
zzzeek_ugh13:53
*** uche has quit IRC13:53
ChairosSpecifically, I want to completely clear the entire cache object. Is there a simple way to do that, or must I manually delete the files?13:53
zzzeek_theres no clear() on it ?13:53
ChairosI can't find any documentation of its methods.13:53
zzzeek_yes i know13:53
Chairosexcept what's here: http://www.myghty.org/docs/cache.myt#caching_interface13:54
zzzeek_:)13:54
zzzeek_ok so you are using the myghty cache interface ?13:54
zzzeek_it has a clear() method on it13:54
*** uche has joined #pylons13:54
ChairosI'll be using pylons.cache, which I'm told works exactly the same way as the myghty cache.13:54
Chairosokay, cool.13:54
Chairosthanks13:58
*** btbytes__ has joined #pylons14:01
nathan^zzzeek_14:05
zzzeek_ya14:05
nathan^We're using myghty and mod_apache, and is there an easy way to get my new data to be "seen" without constantly restarting the server?14:06
nathan^Does that even make sense to you?14:06
zzzeek_what sort of data14:06
zzzeek_templates should get automatically reloaded14:06
nathan^Yeah14:07
zzzeek_no server restart needed as long as you have the default flags set14:07
nathan^It seems like it sometimes doesnt automatically do it, or maybe it's the code behind14:07
nathan^Like the .py objects that we use14:07
zzzeek_those arent templates, those are your python modules14:07
zzzeek_module reloading is not very easy in python since other unchanged modules may be referencing the module that gets reloaded14:08
zzzeek_then they point to the wrong state14:08
nathan^Yeah14:08
nathan^Restarting the server seems to do the trick14:08
ronchillaHi guys. Which session handler does pylons use by default? (paste or beaker)14:09
creihtHmmm.... If any of you are following the ExtJS stuff, this looks interestin: http://extjs.com/forum/showthread.php?t=430114:09
xorAxAxnathan^: what is "mod_apache"?14:09
zzzeek_i dont think that problem has really been solved, recently i saw a post by guido where he was like, "here, ill write seomthing that does it" and he had some little reloader...but its genrally its the kind of thing thats talked about a lot, debated, etc.14:09
xorAxAxwith fcgi its easy14:09
xorAxAxjust kill your fcgi process14:09
zzzeek_im sure he means mod_python14:09
xorAxAxwell, mod_py was the wrong choice then14:09
*** btbytes has quit IRC14:10
zzzeek_i  usually develop with a standalone server14:10
zzzeek_easy to restart14:10
ronchillacreihjt: you are right it does look interesting14:10
nathan^Yeah my mistake, I mis-typed.14:10
*** primco- has quit IRC14:10
nathan^I meant mod_python14:10
*** primco has joined #pylons14:10
nathan^It's easy enough to restart apache, I was just curious if there was another way14:10
zzzeek_if you specifically are putting data inside of python modules, you can build a reloader14:10
zzzeek_mygthy does have a module importer that it uses for templates which has some wacky "reload" logic built in14:11
zzzeek_but thats not used when you import a normal module14:11
zzzeek_but if you look at python's imp module you can manually load modules from files, check timestamps, etc.14:11
etrepumit's easy, but not fast, to restart apache14:11
zzzeek_or use reload(module)14:11
etrepumor paste for that matter14:11
etrepumyou lose requests and stuff, it's not entirely pleasant14:11
nathan^Right, we have a bunch of sql abstraction stuff that we use in modoles14:11
nathan^Modules too!14:11
zzzeek_nathan: theres ways to do waht you want though theres complications14:12
nathan^Well, since it's my dev server it's not a big deal to restart14:12
nathan^It seems like more trouble than it's worth to programatically reload14:12
zzzeek_id look into accessing the module in some way that checks the timestamp on the file and reloads, if its really a "data" module14:12
zzzeek_i.e. dont just say "import mymodule"14:13
nathan^Yeah that's what it is14:13
nathan^k14:13
nathan^That makes sense14:13
Chairoshm.14:15
Chairoscache.clear() doesn't work in Pylons.14:15
zzzeek_i really wish someone would write a new container API14:19
zzzeek_theyre not very hard to write14:19
Chairosbecause cache is actually a CacheManager.14:19
ChairosCache has the .clear()14:19
* wiggy wonders why formencode is caching things14:20
wiggyvalidate is returning stuff that the user isn't submitting14:20
wiggyoh gah, formresult isn't even running since it isn't a POST but form_result on the controller is not reset14:22
Chairoszzzeek_: well, in my copious spare time... :D14:22
pjenvey_zzzeek_ - it looked like you were planning to cleanup myghtyutils and then i saw you make some changes in svn trunk14:23
pjenvey_didn't get very far?14:24
pjenvey_benbangert - and weren't you going to add a database backend to myghtyutils for sessions?14:24
zzzeek_id like to finish that yes14:24
zzzeek_but also, im sure someone could do a much better job overall14:25
zzzeek_dont have much time to work on it14:25
benbangertpjenvey_: no, I decided not to, cause its dumb14:25
benbangertwell, at Pycon I was actually saying its retarded14:25
benbangertinstead, I was going to put together a system using AuthKit and SA for db backed sessions14:26
benbangertsince thats all you really need14:26
benbangertoh, and a few extra columns to the user table14:26
ronchillabenbangert: what does pylos use for session?14:27
pjenvey_why's that dumb?14:28
benbangertronchilla: the default session storage is filesystem with Beaker (Which uses MyghtyUtils)14:28
pjenvey_you're saying you want to put the session data in a 'user' table that authkit knows about?14:28
benbangertpjenvey_: that is not dumb.... but putting a pickle thing into Beaker is dumb14:28
benbangertie, 'dumb' storage14:28
ronchillabenbangert: thankx14:28
benbangertwhere you let someone just stash some random python object in a blob14:28
*** marcin_ant has joined #pylons14:28
benbangertvs using the db to associate data properly14:28
benbangertcause if you have a database, you shouldn't need to go and stash random crap in an object that is pickled14:29
benbangertyou'll have your proper User object loaded with its relations intact14:29
*** bradmw has quit IRC14:29
benbangertso at Pycon, I was considering whether to implement such a "dumb" storage, where it just stashes pickled data (like Beaker does with the filesystem)14:30
benbangertand just call it RetardedStore14:30
pjenvey_well if you're using a session you obviously don't care about keeping relations intact14:30
pjenvey_it's for temporary storage14:30
benbangertand thats retarded ;)14:30
benbangertthat should be in a cookie14:30
pjenvey_like maybe you're holding the data for page 1 of a multipage form14:30
benbangertthen store it in the form14:30
benbangertor store it in a db table14:31
Chairosbenbangert: can you tell me how to completely clear the pylons.cache?14:31
pjenvey_that's stupid14:31
Chairospylons.cache.clear() doesn't work14:31
pjenvey_are you saying serialize a python object to a cookie14:31
pjenvey_you're stealing aaron schwartz horrible idea14:31
benbangertpython object?14:31
benbangertwhat are you smoking?14:31
benbangertyou said FORM14:31
pjenvey_a multipage form14:31
benbangertI say, keep the form elements as hidden form elements in the next page14:31
benbangertthere is no python object14:31
benbangertits a form, its form data14:32
benbangertretain the form data in hidden fields for the next page14:32
benbangertthen it'll even work with the Back button *gasp*14:32
pjenvey_putting it into a session is easier14:32
pjenvey_and i'm sure there's other examples14:32
benbangertsession has Back issues14:32
benbangertif you really need to be dumping pickled crap out, make a PickleCol in your table14:33
benbangertSo where's the prob?14:33
pjenvey_session is a dumb, simple object, having it handle that for you is easier14:34
benbangertand session is almost always mis-used14:34
benbangertbecause apparently its dumb-ness is contagious ;)14:34
pjenvey_and you don't always want database backed sessions, you only really want them if you have multiple front ends and what to have one centralized session store14:34
pjenvey_so it would only do that if you needed it14:34
benbangertpeople store random crap in it when they should use a cookie in most cases14:34
benbangertso you take db penalty hits for no reason14:35
pjenvey_'random crap' might be an object14:35
benbangertanyways, if someone wants to write that, power to them14:35
benbangertbut I'm not14:35
benbangertthere's issues serializing objects anyways, so maybe it'll work in the session, maybe it won't14:36
pjenvey_what issues14:36
benbangertwhen you want to handle any old random crap someone will want to stash, the only real solution is a Python object database14:36
benbangertobjects don't always serialize14:36
benbangertnot everything can be pickled14:36
pjenvey_well of course there's always that14:37
pjenvey_but most stuff can be14:37
benbangertso go write it ;)14:37
benbangertI'm just telling you why I'm not going to write it14:37
aa_well, you only need a dict of simple values don't you?14:37
pjenvey_well I was going to have someone write it once as a small project to learn python but then you said you were already in the process of writing it, remember?14:37
pjenvey_=p14:37
benbangertpjenvey_: I was working on a revamp, yea, but the more I did, the lamer it got14:38
benbangertpjenvey_: and when doing more research, the insane amount of times people mis-use sessions cropped up14:38
benbangertI mean, when it comes to db-backed sessions, your odds of doing stupid stuff goes up14:39
benbangertlots of people store user ID, and small tidbits of user data in a session14:39
benbangertso imagine, you have a 'dumb' db store, so first you load your session, get your user id, then go and load your user14:40
benbangertnow you're taking even more db queries than you need to..... and its ridiculously common for this to happen with db dumb stores14:40
benbangertbecause people just treat the db session as the file one.... with no regard to the fact that they now have their actual data in the same place as the session....14:41
benbangertDo you want a multi-page form to keep hitting your db? Or would you prefer to use hidden form fields and not have to worry about easy ways to smack your db?14:42
pjenvey_there are times where you want to keep an object associated with a user's session that isn't in the state of being 'committed' yet. i.e. it's not 'committed' until a user goes through a process and finally clicks the 'commit' button. and if the user doesn't 'commit' it, it gets thrown away14:43
pjenvey_you shouldn't have to create a database table for this kind of data14:43
benbangertpjenvey_: in most every case I can think of, you'd want a table for it14:44
pjenvey_well you haven't thought about edge cases then14:44
pjenvey_you're prematurely optimizing14:44
benbangertI'd hate to design a system engineered solely for the edge case14:44
stegwhere would you put the Invalid object if you were re-displaying a toscawidget on a different page to where the validation is done?14:45
stegin the session?14:45
benbangertsteg: anything from a form is form data, it came in as string data, its not an object14:45
benbangertpjenvey_: as I said, if you have an edge case and need to store random crap, make a PickleCol, its that easy14:46
benbangertpjenvey_: let the column save/load method handle that for you14:46
stegThis is only tangentially related to the discussion you guys are having btw :)14:46
stegI'm asking because I need to be able to do something like this :)14:46
benbangertpjenvey_: Is there something wrong with writing 1 or 2 lines of code to encompass all the edge cases?14:47
aa_you can't pickle random crap you get from a form14:47
aa_that's insanity14:47
stegForm with widgets submits to another action/controller, I want to redirect back to the submission page and display errors14:47
stegI need to store state somewhere14:47
aa_I mean you really just can't ever ever do that14:47
aa_steg: cookie14:47
benbangertaa_: I'd assume its validated first14:47
stegWhy a cookie?14:48
stegit makes sense to me to shove the Invalid object into the session14:48
stegIn fact, I don't see any other sane place to put it14:48
aa_benbangert: validated as any blob of text?14:48
benbangertaa_: prolly depends on how its happening14:49
aa_yeah well, but please don't do that :)14:49
benbangertpjenvey_:if he still wants to learn Python, it'd be a nice challenge for him14:49
benbangertpjenvey_: but when I saw that I'd be making a solution that should really only be used for edge cases.... I just didn't want to make it14:50
stegI explained earlier what I was trying to do, I'll explain it quickly again if you guys don't mind14:50
benbangertInstead, I should be making it easier to store small temporary bits of data in a signed cookie, and some methods to make multi-page forms that use hidden fields easier to write (without requiring a session)14:51
benbangertPeople fall back to sessions for this stuff because its the "easy way"14:51
benbangertand easy wins over "best" almost every time14:51
stegI have a shopping cart handled by ShoppingCart controller. It has a .add() action that expects a POST with the product_id and the number to add.14:51
stegThere are several different pages products can be added to this from, and each of these pages has a form that POSTs to the ShoppingCart.add action. So I do validation at ShoppingCart.add, but I want to redisplay any errors at the submission page14:52
stegI'd like to know if I'm being dumb :)14:52
stegor if that sounds reasonable14:52
stegit does necessitate redirecting and storing the Invalid object somewhere so it is available to the widget after the redirect14:53
pjenvey_sure, you're storing Product objects in your session14:54
pjenvey_possibly14:54
stegI'm only storing the Invalid object there. And also, and this is why it relates to what you guys were discussing, the form values :)14:54
stegso I can pass them to the widget for re-display14:55
*** uche_ has joined #pylons14:59
pjenvey_I guess these guys would store those product objects in another db table or a signed cookie15:04
pjenvey_or a combination of the two15:06
steghmm15:07
pjenvey_that sounds like a pain in the ass if you're not that concerned about the performance of the session lookups15:08
pjenvey_especially if you're ok with using the default file backed sessions now and would only consider database backed sessions in the future15:09
stegYes, I'm going to use the session15:09
stegif it becomes a problem at some point I'll worry about it then :)15:09
* steg goes to bed15:10
pjenvey_s/a pain in the ass/premature optimization/15:11
stegI might make some middleware to do this instead though... since I intend to redirect after *all* POST requests anyway... :)15:12
stegmight be fun15:13
stegwas thinking of doing something like this for toscawidgets anyway so that methods could be called directly on widgets15:13
steg(via ajax etc.)15:13
stegthis is similar15:13
stegI'll have to think about it15:15
stegnight :)15:15
*** uche has quit IRC15:16
*** fullpony has quit IRC15:18
*** damjan has joined #pylons15:21
* Chairos pokes benbangert.15:21
*** rope has joined #pylons15:30
steghmmph I think I should get rid of my habit of thinking aloud on IRC15:36
Chairosheh15:36
* wiggy likes the habit15:37
pjenvey_speaking of thinking aloud on IRC, where's jesusphreak? =]15:37
pjenvey_haven't seen him around in a bit15:37
pjenvey_did he switch back to django?15:37
Chairoshaven't seen him.15:38
Chairoscheck on reddit. :D15:38
pjenvey_maybe he switched to zope15:38
stegit is a bad habit because it means half-baked thoughts come out and I look like an idiot15:38
stegI'd rather look like an idiot based on my whole-baked thoughts :)15:39
Chairosheh15:39
Chairospjenvey, do _you_ know anything about the pylons.cache object?15:39
wiggynothing wrong with zope15:39
stegI saw him in #django the other day but he was arguing with them :)15:39
Chairoshaha15:40
* wiggy off to bed15:40
pjenvey_yea, where you saying it doesn't have clear()?15:43
pjenvey_were15:43
Chairosyeah15:43
ChairosI need to know how to invalidate the entire cache.15:44
Chairosall the cached results for all the keys in all the namespaces.15:44
Chairosknowing how to invalidate a single result for a single key in a single namespace might come in handy in the future, too.15:44
benbangertpjenvey_: its not premature optimization, its about good design15:45
* Chairos is thinking about using memcache for sessions and cache.15:45
benbangertof course, in a lot of cluster db setups, you have a read-only db slave, and a write-master.... and there's lots of variations15:47
benbangertI'd feel sorry for anyone trying to write code to handle all the edge cases15:47
benbangertBetter to write a db session toolkit15:48
benbangertSo you could tweak it as needed for your particular case15:48
Chairosmaybe I should post my cache question to the mailing list.15:50
*** __pv has quit IRC15:56
*** pobrien has quit IRC15:56
*** creiht has quit IRC15:57
pjenvey_i guess we could add a clear() to cachemanager to call clear on all its caches15:57
ChairosI'm currently doing this:15:58
Chairos        for ns in cache.caches.keys():15:58
Chairos            cache.get_cache(ns).clear()15:58
Chairosexcept it doesn't actually work.15:58
pjenvey_yea i just saw some funkyness with that15:58
* pjenvey_ >>> pylons.cache.get_cache('hi')['sup']15:58
* pjenvey_ 'yo'15:58
* pjenvey_ >>> pylons.cache.get_cache('hi').clear()15:58
* pjenvey_ >>> pylons.cache.get_cache('hi')['sup']15:58
* pjenvey_ 'yo'15:58
pjenvey_mr buggy cache i presume15:59
pjenvey_benbangert - database backed sessions work fine for many people15:59
benbangertpjenvey_: so have your friend write one16:00
pjenvey_session is an abstraction, if it gets the job done what the underlying behavior is isn't a big deal, even if you're considering it bad design16:00
benbangertsession is an abstraction to deal with the fact that your user data is not in the same place as the session16:01
benbangertwhich is no longer true when the session is in a db16:01
pjenvey_i mean i agree some of the cases you bring up can be a stupid use of it, but i wouldn't worry about that until it actually becomes a big problem16:01
benbangertI'd rather make it easier to avoid the common misuses of a session16:01
xorAxAxlike? :)16:04
*** ianbicking is now known as ianb|afk16:04
vednisall this argument over a matter of stored state :)16:06
vednisI agree that it would be nice to have built-in mechanisms for easily passing hidden field data around16:11
vednisor at least an example using webhelpers or something16:12
*** kg has joined #pylons16:12
vednisand a pointer to an explanation of the tradeoffs would help newbies like me :)16:14
ronchillabenbangert: i've been following ur discussion of db backed sessions with pje....16:17
ronchillabenbangaret: i have a question for ya; where would you store a useres id in a webapp if not in a session?16:17
benbangertronchilla: in the cookie of course16:18
ronchillathat assumes the user has cookies enabled...16:19
benbangertronchilla: I'd actually store a session id, not a user id, and look up the user based on the session16:19
ronchillaagreed16:19
benbangertthis might shock you, but Pylons sessions won't work without cookies ;)16:19
benbangertso I'm already working with that assumption16:19
ronchillai noticed...16:19
ronchillathats why i asked the question earlier...16:19
benbangertthe only other place to store it would be in the URL, and that's pretty bad16:19
benbangertso if you don't use the URL, or a cookie. you have zero options afaik16:20
ronchillaagreed16:20
ronchillahmmm\16:20
ronchillaok, look at it this way16:20
ronchillaif you store the session id in a (signed) cookie you still need to hit the db every time u need bits of info about the user16:21
ronchillawhy not simply use the session a repository of such bits?16:21
ronchillaif you look at it form that perspective then it doesnt matter if the session is saved on the fs or db16:22
ronchillathe session just becomes an ephemeral information repository16:22
ronchillaeither ways data duplication remains irespective of the storage media16:23
ronchillathats the bit i'm not sure i understand about your position on bd backed sessions...16:23
Chairospjenvey: have you got any suggestions for me, or will I have to wait for the updated Beaker trunk?16:28
*** rope has quit IRC16:36
benbangertronchilla: so if you store the user id in a session (which a lot of people do), using db backed sessions means you have 2 db hits to retrieve a user instead of 116:36
benbangertronchilla: the whole thing we're talking about is db backed sessions, so yes, you will always hit the db once to get user info16:37
benbangertat least once that is16:37
*** ctc_patrick has quit IRC16:42
ronchillabenbangaret: mabey i'm just slow today...  but i cant see how it would result in two hits; (assuming the user_id example); you use the session id to query the db and get the user_id or whatever item requested - thats it. (i'm assuming that the session id is stored in a signed cookie which the framework can retrieve on each request b4 the controller (from which the session request is made) is called...)16:48
benbangertronchilla: so with a dumb store, you store the user id in the session. but to get the user data, you have to use the user id and get the user info from the db16:52
*** sloat has quit IRC16:52
benbangertronchilla: one hit to load the session with the user id, another hit to load the user based on that id16:53
*** efm has quit IRC16:54
*** goibhniu has quit IRC16:57
pjenvey_Chairos - looks broken, you probably want to wait for trunk to be fixed16:59
pjenvey_or give us a patch to fix trunk16:59
pjenvey_i just wrote a test triggering it16:59
benbangertpylons trunk is broken? or is that the cache?17:00
pjenvey_beaker is17:00
*** marcin_ant has quit IRC17:01
ronchillabenbangaret: thats would be true if the use for sessions involved authenticated users, think about a case where the use of the session is to trac stae information, in that case you could use hidden fields to pass information from one page to the other, but that aproach IMO also increases the attack profile of the application, to avoid this the application must treat every hidden field as  tainted data and ideally should filter/validate such data before17:01
ronchillause. Imagine the required overhead just to use that data and the potential for security holes..17:01
benbangertronchilla: inherited FormEncode schema's makes multi-page validation pretty easy17:01
benbangertI think the consensus at this point is there's no silver bullet17:02
ronchillatrue17:02
benbangertthere's always edge cases, and there's tons of them in this case, they aren't really an 'edge'17:02
*** zzzeek_ has quit IRC17:03
*** elefth has quit IRC17:03
ronchillaok17:04
benbangertwe can think about cases all day long that break anything anyone will come up with ;)17:04
ronchillayeah, thats true :)17:04
*** elefth has joined #pylons17:04
benbangertif you don't want to validate the data every step, include another field that is a signature for the other ones17:04
benbangertthat way you don't need to re-validate, but you can ensure it wasn't tainted17:04
ronchillathought of that; but still doesnt remove the code bloat factor...17:05
benbangertwhy is that code bloat?17:05
ronchillai'd have to have code to do the extra bit of checking...17:05
benbangert2 lines of code is bloat?17:05
ronchilla:)17:05
benbangert@secure_multipage on your action17:06
ronchilla2 lines of code in a 10, 100, 1000 functions is17:06
benbangertand inside the page, ${ h.secure_fields(c.formvars) }17:06
benbangertand bam, you no longer need to do the session saves and loads ;)17:06
benbangertso you haven't done code bloat17:06
benbangertyou've replaced the session loading and saving code with 2 lines that retain state in the form securely17:07
ronchillais secure_multipage a part of formencode?17:07
benbangertdoesn't exist yet17:07
ronchillalol17:07
benbangertthat's what I want to write17:07
benbangertits what I've been saying for awhile today.... which is, I'd like to write some functions that make it easy to not need sessions for these things17:08
benbangertand that eliminates the common edge cases17:08
ronchillawhat about the performace penalty of adding a decorator to an action17:08
ronchilladont bother17:08
benbangert;)17:08
ronchillai answered my own question17:08
benbangertyea, that extra function call will never hurt as much as session saving/loading :)17:09
ronchilla:)17:09
benbangertso if its really easy to store data in a cookie securely, and easy to securely retain information on multi-page forms.... I think that'd eliminate most of the common places where people use sessions (for non user-store stuff)17:10
ronchillaand waht abot the 4k cookie limit?17:10
benbangertwhat about it?17:11
benbangertdon't store that much. ;)17:11
ronchilla:)17:11
benbangertthere's always options17:11
ronchillatrue17:11
benbangertmaybe you want to store lots of objects, maybe you should be using ZODB17:11
benbangertor Schevo17:11
ronchillasessions are definitley not for storing objects17:12
ronchillaalthough it can be tempting...17:12
ronchillabenbangaert: any ideas when pylons 0.95 will be out?17:14
benbangertI'm going to try and get out Routes tonight17:14
benbangertif Paste is fine as is (which I think it is), then Pylons 0.9.5 this week17:15
ronchillathat would be great!17:15
*** benbangert has quit IRC17:24
*** kg has quit IRC17:38
*** btbytes___ has joined #pylons17:42
*** btbytes___ is now known as btbytes17:42
*** etrepum_ has joined #pylons17:47
*** etrepum has quit IRC17:47
*** triplah_ has joined #pylons17:47
*** windle has joined #pylons17:48
*** btbytes__ has quit IRC17:50
*** fullpony has joined #pylons17:55
matt_goodany suggestions for dealing with the permissions error pages with AuthKit18:03
matt_gooddepending on the ordering of the middleware I either get just plain pages with the AuthKit error and message18:04
matt_goodor I get the nice Pylons page, but it doesn't display the reason18:04
windlehmm18:07
windleI thought there was a doc on customizing that?18:07
*** btbytes___ has joined #pylons18:13
matt_goodwell, there's a section in the AuthKit Pylons integration doc on setting up an error_mapper18:15
matt_goodbut that's supposed to be unnecessary with Pylons 0.9.418:16
*** zzzeek_ has joined #pylons18:17
*** btbytes has quit IRC18:20
*** zzzeek_ has quit IRC18:41
*** efm has joined #pylons18:41
*** zzzeek_ has joined #pylons18:42
*** creiht has joined #pylons19:20
*** btbytes____ has joined #pylons19:31
*** btbytes____ is now known as btbytes19:31
*** btbytes___ has quit IRC19:41
Chairosis there a good way of having a middleware apply only to a controller?19:43
Chairosnot the entire app19:44
ChairosI tried wrapping the controller class in it, but I got this exception: <type 'exceptions.TypeError'>: default __new__ takes no parameters19:44
tanukiWhere's the documentation for h.url_for?20:02
tanukiI have this in my template: <% h.url_for(controller='account', id=c.creator, action='view') %>20:03
tanukibut it returns the same page it's on20:03
*** btbytes____ has joined #pylons20:24
*** creiht has quit IRC20:35
Chairostanuki: http://routes.groovie.org/module-routes.html#url_for20:40
*** btbytes has quit IRC20:41
*** zzzeek_ has quit IRC20:59
*** btbytes_____ has joined #pylons21:02
*** btbytes_____ is now known as btbytes21:03
*** fullpony has quit IRC21:04
*** btbytes____ has quit IRC21:20
tanukiHow do I select using a substring ("WHERE column LIKE '%substr%'") using SQLAlchemy?  I've asked in #sqlalchemy but nobody's around21:33
Chairossee the first example here: http://www.sqlalchemy.org/docs/sqlconstruction.html#sql_whereclause_operators21:36
*** btbytes has quit IRC21:38
tanukiBut how does that combine with the model specification?21:39
tanuki... never mind, found it21:46
tanukibah21:46
*** cwells has joined #pylons21:56
*** etrepum has joined #pylons22:15
*** etrepum_ has quit IRC22:15
Chairosmatt_good: http://mail.python.org/pipermail/distutils-sig/2007-April/007462.html23:11
matt_goodChairos: nice, I'll be sure to bookmark that23:15
*** climbus has joined #pylons23:25
*** kg has joined #pylons23:29
*** windle has quit IRC23:35
*** matt_good has quit IRC23:40

Generated by irclog2html.py 2.4 by Marius Gedminas - find it at mg.pov.lt!