[web2py] Passing in arbitrary values at runtime/configuration switching

2016-02-20 Thread lillian
All,

As I understand the code, -L  only allows you to redefine values 
web2py already understands (new/arbitrary keys i.e. bananas=False are 
ignored, see widget.py), what is the best way to provide custom runtime 
configuration of other, app-specific values?  Importing a module with the 
values has been suggested elsewhere but that isn't a good solution since 
you'd have to edit the module or provide some other mechanism for choosing 
between modules at runtime if you have multiple setups (i.e. production vs. 
testing).

widget.py could be patched to allow custom attributes, but is there a 
better way?  I'm open to sugestions.

lil

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Using web2py with werkzeug?

2015-11-23 Thread lillian
Hello,

I have an existing web2py app that I want to run behind mezzanine (the 
django CMS).  Meaning, mezzanine would provide the landing page/blog/etc. 
and after logging in the content would be provided by the web2py app.  On 
another forum it was recommended that I use werkzeug's DispatcherMiddleware 
to combine the two apps so I can run them together.

Are there any guidelines/recommendations for doing this with web2py?  

Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Best way to migrate existing 2.9.11 app to use new css/js from web2py 2.12.3?

2015-11-16 Thread lillian
Got it, thanks for the clarification.

lillian

On Monday, November 16, 2015 at 3:30:58 PM UTC-8, Anthony wrote:
>
> And note, this issue is not specific to the web2py scaffolding app -- it 
> applies to any site you want to migrate from Bootstrap 2 to Bootstrap 3 (or 
> 4) or to Semantic UI, etc.
>
> On Monday, November 16, 2015 at 6:29:26 PM UTC-5, Anthony wrote:
>>
>> On Monday, November 16, 2015 at 5:09:57 PM UTC-5, lillian wrote:
>>>
>>> Anthony,
>>>
>>> The app mostly uses the default styling which is why I was surprised so 
>>> much of it seemed broken when I tried to migrate,
>>>
>>
>> Yes, but it is the default styling for Bootstrap 2. The CSS rules for 
>> frameworks like Bootstrap are not based on HTML elements alone. Rather, the 
>> framework itself prescribes both a particular HTML structure and a set of 
>> specific CSS classes. Therefore, when switching from one framework to 
>> another (including from one major version of Bootstrap to another), it is 
>> not simply a matter of swapping out the CSS rules -- you also have to 
>> change all the HTML markup and CSS class names so they are consistent with 
>> the requirements of the new framework.
>>
>> If you stick Bootstrap 3 CSS rules in an app whose markup is written for 
>> Bootstrap 2, it's not going to work. Whether or not you have stuck to the 
>> default styling in the original Bootstrap 2 markup is irrelevant.
>>  
>>
>>>  It seems like it might be easier to start a new app and just move the 
>>> controllers/views/models over from the old app and go from there.
>>>
>>
>> Yes, that was my point. You are migrating to a new front-end framework, 
>> which has its own unique requirements for markup and class names.
>>
>> Anthony
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Best way to migrate existing 2.9.11 app to use new css/js from web2py 2.12.3?

2015-11-16 Thread lillian
Anthony,

The app mostly uses the default styling which is why I was surprised so 
much of it seemed broken when I tried to migrate, prompting my initial 
post.  It seems like it might be easier to start a new app and just move 
the controllers/views/models over from the old app and go from there.

lillian

On Saturday, November 14, 2015 at 9:13:01 PM UTC-8, Anthony wrote:
>
> You're going from Bootstrap 2 to Bootstrap 3, which is essentially a 
> different framework with different layout, class names, etc. So, it's just 
> like any switch in front-end UI -- you may have lots of little changes to 
> get your markup to work properly with the new framework. See 
> http://getbootstrap.com/migration/. Also, be sure to use the Bootstrap 3 
> formstyles for forms.
>
> Anthony
>
> On Saturday, November 14, 2015 at 11:38:32 PM UTC-5, lillian wrote:
>>
>> Hello,
>>
>> I have an existing web2py app and would like to have access to the 
>> updated bootstrap/css/js components in the 2.12.3 release.  What is the 
>> best way to approach this?  I tried updating from the admin page, 
>> recreating the welcome app, then copied over the new js/css dirs and 
>> layout.html into my app.  Afterward I could use things like the jumbotron 
>> but the styling of most everything else is a mess.  Missing icons, 
>> incorrect alignments, dropdowns missing carets, etc.
>>
>> Is there a better way to do this or do I have to go in and work out all 
>> the problems by hand?
>>
>> Thanks!
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Best way to migrate existing 2.9.11 app to use new css/js from web2py 2.12.3?

2015-11-14 Thread lillian
Hello,

I have an existing web2py app and would like to have access to the updated 
bootstrap/css/js components in the 2.12.3 release.  What is the best way to 
approach this?  I tried updating from the admin page, recreating the 
welcome app, then copied over the new js/css dirs and layout.html into my 
app.  Afterward I could use things like the jumbotron but the styling of 
most everything else is a mess.  Missing icons, incorrect alignments, 
dropdowns missing carets, etc.

Is there a better way to do this or do I have to go in and work out all the 
problems by hand?

Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Disabled fields in SQLFORM fail validation?

2015-03-04 Thread lillian

No suggestions or insight into this?  Anyone?

On Saturday, February 28, 2015 at 5:07:03 AM UTC-8, lillian wrote:
>
> Hello,
>
> I have a SQLFORM.factory-created form with several fields but one in 
> particular that can only be filled out ONCE.  If the form is edited that 
> particular field is disabled.  All that logic works fine.  However, when 
> the edited form is submitted the disabled field fails validation even 
> though it contained the original valid value.  After the failed submit it 
> is empty.
>
> I expect I could work around this - replace the input with a label instead 
> of disabling it for example - but I'd rather know why disabled fields fail 
> validation.  Are their contents inaccessible?  Making the field readonly 
> solves the validation problem but raises others (the field still responds 
> to clicks and other user input for example).
>
> Thoughts?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Disabled fields in SQLFORM fail validation?

2015-02-28 Thread lillian
Hello,

I have a SQLFORM.factory-created form with several fields but one in 
particular that can only be filled out ONCE.  If the form is edited that 
particular field is disabled.  All that logic works fine.  However, when 
the edited form is submitted the disabled field fails validation even 
though it contained the original valid value.  After the failed submit it 
is empty.

I expect I could work around this - replace the input with a label instead 
of disabling it for example - but I'd rather know why disabled fields fail 
validation.  Are their contents inaccessible?  Making the field readonly 
solves the validation problem but raises others (the field still responds 
to clicks and other user input for example).

Thoughts?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-02-03 Thread lillian

I'm already handling my own validation so I can sanitize and do the right 
thing as needed.  I'm mostly concerned about preserving user changes in 
cases where they might reasonably expect them to be persisted.

Along those lines, since there is no "login expired" event (as I understand 
it) there is no way to perform an auto-logout and subsequent auto-submit 
like we've been discussing? 

On Monday, February 2, 2015 at 1:24:17 PM UTC-8, Niphlod wrote:
>
> that works only if your controller accepts basically any data (very "low 
> barrier" on validation). My usecase scenario didn't ever involve the user 
> not knowing it's submitting data, and I'd treat "half-filled forms" with a 
> dedicated controller to clean/purge/mark_as_unreliable data what's coming 
> in...but that's me with my usual scenario.
> The underlying concept in "developing" is that every app has its own 
> goals... in principle, if you can live with "whatever data the user had the 
> time to fill", there's nothing wrong with your approach.
>
> On Sunday, February 1, 2015 at 4:27:12 AM UTC+1, lillian wrote:
>>
>>
>> Yeah that's basically what I came up with between posting and seeing your 
>> reply, except I'm letting the code in my controller do the actual db update 
>> (its that same code used if the user had clicked on submit) and then I 
>> redirect based on what UI element called submit (submit button? do the 
>> normal thing.  Logout button? logout. etc.)
>>
>> Does that make sense?  It works but I'm wondering if there might be 
>> issues I'm not aware of.  Kinda new to this type of programming :-/
>>
>> On Friday, January 30, 2015 at 1:31:08 PM UTC-8, Niphlod wrote:
>>>
>>> the gist of it should be something like
>>>
>>> $(function() {
>>> $('a#thelogoutbutton').on('click', function(e) {
>>> e.preventDefault();
>>> if (code_to_submit_the_form() == 'everythingwentwell') {
>>> window.href = this.href;
>>> } else {
>>> managefailure();
>>> //optionally window.href = this.href
>>> } 
>>> })
>>> })
>>>
>>> as a general rule, it's not a "polite thing" to do to block on something 
>>> if the user presses "i want to go out of here", so be sure to do it as 
>>> switfly as possible (i.e. don't require a strict check on 
>>> code_to_submit_the_form() and make it happen in under a half second).
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-02-02 Thread lillian

Yeah that's basically what I came up with between posting and seeing your 
reply, except I'm letting the code in my controller do the actual db update 
(its that same code used if the user had clicked on submit) and then I 
redirect based on what UI element called submit (submit button? do the 
normal thing.  Logout button? logout. etc.)

Does that make sense?  It works but I'm wondering if there might be issues 
I'm not aware of.  Kinda new to this type of programming :-/

On Friday, January 30, 2015 at 1:31:08 PM UTC-8, Niphlod wrote:
>
> the gist of it should be something like
>
> $(function() {
> $('a#thelogoutbutton').on('click', function(e) {
> e.preventDefault();
> if (code_to_submit_the_form() == 'everythingwentwell') {
> window.href = this.href;
> } else {
> managefailure();
> //optionally window.href = this.href
> } 
> })
> })
>
> as a general rule, it's not a "polite thing" to do to block on something 
> if the user presses "i want to go out of here", so be sure to do it as 
> switfly as possible (i.e. don't require a strict check on 
> code_to_submit_the_form() and make it happen in under a half second).
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Submit current form prior to logout?

2015-01-30 Thread lillian

Thanks for the reply.

Let's assume that the action is in fact a click on the "logout" button/menu 
item (I've looked into the onbeforeunload event already, ugh.); I'm not 
quite sure how to intercept the action.  Do I need to add a handler to the 
menu item, have it call form.submit(), do the right things in my controller 
and then finally call logout by hand?  Or is there a "better" way to do it?

lillian


On Thursday, January 29, 2015 at 12:39:57 PM UTC-8, Niphlod wrote:
>
> if the "log out" is an event, like a click on the "logout" button, you can 
> intercept it, issue a submit with javascript and then actually logout the 
> user... if you're good with javascript-fu, the user won't notice it. 
> If instead the "log out" is the user closing the window, YMMV. You can 
> hook up to the "beforeonload" event, but it's quite nasty because:
> - you'd have to work your way through other stuff (the event is raised 
> also on form submits, user clicking on a link that leads to another page, 
> etc)
> - a big alarm gets raised (you surely noticed some of them on the 
> internet, like "the page is asking: are you sure you want to leave this 
> page?")
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Passing python string to javascript

2015-01-29 Thread lillian
Jose,

You are missing quotes:

var v='{{=variable}}';

In your code js thinks HOLA is an object.  If you don't want to use quotes 
on the js side you need to use extra ones in python and prevent them from 
being escaped:

variable = XML("'HOLA'")

This will get you 'HOLA' in js.  If you don't use the XML() handler you 
will get 'HOLA'

That's my assessment of the situation anyways.  Better answers are probably 
out there ;-)

lillian

On Wednesday, January 28, 2015 at 3:04:23 PM UTC-8, José Eloy wrote:
>
> Hello!
>
> How can I pass a python string to javascript? I know how to pass an 
> integer variable to javascript.
>
> Example:
>
> def pass_variable():
> variable = 25
> return dict(variable=variable)
>
> In the view:
> 
>var v={{=variable}};
>console.log(v);
> 
>
> If I pass a integer variable, javascript receive it well, but if I pass a 
> string, javascript doesn't recognize it. 
>
> Now, let's assume that we use variable = "HOLA"
>
> I get the error: (using Firefox console)
> ---
> ReferenceError: HOLA is not defined
> var v = HOLA;
> ---
> What am I doing wrong?
>
> Regards.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Submit current form prior to logout?

2015-01-29 Thread lillian
Hello,

Imagine a page that has a form with many fields to fill out.  A user (who 
must be logged in to use the app)  fills out the form and then logs out 
before clicking submit.  Is it possible to submit those changes ahead of 
the logout?

Thanks!

lillian

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.