Sorry,

I will certainly do.

Greetings

On Mon, May 23, 2011 at 1:37 PM, Wichert Akkerman <[email protected]> wrote:

> I would suggest taking these further questions to the pylons-discuss list.
> This list is for development of Pyramid itself, not for how to use it.
>
>
>
> On 5/23/11 13:29 , neurino wrote:
>
>> @Jasper:
>>
>> your method seems to me a bit awkward, pylons used a module-level global
>> variable like DBSession almost everywhere and I guess I never had
>> problems.
>>
>> @Wichert: thanks, I'll check repoze.tm2, as for paster setup-app I
>> relied on what I read here:
>>
>>
>> http://groups.google.com/group/pylons-devel/browse_thread/thread/36aa6769ebda9e62
>>
>> if there's an example somewhere of using paster setup-app with pyramid
>> please let me know
>>
>> ====
>>
>> since we are discussing about paster:
>>
>> what's a fine way to get in paster pshell (iPython) some variables
>> already set?
>>
>> I was used (Pylons again) on first prompt I had at least myapp.model
>> already available as "model", the same for "Session", and I would
>> willingly add also some instances of my model too, I know how to get
>> models, DBSession and so on but I'd like to know how I could get them
>> preloaded.
>>
>> Thanks again
>> neurino
>>
>>
>> On Mon, May 23, 2011 at 12:44 PM, Wichert Akkerman <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>    On 5/23/11 12:23 , neurino wrote:
>>
>>         > Creating tables and adding initial content is better done
>>        with paster
>>        setup-app or another separate command.
>>
>>        But setup-app is not present in pyramid.
>>
>>
>>    setup-app is a PasteDeploy thing. You can use it with pyramid apps
>>    if you want to, but I would recommend using a paster command
>>    approach instead: much simpler and does not suffer from the many
>>    problems setup-app has.
>>
>>
>>        I understand your point and I'm also going, in production, to
>>        move that
>>        code in a setup script.
>>
>>        Anyway then, having:
>>
>>             import transaction
>>
>>        at the top of my models.py what do I have to take care when adding,
>>        merging or removing content?
>>
>>
>>    Personally I use a repoze.tm2 middleware to manage all my
>>    transactions. That makes everything Just Work, and you never have to
>>    worry about transactions again. I know other people prefer a more
>>    pyramid-specific approach of using Pyramid events to manage
>>    transactions.
>>
>>
>>        And, back to my initial question:
>>
>>        in Pylons I had a Session instance named "session" i used in my
>>        controllers like
>>
>>             model.session.add(anything)
>>             model.session.commit()
>>
>>        what I'm supposed to do now?
>>
>>             models.DBSession().add(anything)
>>
>>
>>    That is the exact same thing. DBSession is just a SQLAlchemy
>>    ScopedSession object, same as your model.session object in a Pylons
>>    1 project. You can use model.DBSession.add as well - SQLAlchemy will
>>    do the same thing.
>>
>>
>>
>>        I'm not used to instantiate & call "Class().method" that much
>>        and looks
>>        me ugly but if it's the correct way to go with it...
>>
>>
>>    If you do 'model.session.add' SQLAlchemy will internally do the same
>>    thing: it finds the current session for your thread and runs add on it.
>>
>>
>>    Wichert.
>>
>>    --
>>    You received this message because you are subscribed to the Google
>>    Groups "pylons-devel" group.
>>    To post to this group, send email to [email protected]
>>    <mailto:[email protected]>.
>>
>>    To unsubscribe from this group, send email to
>>    [email protected]
>>    <mailto:pylons-devel%[email protected]>.
>>
>>    For more options, visit this group at
>>    http://groups.google.com/group/pylons-devel?hl=en.
>>
>>
>> --
>>
>> You received this message because you are subscribed to the Google
>> Groups "pylons-devel" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/pylons-devel?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-devel" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pylons-devel?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to