message flash does not display on first submit

1 view
Skip to first unread message

dakila

unread,
Jun 8, 2010, 2:12:11 AM6/8/10
to rum-discuss
Hi All,

I am trying to create a new user using rum and I observed that when on
submitting an erroneous data say a duplicate username, the 'error' is
displayed on the next submit or when navigating out of the 'new' link.
Tried it with a submit that fails form validation or error due to
duplicate entry

Form has errors. Please correct

An integrity error ocurred: (1062, "Duplicate entry 'manager' for key
'user_name'") (INSERT INTO tg_user ...)


Regards,
Dakila

Michael Brickenstein

unread,
Jun 8, 2010, 4:23:30 AM6/8/10
to rum-discuss
Hi!
Can you give me more details on your setup.

Is RUM mounted in TG2/Pylons?
Does config.get('render_flash', True)
yield True or False.
I was not able to reproduce the problem in TgRumDemo.
Cheers,
Michael

Michael Brickenstein

unread,
Jun 8, 2010, 4:46:24 AM6/8/10
to rum-discuss


On 8 Jun., 10:23, Michael Brickenstein <brickenst...@mfo.de> wrote:
> Hi!
> Can you give me more details on your setup.
>
> Is RUM mounted in TG2/Pylons?
> Does config.get('render_flash', True)

just to add, that I was referrring to the config call inside RUM.
Alternatively, I just would need the config dictionary and the other
parameters you pass to RUMAlchemyController.
Cheers,
Michael

dakila

unread,
Jun 9, 2010, 12:13:27 PM6/9/10
to rum-discuss
Hi Michael,

Its rather weird, I tried the latest TgRumDemo at http://hg.python-rum.org/TgRumDemo/
and the 'missing' flash problems are not replicated. But doing the
following below, I was able to replicate the issue (Im using tg2.1b2)

Here is what I did,

1. created and activated new virtualenv
2. easy installed tg2.1b2 (easy_install -i http://www.turbogears.org/2.1/downloads/current/index
tg.devtools) 3. easy installed the rum related packages
4. created and setup-app the quickstarted project
5. modified controller/root.py and added the necessary imports and
replaced the 'admin':
6. logging in as manager and creating a new user 'manager' will not
display the error the first time.

from tg import config
from tgrum import RumAlchemyController
from tgrumdemo.policy import MyPolicy



# admin = AdminController(model, DBSession,
config_type=TGAdminConfig)

admin = RumAlchemyController(
model,
template_path=config['paths']['templates'][0],
render_flash=False, # Since this app's master template will
render it
policy=MyPolicy
)


Other errors also happens if you choose mako as template during
quickstart.


Best Regards,
Dakila

dakila

unread,
Jun 10, 2010, 5:41:44 AM6/10/10
to rum-discuss
Hi All,

Not sure if this solves the problem regarding the 'flash' message not
being displayed.
In tg21b2, quickstarted project using genshi has master.html with
use_js=False. In TgRumDemo this is set to True


diff tgtest/templates/master.html ~/codes/TgRumDemo/tgrumdemo/
templates/master.html
....

< <py:with vars="flash=tg.flash_obj.render('flash',
use_js=False)">
---
> <py:with vars="flash=tg.flash_obj.render('flash', use_js=True)">



Regards,
Dakila

On Jun 10, 12:13 am, dakila <dak...@gmail.com> wrote:
> Hi Michael,
>
> Its rather weird, I tried the latest TgRumDemo athttp://hg.python-rum.org/TgRumDemo/
> and the 'missing' flash problems are not replicated. But doing the
> following below, I was able to  replicate the issue (Im using tg2.1b2)
>
> Here is what I did,
>
> 1. created and activated  new virtualenv
> 2. easy installed tg2.1b2 (easy_install -ihttp://www.turbogears.org/2.1/downloads/current/index

Michael Brickenstein

unread,
Jun 10, 2010, 7:45:59 AM6/10/10
to rum-d...@googlegroups.com, dakila
Hi Dakila!

Am 10.06.2010 um 11:41 schrieb dakila:

> Hi All,
>
> Not sure if this solves the problem regarding the 'flash' message not
> being displayed.
> In tg21b2, quickstarted project using genshi has master.html with
> use_js=False. In TgRumDemo this is set to True

For philosophical reasons flashing via is strongly recommended:

http://blog.ianbicking.org/2008/12/17/javascript-status-message-display/

Thanks for the hints for reproducing the problem.
I'll have a look at it later.

Cheers,
Michael

> --
> You received this message because you are subscribed to the Google Groups "rum-discuss" group.
> To post to this group, send email to rum-d...@googlegroups.com.
> To unsubscribe from this group, send email to rum-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rum-discuss?hl=en.

-------------------------------------------
Michael Brickenstein
Mathematisches Forschungsinstitut Oberwolfach gGmbH
Schwarzwaldstr. 9 - 11
77709 Oberwolfach
Tel.: 07834/979-31
Fax: 07834/979-38

Michael Brickenstein

unread,
Jun 10, 2010, 7:49:42 AM6/10/10
to rum-d...@googlegroups.com, dakila
Hi!

>
> Other errors also happens if you choose mako as template during
> quickstart.
>

RUM is meant to be a clean WSGI map, which should run mounted in (almost)
any clean WSGI application. So, the principal mechanism allows the use of mako as default template system
in the hosting app.

I guess, the bug is due to the integration feature for the master template in tgrum.
I have to check that.

Cheers,
Michael


> Best Regards,
> Dakila
>
> On Jun 8, 4:46 pm, Michael Brickenstein <brickenst...@mfo.de> wrote:
>> On 8 Jun., 10:23, Michael Brickenstein <brickenst...@mfo.de> wrote:
>>
>>> Hi!
>>> Can you give me more details on your setup.
>>
>>> Is RUM mounted in TG2/Pylons?
>>> Does config.get('render_flash', True)
>>
>> just to add, that I was referrring to the config call inside RUM.
>> Alternatively, I just would need the config dictionary and the other
>> parameters you pass to RUMAlchemyController.
>> Cheers,
>> Michael
>

Michael Brickenstein

unread,
Jun 18, 2010, 8:12:34 AM6/18/10
to rum-discuss
Hi!
I was able to reproduce it.
It looks like a bug in TG, although I am not 100% sure.
I hope, it suffices to your personal needs, that using JS is better
anyway.
Cheers,
Michael

Reply all
Reply to author
Forward
0 new messages