Re: [Mailman-Developers] Unable to commit changes from mailman shell to database

2016-04-02 Thread Barry Warsaw
On Apr 03, 2016, at 01:30 AM, Gurkirpal Singh wrote:

>Maybe it was there because I'm using PostgreSQL but it worked for me.

Cool, so it's working now?

I believe SQLAlchemy opens a transaction automatically, so that the bound
commit() and abort() methods operate on that transaction.  By creating a new
connection and a new transaction, I think you might have created a
subtransaction which didn't get flushed to the database.  It probably doesn't
have anything to do with the db backend specifically, but just how SA works.

Cheers,
-Barry
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


[Mailman-Developers] Unable to commit changes from mailman shell to database

2016-04-02 Thread Gurkirpal Singh
I tried the doing it the way you did and got the same result. After 
checking with "dir()" I found a "commit" method. I tried running it and 
it worked.


>>> dir()
['IUserManager', '__builtins__', 'a', 'abort', 'commit', 'config', 
'getUtility', 'l', 'm', 'now', 'um', 'user_manager', 'x']

>>> commit
>

>>> commit()
>>>


Maybe it was there because I'm using PostgreSQL but it worked for me.
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


Re: [Mailman-Developers] Unable to commit changes from mailman shell to database

2016-04-02 Thread Barry Warsaw
On Apr 02, 2016, at 06:17 AM, Anirudh Dahiya wrote:

>I have been playing with mailman shell but upon creating objects like
>domains and addresses, and subsequestly committing them to database by
>calling transaction.commit() I am unable to see changes in the database(and
>thus on Postorius)

>The current approach I am taking towards committing transaction is first
>creating a connection object by calling config.db.engine.connect() . After
>that, I am creating a transaction object by calling connection.begin() .
>Finally after creating domain and address objects, I call
>transaction.commit(),which executes succesfully, but I am unable to see
>changes being reflected in the database.

Which database backend are you using, SQLite or PostgreSQL?

When you're checking the database, is this from a different process?   How are
you checking the database?  Can you give us the exact set of commands you're
using both to change things and to check things?  E.g. maybe paste a console
session so we can reproduce it.

`mailman shell` exposes some globals, such as commit(), abort(), the config
object, and the mailing list `m` object if you gave the -l option.  I don't
think you normally need to do the config.db.engine.connect() call or the
connection.begin() call, and I don't know whether those are create
subtransactions or otherwise interfering with your operations.

Cheers,
-Barry
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


[Mailman-Developers] Unable to commit changes from mailman shell to database

2016-04-01 Thread Anirudh Dahiya
Hi
I have been playing with mailman shell but upon creating objects like
domains and addresses, and subsequestly committing them to database by
calling transaction.commit() I am unable to see changes in the database(and
thus on Postorius)
The current approach I am taking towards committing transaction is first
creating a connection object by calling config.db.engine.connect()  . After
that, I am creating a transaction object by calling connection.begin() .
Finally after creating domain and address objects, I call
transaction.commit(),which executes succesfully, but I am unable to see
changes being reflected in the database.
Thanks
Anirudh Dahiya
(IRC spark)
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9