#pyramid

/

      • jMyles
        I'm taking notes. So it's more reassuring if the docs expressly give examples that show pyramid-specific situations?
      • I mean, I try to keep it somewhat agnostic, like this: http://hendrix.readthedocs.org/en/latest/testin...
      • inklesspen
        you're not getting it
      • the docs don't actually show running a wsgi app
      • any wsgi app
      • jMyles
        But naturally I just haven't gone through and done that with the rest of the docs
      • Oh I see. You want to see the application object be passed somewhere.
      • Yeah, that's totally sensible.
      • raydeo
        gunicorn and uwsgi both have ways to run apps made with pastedeploy directly
      • inklesspen
        what the docs on http://hendrix.readthedocs.org/en/latest/runnin... show, and the ONLY thing they show, is "running a django app by passing in the location of the django settings"
      • raydeo
        those aren't pyramid-specific but work with pyramid apps
      • inklesspen
        (which obviously i can't do for pyramid)
      • raydeo
        "gunicorn --paste development.ini" or whatever
      • jMyles
        inklesspen: Yeah I agree that's awful.
      • digitalsatori has quit
      • raydeo
        if hendrix is doing any monkeypatching of threadlocals then it's important to not make an entrypoint for it in pserve
      • s/threadlocals/threading
      • rickmak joined the channel
      • digitalsatori joined the channel
      • digitalsatori joined the channel
      • rickmak has quit
      • rickmak joined the channel
      • jMyles
        I haven't been exposed to pastedeploy prior to this moment.
      • penna_ joined the channel
      • whit joined the channel
      • penna__ has quit
      • johbo` joined the channel
      • whit has quit
      • whit joined the channel
      • johbo` has quit
      • inklesspen
        jMyles: pastedeploy is the system that pyramid's ini file tooling uses
      • jMyles
        inklesspen: Well, it's not much, but I've made this doc a tiny bit more agnostic: http://hendrix.readthedocs.org/en/latest/runnin...
      • inklesspen: Yeah, I've been looking into it here these past minutes.
      • I need to get some... rest if not sleep.
      • Talk to you all soon.
      • tamarin_ joined the channel
      • tamarin_ is now known as tamarin
      • c0le joined the channel
      • johbo` joined the channel
      • yvl joined the channel
      • c0le has quit
      • c0le joined the channel
      • lszyba1 joined the channel
      • lszyba1
        Hello, I'm reading http://pyramid-cookbook.readthedocs.org/en/late... and I can't seem to figure out if the 2nd database should be added to __init__.py? or elsewhere.. I don't want the initialize_myapp_db to touch it
      • rweir
        wherever
      • pyramid cares not at all about dbs
      • do you mean "I'm using sqlalchemy and I'm not sure how to do models against multiple dbs"
      • ramteid joined the channel
      • sontek joined the channel
      • rickmak_ joined the channel
      • lszyba1
        rweir: I mean the default DB is sqllite...when you do initlize_myapp_db it will create default tables for session,etc.... I've added a 2nd db that I will use to pull database from mysql using sqlalchemy...but I want to make sure that initilize script will not be trying to create tables in mysql...only in sqllite
      • tisto joined the channel
      • so the real question is : does the initialize_tutorial_db development.ini calls def main() in __init__ or?
      • tokra100 joined the channel
      • rweir
        pyramid has no idea about dbs
      • lszyba1
        it does...because scafold is setting it up...and by default it wants sqlite. aka sqlalchemy.url I'
      • x58
        The scaffold is simply a tool to help you get started. If you look in scripts/initdb.py (IIRC) you can see what it is doing to create your SQLite database.
      • As long as you don't call the same functions on your new models/DBSession that is tied to MySQL it won't do any initialisation for you.
      • lszyba1
        I'm adding a second one mydatabase2.url = mysql://.... now I want to add a engine2 = engine_from_config(settings, 'mydatabase2.') DBSession.configure(bind=engine2)
      • x58
        You can't name it the same "DBSession"
      • so long as you make that DBSession2 you should be fine.
      • lszyba1
        sorry DBSession2...
      • inside __init__....will that database be called when I do inililize_myapp_db development.ini
      • x58
        Go read script/initdb.py which the scaffold created for you.
      • that is what initialize_myapp_db points to...
      • It's an entrypoint that is located in your setup.py
      • Pyramid itself is entirely database agnostic, the scaffold in this case uses sqlalchemy to give you a starter project, there is no requirement for you to use the scaffold though,
      • lszyba1
        x58...thank you..it looks like its using DBSession DBSession.add(model)
      • tokra100 has left the channel
      • x58
        There is no magic there... unless you explicitly tell it to initialise your MySQL database in that script, it just won't happen.
      • Explicit over implicit.
      • lszyba1
        one more....Reflected tables ...def init_model(enigine2):.....autoload=True....does that go into __init__.py or models.py?
      • x58
        Up to you.
      • You can organise the code how you see fit.
      • johbo` joined the channel
      • lszyba1
        I guess model.py...now that I look at it closely and I see original DBSession is there...and I guess I'm going to have to call init_model(engine2) in __init__.py
      • thank you...gtg to to sleep now...resume tomorow..bye .(http://lucasmanual.com/mywiki/Pyramid/)
      • jhauser joined the channel
      • johbo` has quit
      • lszyba1 has left the channel
      • wiggy joined the channel
      • yvl has quit
      • frispete joined the channel
      • wiggy
        morning
      • Ademan joined the channel
      • Lcaracol_ joined the channel
      • Lcaracol has quit
      • jhauser has quit
      • Charlie_X joined the channel
      • Charlie_X
        Good morning.
      • johbo` joined the channel
      • cdunklau: I think I'd favour something like the repository pattern for CRUD stuff.
      • But for the more adventurous stuff I think I'd better tempted to use view properties. The problem with some DB stuff is that too much abstraction just creates new problems.
      • johbo` has quit
      • DRY tempts us to try and avoid writing two very similar, but subtly different queries.
      • I think SQLa's SQL generation code is. however, good enough for us not to worry about it too much. So writing the query where you need it seems the way to go.
      • digitalsatori has quit
      • digitalsatori joined the channel
      • carl- joined the channel
      • driti has quit
      • carl- joined the channel
      • Paradisee joined the channel
      • cdunklau
        Charlie_X: i'm not really sure what you mean by "view properties"...
      • Charlie_X
        Use a class for the view and use properties on it.
      • View methods and attributes are visible to any template.
      • Allows you to encapsulate stuff without littering your code with lots of utility functions.
      • Makes a lot of sense if you have a lot of queries for a page.
      • mr_jolly joined the channel
      • cdunklau
        Charlie_X: oh good to know
      • johbo` joined the channel
      • Charlie_X: i do like the repository pattern idea. even if I have a repository method i'll only use once, it still makes things more testable
      • johbo` has quit
      • MrTango joined the channel
      • Charlie_X
        Yes
      • It's basically stating the obvious. But that's often no bad thig.
      • areski joined the channel
      • cdunklau: you can have a laugh at some thoroughly untested view code
      • I think this shouldn't take too much work to become reasonably testable: https://bitbucket.org/charlie_x/python-httparch...
      • johbo` joined the channel
      • cdunklau
        Charlie_X: oh so you actually meant properties
      • whyyyy
      • Charlie_X: that is, why not just normal methods?
      • atomekk joined the channel
      • Ergo joined the channel
      • digitalsatori1 joined the channel
      • johbo has quit
      • yleclanche joined the channel
      • vagelis joined the channel
      • Charlie_X
        Simplifies accessing them and clarifies intent.
      • Charlie_X has quit
      • atomekk joined the channel
      • atomekk has quit
      • atomekk joined the channel
      • cdunklau
        hmm, i'd be surprised if attribute access did a bunch of things
      • but oh well
      • tamarin has quit
      • markm joined the channel
      • yvl joined the channel
      • cmk_zzz_ joined the channel
      • plamut has quit
      • digitalsatori1 has quit
      • mr_jolly has quit
      • tbenita joined the channel
      • so here's what i have for my repository thing so far. it feels dirty, instances of those classes hold no state
      • oh rats, charlie left
      • plamut joined the channel
      • mr_jolly joined the channel
      • teix joined the channel
      • Paradisee_ joined the channel