[web2py:32655] Re: why doesn't this ajax call work? [RESOLVED -- updated web2py_ajax.html]

2009-10-11 Thread Iceberg

On Oct11, 12:24pm, weheh  wrote:
>
> So caveat emptor: if you're working on ajax, make sure your views
> folder has an updated version of web2py_ajax.html.
>
> In general, this may be an issue about releasing newer versions of
> web2py because the apps aren't updated automatically. Perhaps the ajax
> include should be one level up from apps?

Perhaps not. An old app works with old web2py_ajax.html (and its
corresponding style.css etc.), but not necessarily with the latest
web2py_ajax.html (and its corresponding base.css etc).

In other word, web2py_ajax.html and those css and js files are within
app level, which means a good thing - they can evolute without
affecting old apps, and a bad thing - you need to migrate to latest
web2py_ajax.html manually.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32656] Re: SELECT - UTF-8 errors

2009-10-11 Thread Iceberg

Your default setting does NOT mean the data you put into db IS utf8.
Try digging out what content you inserted chokes. Are they really in
utf8? Note that unicode is NOT utf8. Hope this info can give a right
direction.

On Oct11, 2:39pm, leone  wrote:
> Yes, I have added .encode('utf8') to my default
>
> Field('subject','text', default=u''.encode('utf8')),
>
> On 11 Ott, 01:53, Iceberg  wrote:
>
>
>
> > On Oct11, 3:42am, leone  wrote:
>
> > > I have same string inserted in a table.
> > > When I select them, I debug this error:
>
> > > File "/xx/xx/web2py/web2py/gluon/sql.py", line 2235, in
> > > response
> > >     return self._db._cursor.fetchall()
> > > OperationalError: Could not decode to UTF-8 column 'subject' with text
> > > 'x i xxx'
>
> > > This is a problem of sql.py module. What can I do?
> > > Thanks
>
> > Did you ever try searching "utf8" in this group or in google? That is
> > very likely a common utf8 issue. See this.
>
> >http://groups.google.com/group/web2py/browse_frm/thread/e9bc715d7d10458a
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32657] Re: A simple patch to provide upload progress

2009-10-11 Thread mdipierro

Would you post a web2pyslice on this?

Massimo

On Oct 10, 5:14 pm, AndCycle  wrote:
> @Massiom
>
> http://pastebin.com/f69e7b008
>
> here is the patch include a working sample,
> by the way you got another indent error in copystream_progress :p
>
> On Oct 11, 3:43 am, mdipierro  wrote:
>
> > @AndCycle
>
> > I rearranged the code in trunk a bit. Could you check it still works?
> > Thanks again.
>
> > Massimo
>
> > On Oct 8, 5:14 am, AndCycle  wrote:
>
> > > thanks :)
>
> > > I will take some free time to write a example base on trunk :p
>
> > > On Oct 7, 10:24 pm, mdipierro  wrote:
>
> > > > Check again. I added it now.
>
> > > > On Oct 7, 6:42 am, AndCycle  wrote:
>
> > > > > oops, the patch been cut by width restriction on mailing list lol
>
> > > > > here is pastebinhttp://pastebin.com/f219d603b
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32658] Re: New slice on Setting up Paypal

2009-10-11 Thread mdipierro

I posted a reddit link to the article. I hope it is ok.

If you want to have your company listed under the web2py support page,
just send me a personal email with some info about it.

Massimo

On Oct 10, 2:04 am, Benigno  wrote:
> Hello,
>
>    I have posted a slice on Setting up Paypal with Web2py. You can
> find it here:
>
> http://www.web2pyslices.com/main/slices/take_slice/9
>
>    I will be posting a better formated document with some images to
> better understand it shortly.
>
>    One thing though, this was tested and programmed about 4 months
> ago, since then, Paypal has changed some of its APIs it seems, and
> some of the message names may have changed or no longer be available.
> This should be pretty basic to detect though.
>
> Best regards,
> Benigno.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32659] using a calculation in a requires validator

2009-10-11 Thread Michael - afewtips.com

Hi,
I need to do this

   ( db.field % .25 == 0 )

calculation on a field entered into a form.

Do I need to create a function that checks (what?) or can it be
entered directly in the
db definition?

Thanks
Michael
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32660] Re: using a calculation in a requires validator

2009-10-11 Thread Iceberg

On Oct11, 7:23pm, "Michael - afewtips.com"  wrote:
> Hi,
> I need to do this
>
>    ( db.field % .25 == 0 )
>
> calculation on a field entered into a form.
>
> Do I need to create a function that checks (what?) or can it be
> entered directly in the
> db definition?
>
> Thanks
> Michael

Yes, you can define a function as the onvalidation callback for
SQLFORM or for Crud.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32661] Need help with an ajax call

2009-10-11 Thread weheh

I'm doing an ajax call that returns back a bunch of stuff including
html and multiple javascripts. I want the html presented as is and the
javascripts evaluated. All of it gets sent to a single target.

The call looks like this:
 DIV(...page-within-a-page with many subdivs and
javascripts ...,_id='target')
 DIV(
   A(link_text,
 _href='#',
 _id=id,
 _onclick="ajax('get_selection,['%s'],':eval');" % id
 ),
   ),

The getselection controller looks like this:

def get_selection():
  selection = db(...).select(...)
  text = ... open and read a file of text or html ...
  form = FORM(...)
  return "jQuery('#target').html(%s);" % get_page(selection,text,form)

where get_page builds a complex page-within-a-page with javascript
rollover buttons and a javascript-driven control.

Problem is, everything is getting evaluated. So any single quotes in
the text screw things up. How can this be done so that the text comes
out as text and the javascript as an evaluated javascript?

Originally, I tried just returning everything as html and stuffing it
into the target div, but my javascripts didn't work any more, even
though they were declared outside the target div. Can anyone explain
why those javascripts wouldn't work after an ajax call and return?

I'm a novice ajax user, so any insights into what is going on with the
DOM during the ajax calling process would be helpful.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32662] Re: using a calculation in a requires validator

2009-10-11 Thread Michael - afewtips.com

Thanks - I checked the manual more and used:
requires=IS_EXPR('float(value) % .25 == 0',error_message=T('Error in
value'))

But on a similar note, where would I put global functions?
add a module with the custom functions?

Thanks
Michael

On Oct 11, 9:44 am, Iceberg  wrote:
> On Oct11, 7:23pm, "Michael - afewtips.com"  wrote:
>
> > Hi,
> > I need to do this
>
> >    ( db.field % .25 == 0 )
>
> > calculation on a field entered into a form.
>
> > Do I need to create a function that checks (what?) or can it be
> > entered directly in the
> > db definition?
>
> > Thanks
> > Michael
>
> Yes, you can define a function as the onvalidation callback for
> SQLFORM or for Crud.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32663] Re: Need help with an ajax call

2009-10-11 Thread mdipierro

It depends on what get_page(selection,text,form)  does

try one of the following:

  import gluon.contrib.simplejson as sj

  return "jQuery('#target').html(%s);" % sj.dumps(str(get_page
(selection,text,form)))
  return "jQuery('#target').html(%s);" % sj.dumps(repr(get_page
(selection,text,form)))
  return "jQuery('#target').html('%s');" % sj.dumps(str(get_page
(selection,text,form)))
  return "jQuery('#target').html('%s');" % sj.dumps(repr(get_page
(selection,text,form)))
  return 'jQuery("#target").html("%s");' % sj.dumps(str(get_page
(selection,text,form)))
  return 'jQuery("#target").html("%s");' % sj.dumps(repr(get_page
(selection,text,form)))



On Oct 11, 9:08 am, weheh  wrote:
> I'm doing an ajax call that returns back a bunch of stuff including
> html and multiple javascripts. I want the html presented as is and the
> javascripts evaluated. All of it gets sent to a single target.
>
> The call looks like this:
>  DIV(...page-within-a-page with many subdivs and
> javascripts ...,_id='target')
>  DIV(
>    A(link_text,
>      _href='#',
>      _id=id,
>      _onclick="ajax('get_selection,['%s'],':eval');" % id
>      ),
>    ),
>
> The getselection controller looks like this:
>
> def get_selection():
>   selection = db(...).select(...)
>   text = ... open and read a file of text or html ...
>   form = FORM(...)
>   return "jQuery('#target').html(%s);" % get_page(selection,text,form)
>
> where get_page builds a complex page-within-a-page with javascript
> rollover buttons and a javascript-driven control.
>
> Problem is, everything is getting evaluated. So any single quotes in
> the text screw things up. How can this be done so that the text comes
> out as text and the javascript as an evaluated javascript?
>
> Originally, I tried just returning everything as html and stuffing it
> into the target div, but my javascripts didn't work any more, even
> though they were declared outside the target div. Can anyone explain
> why those javascripts wouldn't work after an ajax call and return?
>
> I'm a novice ajax user, so any insights into what is going on with the
> DOM during the ajax calling process would be helpful.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32664] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread Web2py-SuperFan

I really like that suggestion, would be much cleaner code and easier
to configure different styles that have meaning by variable name

On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
> I wonder if we could encapsulate, simplify this with a decorator, something
> like:
>
> @button( color='white', background='blue', font='bold' )
> form = crud.create(...)
>
> Something like this could be useful for something like
>
> @button( my_admin_style )
> form = crud.create()
>
> @button( my_warning_style )
> form = ...
>
>  just thinking out loud
>
> On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan wrote:
>
>
>
>
>
> > took me a while to dig up the answer/solution, maybe can save someone
> > else some time
>
> >    form = crud.create(...)
> >    form=DIV(
> >      form,
> >      SCRIPT('''$(document).ready(function() {
> >      $("input[type=submit]").val("Share");
> >      });'''),
> >      SCRIPT('''$(document).ready(function() {
> >      $("input[type=submit]").css({
> >      color:'white',
> >      background:'blue',
> >      font: 'bold'});
> >      });'''),
> >       )
>
> >     return dict(form=form)- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32665] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

I do not think you cannot use decorators this way.
But I remind you crud.create is a function that returns  SQLFORM which
is a FORM which is a heper as any other helper. Therefore you can do:

form = crud.create(...)
form['_style']="color:white; background-color:blue; font-weight:bold"



On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> I really like that suggestion, would be much cleaner code and easier
> to configure different styles that have meaning by variable name
>
> On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > I wonder if we could encapsulate, simplify this with a decorator, something
> > like:
>
> > @button( color='white', background='blue', font='bold' )
> > form = crud.create(...)
>
> > Something like this could be useful for something like
>
> > @button( my_admin_style )
> > form = crud.create()
>
> > @button( my_warning_style )
> > form = ...
>
> >  just thinking out loud
>
> > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan wrote:
>
> > > took me a while to dig up the answer/solution, maybe can save someone
> > > else some time
>
> > >    form = crud.create(...)
> > >    form=DIV(
> > >      form,
> > >      SCRIPT('''$(document).ready(function() {
> > >      $("input[type=submit]").val("Share");
> > >      });'''),
> > >      SCRIPT('''$(document).ready(function() {
> > >      $("input[type=submit]").css({
> > >      color:'white',
> > >      background:'blue',
> > >      font: 'bold'});
> > >      });'''),
> > >       )
>
> > >     return dict(form=form)- Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32666] Re: Need help with an ajax call

2009-10-11 Thread weheh

Massimo, I tried all your callbacks and none of them can render
get_page. I should have noted that get_page is the exact same function
that I use to successfully render the sub-page initially when the user
clicks on the link that takes them to this particular page.

That said, the text portion of get_page is rendered correctly by the
following callbacks:

  return "jQuery('#target').html(%s);" % repr(text)
  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
and this works, too, but ' is quoted \'
  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))

I would never have thought to invoke sj.dumps to do the job of
rendering the text. I'm curious why this should even work?

get_page calls a function show_buttons() that generates the buttons on
the page. These are rollover-type buttons with a sharethis button,
which is javascript. Taking, the divide and conquer approach to
debugging the problem, I also tried the following callbacks, with the
results shown as comments below. None of the javascripts worked to
render the buttons.

  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
missing } in sharethis javascript
  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
nothing renders, error "missing = in XML attribute"
  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
#fails: only sharethis button renders, but sharethis function not
defined when you click on the button. None of the css rollover buttons
render. And rest of webpage is mysteriously cleared.
  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
())) #fails: Nothing renders, but target is cleared.
  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
())) #fails: nothing renders, error: "missing ) after argument list"
  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
())) #fails: renders pair of double quotes "" in target div
  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
())) #fails: nothing renders, error: "missing ) after argument list"
  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
())) #fails: nothing renders, error: "missing ) after argument list"

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



[web2py:32667] Re: A simple patch to provide upload progress

2009-10-11 Thread Yarko Tymciurak
just to complete the link (I didn't immediately find web2pyslice searching
the group):
http://www.web2pyslices.com/main/default/index

On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  wrote:

>
> Would you post a web2pyslice on this?
>
> Massimo
>
> On Oct 10, 5:14 pm, AndCycle  wrote:
> > @Massiom
> >
> > http://pastebin.com/f69e7b008
> >
> > here is the patch include a working sample,
> > by the way you got another indent error in copystream_progress :p
> >
> > On Oct 11, 3:43 am, mdipierro  wrote:
> >
> > > @AndCycle
> >
> > > I rearranged the code in trunk a bit. Could you check it still works?
> > > Thanks again.
> >
> > > Massimo
> >
> > > On Oct 8, 5:14 am, AndCycle  wrote:
> >
> > > > thanks :)
> >
> > > > I will take some free time to write a example base on trunk :p
> >
> > > > On Oct 7, 10:24 pm, mdipierro  wrote:
> >
> > > > > Check again. I added it now.
> >
> > > > > On Oct 7, 6:42 am, AndCycle 
> wrote:
> >
> > > > > > oops, the patch been cut by width restriction on mailing list lol
> >
> > > > > > here is pastebinhttp://pastebin.com/f219d603b
> >
>

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



[web2py:32668] Re: Need help with an ajax call

2009-10-11 Thread Thadeus Burgess
I would think that your function, is returning a qoute of some sort, which
is canceling out the qoute around .html, which is throwing off the
javascript errors.

this

'jQuery("#target").html("%s");' % (' this is a strong
sentence that breaks the javascript wrote:

>
> Massimo, I tried all your callbacks and none of them can render
> get_page. I should have noted that get_page is the exact same function
> that I use to successfully render the sub-page initially when the user
> clicks on the link that takes them to this particular page.
>
> That said, the text portion of get_page is rendered correctly by the
> following callbacks:
>
>  return "jQuery('#target').html(%s);" % repr(text)
>  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> and this works, too, but ' is quoted \'
>  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> I would never have thought to invoke sj.dumps to do the job of
> rendering the text. I'm curious why this should even work?
>
> get_page calls a function show_buttons() that generates the buttons on
> the page. These are rollover-type buttons with a sharethis button,
> which is javascript. Taking, the divide and conquer approach to
> debugging the problem, I also tried the following callbacks, with the
> results shown as comments below. None of the javascripts worked to
> render the buttons.
>
>  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> missing } in sharethis javascript
>  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> nothing renders, error "missing = in XML attribute"
>  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> #fails: only sharethis button renders, but sharethis function not
> defined when you click on the button. None of the css rollover buttons
> render. And rest of webpage is mysteriously cleared.
>  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> ())) #fails: Nothing renders, but target is cleared.
>  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> ())) #fails: renders pair of double quotes "" in target div
>  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
> ())) #fails: nothing renders, error: "missing ) after argument list"
>
> >
>

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



[web2py:32669] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread Yarko Tymciurak
On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  wrote:

>
> I do not think you cannot use decorators this way.
>

double negatives not sure what you intended to say (but logical analysis
says "... think you can use decorators this way...");


> But I remind you crud.create is a function that returns  SQLFORM which
> is a FORM which is a heper as any other helper. Therefore you can do:
>
> form = crud.create(...)
> form['_style']="color:white; background-color:blue; font-weight:bold"
>

Good point - and addresses the original post (as it could have been more
simply done this way);

Regardless, then

@style( color='white', background-color='blue', font-weight='bold')
form = crud.create(...)

would still be a readable thing (and just trivial to implement);

Alternatively, form.style( ...same kinds of parameters)   could be used;

Anyway, this is about readability, and ease of infding this stuff (as this
post shows);

If there were a member function to FORM to set style, people who not have to
stumble upon it.

Thoughts?


>
>
> On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > I really like that suggestion, would be much cleaner code and easier
> > to configure different styles that have meaning by variable name
> >
> > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
> >
> > > I wonder if we could encapsulate, simplify this with a decorator,
> something
> > > like:
> >
> > > @button( color='white', background='blue', font='bold' )
> > > form = crud.create(...)
> >
> > > Something like this could be useful for something like
> >
> > > @button( my_admin_style )
> > > form = crud.create()
> >
> > > @button( my_warning_style )
> > > form = ...
> >
> > >  just thinking out loud
> >
> > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan  >wrote:
> >
> > > > took me a while to dig up the answer/solution, maybe can save someone
> > > > else some time
> >
> > > >form = crud.create(...)
> > > >form=DIV(
> > > >  form,
> > > >  SCRIPT('''$(document).ready(function() {
> > > >  $("input[type=submit]").val("Share");
> > > >  });'''),
> > > >  SCRIPT('''$(document).ready(function() {
> > > >  $("input[type=submit]").css({
> > > >  color:'white',
> > > >  background:'blue',
> > > >  font: 'bold'});
> > > >  });'''),
> > > >   )
> >
> > > > return dict(form=form)- Hide quoted text -
> >
> > > - Show quoted text -
> >
>

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



[web2py:32670] Re: Need help with an ajax call

2009-10-11 Thread mdipierro

assuming s is valid html you can also try
'jQuery("#target").html("%s");' % s.replace('"','\\"')

On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
> I would think that your function, is returning a qoute of some sort, which
> is canceling out the qoute around .html, which is throwing off the
> javascript errors.
>
> this
>
> 'jQuery("#target").html("%s");' % (' this is a strong
> sentence that breaks the javascript
> Notice the qoutes where it defines class=. Try  changing all double qoutes
> to single qoutes, see if that fixes your problem.
>
> I ran into this as well, and single qoutes in the html fixed my problem.
>
> -Thadeus
>
> On Sun, Oct 11, 2009 at 11:33 AM, weheh  wrote:
>
> > Massimo, I tried all your callbacks and none of them can render
> > get_page. I should have noted that get_page is the exact same function
> > that I use to successfully render the sub-page initially when the user
> > clicks on the link that takes them to this particular page.
>
> > That said, the text portion of get_page is rendered correctly by the
> > following callbacks:
>
> >  return "jQuery('#target').html(%s);" % repr(text)
> >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > and this works, too, but ' is quoted \'
> >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > I would never have thought to invoke sj.dumps to do the job of
> > rendering the text. I'm curious why this should even work?
>
> > get_page calls a function show_buttons() that generates the buttons on
> > the page. These are rollover-type buttons with a sharethis button,
> > which is javascript. Taking, the divide and conquer approach to
> > debugging the problem, I also tried the following callbacks, with the
> > results shown as comments below. None of the javascripts worked to
> > render the buttons.
>
> >  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> > missing } in sharethis javascript
> >  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> > nothing renders, error "missing = in XML attribute"
> >  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> > #fails: only sharethis button renders, but sharethis function not
> > defined when you click on the button. None of the css rollover buttons
> > render. And rest of webpage is mysteriously cleared.
> >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > ())) #fails: Nothing renders, but target is cleared.
> >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > ())) #fails: nothing renders, error: "missing ) after argument list"
> >  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> > ())) #fails: renders pair of double quotes "" in target div
> >  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> > ())) #fails: nothing renders, error: "missing ) after argument list"
> >  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
> > ())) #fails: nothing renders, error: "missing ) after argument list"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32671] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

Sorry the double negative was a mistake.

I know you can decorate a function call. I do not think you can define
a decorator for an assignment.

Massimo

On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
> On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  wrote:
>
> > I do not think you cannot use decorators this way.
>
> double negatives not sure what you intended to say (but logical analysis
> says "... think you can use decorators this way...");
>
> > But I remind you crud.create is a function that returns  SQLFORM which
> > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > form = crud.create(...)
> > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> Good point - and addresses the original post (as it could have been more
> simply done this way);
>
> Regardless, then
>
> @style( color='white', background-color='blue', font-weight='bold')
> form = crud.create(...)
>
> would still be a readable thing (and just trivial to implement);
>
> Alternatively, form.style( ...same kinds of parameters)   could be used;
>
> Anyway, this is about readability, and ease of infding this stuff (as this
> post shows);
>
> If there were a member function to FORM to set style, people who not have to
> stumble upon it.
>
> Thoughts?
>
>
>
> > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > I really like that suggestion, would be much cleaner code and easier
> > > to configure different styles that have meaning by variable name
>
> > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > I wonder if we could encapsulate, simplify this with a decorator,
> > something
> > > > like:
>
> > > > @button( color='white', background='blue', font='bold' )
> > > > form = crud.create(...)
>
> > > > Something like this could be useful for something like
>
> > > > @button( my_admin_style )
> > > > form = crud.create()
>
> > > > @button( my_warning_style )
> > > > form = ...
>
> > > >  just thinking out loud
>
> > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan  > >wrote:
>
> > > > > took me a while to dig up the answer/solution, maybe can save someone
> > > > > else some time
>
> > > > >    form = crud.create(...)
> > > > >    form=DIV(
> > > > >      form,
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("input[type=submit]").val("Share");
> > > > >      });'''),
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("input[type=submit]").css({
> > > > >      color:'white',
> > > > >      background:'blue',
> > > > >      font: 'bold'});
> > > > >      });'''),
> > > > >       )
>
> > > > >     return dict(form=form)- Hide quoted text -
>
> > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32672] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mr.freeze

>Good point - and addresses the original post (as it could have been more
>simply done this way);

Not technically since this would affect everything inside the form and
not just the submit button.  What about a member function 'find' added
to XmlComponent or DIV (which I think most helpers inherit from) that
allows you to traverse the inner components and return the matching
components for given criteria.  The pseudo-code might look like this:

submit = form.components.find(XML.attribute("type")=="submit")[0]
submit['_style'] = "color:white; background-color:blue; font-
weight:bold"

On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
> On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  wrote:
>
> > I do not think you cannot use decorators this way.
>
> double negatives not sure what you intended to say (but logical analysis
> says "... think you can use decorators this way...");
>
> > But I remind you crud.create is a function that returns  SQLFORM which
> > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > form = crud.create(...)
> > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> Good point - and addresses the original post (as it could have been more
> simply done this way);
>
> Regardless, then
>
> @style( color='white', background-color='blue', font-weight='bold')
> form = crud.create(...)
>
> would still be a readable thing (and just trivial to implement);
>
> Alternatively, form.style( ...same kinds of parameters)   could be used;
>
> Anyway, this is about readability, and ease of infding this stuff (as this
> post shows);
>
> If there were a member function to FORM to set style, people who not have to
> stumble upon it.
>
> Thoughts?
>
>
>
> > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > I really like that suggestion, would be much cleaner code and easier
> > > to configure different styles that have meaning by variable name
>
> > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > I wonder if we could encapsulate, simplify this with a decorator,
> > something
> > > > like:
>
> > > > @button( color='white', background='blue', font='bold' )
> > > > form = crud.create(...)
>
> > > > Something like this could be useful for something like
>
> > > > @button( my_admin_style )
> > > > form = crud.create()
>
> > > > @button( my_warning_style )
> > > > form = ...
>
> > > >  just thinking out loud
>
> > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan  > >wrote:
>
> > > > > took me a while to dig up the answer/solution, maybe can save someone
> > > > > else some time
>
> > > > >    form = crud.create(...)
> > > > >    form=DIV(
> > > > >      form,
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("input[type=submit]").val("Share");
> > > > >      });'''),
> > > > >      SCRIPT('''$(document).ready(function() {
> > > > >      $("input[type=submit]").css({
> > > > >      color:'white',
> > > > >      background:'blue',
> > > > >      font: 'bold'});
> > > > >      });'''),
> > > > >       )
>
> > > > >     return dict(form=form)- Hide quoted text -
>
> > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32673] Re: Need help with an ajax call

2009-10-11 Thread weheh

I will try these suggestions but I doubt they will work as the
javascript portions of get_page have both single and double quoted
sections that probably can't be replaced without breaking the
javascript.

What's frustrating about jQuery and javascripted actions in context of
web development in general, and in this case, my web2py app, is that
they break the DRYness of my code. It seems like I always have to
write one set of page-rendering code for the initial page generation,
and then another set of html to generate the sub-sections of the page
that will be created in response to a javascript event. I really want
to render the different sections of the page from the same code at all
times. Does anyone have any insights into how to structure your code
to be DRY while still being able to pull off a page that can be
generated in its entirety by a straight URL call or in pieces by ajax
calls that target specific subsections of the page? It assumes a page
that has all sorts of different kinds of things, including css
widgets, straight html, and javascripts.

On Oct 11, 2:02 pm, mdipierro  wrote:
> assuming s is valid html you can also try
> 'jQuery("#target").html("%s");' % s.replace('"','\\"')
>
> On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
>
>
>
> > I would think that your function, is returning a qoute of some sort, which
> > is canceling out the qoute around .html, which is throwing off the
> > javascript errors.
>
> > this
>
> > 'jQuery("#target").html("%s");' % (' this is a strong
> > sentence that breaks the javascript
> > Notice the qoutes where it defines class=. Try  changing all double qoutes
> > to single qoutes, see if that fixes your problem.
>
> > I ran into this as well, and single qoutes in the html fixed my problem.
>
> > -Thadeus
>
> > On Sun, Oct 11, 2009 at 11:33 AM, weheh  wrote:
>
> > > Massimo, I tried all your callbacks and none of them can render
> > > get_page. I should have noted that get_page is the exact same function
> > > that I use to successfully render the sub-page initially when the user
> > > clicks on the link that takes them to this particular page.
>
> > > That said, the text portion of get_page is rendered correctly by the
> > > following callbacks:
>
> > >  return "jQuery('#target').html(%s);" % repr(text)
> > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > and this works, too, but ' is quoted \'
> > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > > I would never have thought to invoke sj.dumps to do the job of
> > > rendering the text. I'm curious why this should even work?
>
> > > get_page calls a function show_buttons() that generates the buttons on
> > > the page. These are rollover-type buttons with a sharethis button,
> > > which is javascript. Taking, the divide and conquer approach to
> > > debugging the problem, I also tried the following callbacks, with the
> > > results shown as comments below. None of the javascripts worked to
> > > render the buttons.
>
> > >  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> > > missing } in sharethis javascript
> > >  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> > > nothing renders, error "missing = in XML attribute"
> > >  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> > > #fails: only sharethis button renders, but sharethis function not
> > > defined when you click on the button. None of the css rollover buttons
> > > render. And rest of webpage is mysteriously cleared.
> > >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > > ())) #fails: Nothing renders, but target is cleared.
> > >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> > > ())) #fails: renders pair of double quotes "" in target div
> > >  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > >  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
> > > ())) #fails: nothing renders, error: "missing ) after argument list"- 
> > > Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32674] Re: Need help with an ajax call

2009-10-11 Thread mr.freeze

Massimo's last suggestion should work as it will escape quotes in the
output.  Have you considered using jQuery.load to populate the
subsections? http://docs.jquery.com/Ajax/load#urldatacallback


On Oct 11, 1:31 pm, weheh  wrote:
> I will try these suggestions but I doubt they will work as the
> javascript portions of get_page have both single and double quoted
> sections that probably can't be replaced without breaking the
> javascript.
>
> What's frustrating about jQuery and javascripted actions in context of
> web development in general, and in this case, my web2py app, is that
> they break the DRYness of my code. It seems like I always have to
> write one set of page-rendering code for the initial page generation,
> and then another set of html to generate the sub-sections of the page
> that will be created in response to a javascript event. I really want
> to render the different sections of the page from the same code at all
> times. Does anyone have any insights into how to structure your code
> to be DRY while still being able to pull off a page that can be
> generated in its entirety by a straight URL call or in pieces by ajax
> calls that target specific subsections of the page? It assumes a page
> that has all sorts of different kinds of things, including css
> widgets, straight html, and javascripts.
>
> On Oct 11, 2:02 pm, mdipierro  wrote:
>
> > assuming s is valid html you can also try
> > 'jQuery("#target").html("%s");' % s.replace('"','\\"')
>
> > On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
>
> > > I would think that your function, is returning a qoute of some sort, which
> > > is canceling out the qoute around .html, which is throwing off the
> > > javascript errors.
>
> > > this
>
> > > 'jQuery("#target").html("%s");' % (' this is a strong
> > > sentence that breaks the javascript
> > > Notice the qoutes where it defines class=. Try  changing all double qoutes
> > > to single qoutes, see if that fixes your problem.
>
> > > I ran into this as well, and single qoutes in the html fixed my problem.
>
> > > -Thadeus
>
> > > On Sun, Oct 11, 2009 at 11:33 AM, weheh  
> > > wrote:
>
> > > > Massimo, I tried all your callbacks and none of them can render
> > > > get_page. I should have noted that get_page is the exact same function
> > > > that I use to successfully render the sub-page initially when the user
> > > > clicks on the link that takes them to this particular page.
>
> > > > That said, the text portion of get_page is rendered correctly by the
> > > > following callbacks:
>
> > > >  return "jQuery('#target').html(%s);" % repr(text)
> > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > > and this works, too, but ' is quoted \'
> > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > > > I would never have thought to invoke sj.dumps to do the job of
> > > > rendering the text. I'm curious why this should even work?
>
> > > > get_page calls a function show_buttons() that generates the buttons on
> > > > the page. These are rollover-type buttons with a sharethis button,
> > > > which is javascript. Taking, the divide and conquer approach to
> > > > debugging the problem, I also tried the following callbacks, with the
> > > > results shown as comments below. None of the javascripts worked to
> > > > render the buttons.
>
> > > >  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> > > > missing } in sharethis javascript
> > > >  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> > > > nothing renders, error "missing = in XML attribute"
> > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> > > > #fails: only sharethis button renders, but sharethis function not
> > > > defined when you click on the button. None of the css rollover buttons
> > > > render. And rest of webpage is mysteriously cleared.
> > > >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > > > ())) #fails: Nothing renders, but target is cleared.
> > > >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> > > > ())) #fails: renders pair of double quotes "" in target div
> > > >  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> > > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > > >  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_buttons
> > > > ())) #fails: nothing renders, error: "missing ) after argument list"- 
> > > > Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, vi

[web2py:32675] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

It is there already

form.element(_type='submit')['_style']="color:white; background-
color:blue; font-weight:bold"

It only finds the first matching element.

On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> >Good point - and addresses the original post (as it could have been more
> >simply done this way);
>
> Not technically since this would affect everything inside the form and
> not just the submit button.  What about a member function 'find' added
> to XmlComponent or DIV (which I think most helpers inherit from) that
> allows you to traverse the inner components and return the matching
> components for given criteria.  The pseudo-code might look like this:
>
> submit = form.components.find(XML.attribute("type")=="submit")[0]
> submit['_style'] = "color:white; background-color:blue; font-
> weight:bold"
>
> On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  wrote:
>
> > > I do not think you cannot use decorators this way.
>
> > double negatives not sure what you intended to say (but logical analysis
> > says "... think you can use decorators this way...");
>
> > > But I remind you crud.create is a function that returns  SQLFORM which
> > > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > > form = crud.create(...)
> > > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> > Good point - and addresses the original post (as it could have been more
> > simply done this way);
>
> > Regardless, then
>
> > @style( color='white', background-color='blue', font-weight='bold')
> > form = crud.create(...)
>
> > would still be a readable thing (and just trivial to implement);
>
> > Alternatively, form.style( ...same kinds of parameters)   could be used;
>
> > Anyway, this is about readability, and ease of infding this stuff (as this
> > post shows);
>
> > If there were a member function to FORM to set style, people who not have to
> > stumble upon it.
>
> > Thoughts?
>
> > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > I really like that suggestion, would be much cleaner code and easier
> > > > to configure different styles that have meaning by variable name
>
> > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > I wonder if we could encapsulate, simplify this with a decorator,
> > > something
> > > > > like:
>
> > > > > @button( color='white', background='blue', font='bold' )
> > > > > form = crud.create(...)
>
> > > > > Something like this could be useful for something like
>
> > > > > @button( my_admin_style )
> > > > > form = crud.create()
>
> > > > > @button( my_warning_style )
> > > > > form = ...
>
> > > > >  just thinking out loud
>
> > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan  > > >wrote:
>
> > > > > > took me a while to dig up the answer/solution, maybe can save 
> > > > > > someone
> > > > > > else some time
>
> > > > > >    form = crud.create(...)
> > > > > >    form=DIV(
> > > > > >      form,
> > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > >      $("input[type=submit]").val("Share");
> > > > > >      });'''),
> > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > >      $("input[type=submit]").css({
> > > > > >      color:'white',
> > > > > >      background:'blue',
> > > > > >      font: 'bold'});
> > > > > >      });'''),
> > > > > >       )
>
> > > > > >     return dict(form=form)- Hide quoted text -
>
> > > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32676] Re: Need help with an ajax call

2009-10-11 Thread weheh

I was hoping to not have to get into the details of jQuery but I'm
coming to the conclusion that I'm going to have to do so. So, no, I
haven't considered using jQuery.load. But thanks for the pointer and
thanks, all, for the responses so far.

On Oct 11, 2:38 pm, "mr.freeze"  wrote:
> Massimo's last suggestion should work as it will escape quotes in the
> output.  Have you considered using jQuery.load to populate the
> subsections?http://docs.jquery.com/Ajax/load#urldatacallback
>
> On Oct 11, 1:31 pm, weheh  wrote:
>
>
>
> > I will try these suggestions but I doubt they will work as the
> > javascript portions of get_page have both single and double quoted
> > sections that probably can't be replaced without breaking the
> > javascript.
>
> > What's frustrating about jQuery and javascripted actions in context of
> > web development in general, and in this case, my web2py app, is that
> > they break the DRYness of my code. It seems like I always have to
> > write one set of page-rendering code for the initial page generation,
> > and then another set of html to generate the sub-sections of the page
> > that will be created in response to a javascript event. I really want
> > to render the different sections of the page from the same code at all
> > times. Does anyone have any insights into how to structure your code
> > to be DRY while still being able to pull off a page that can be
> > generated in its entirety by a straight URL call or in pieces by ajax
> > calls that target specific subsections of the page? It assumes a page
> > that has all sorts of different kinds of things, including css
> > widgets, straight html, and javascripts.
>
> > On Oct 11, 2:02 pm, mdipierro  wrote:
>
> > > assuming s is valid html you can also try
> > > 'jQuery("#target").html("%s");' % s.replace('"','\\"')
>
> > > On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
>
> > > > I would think that your function, is returning a qoute of some sort, 
> > > > which
> > > > is canceling out the qoute around .html, which is throwing off the
> > > > javascript errors.
>
> > > > this
>
> > > > 'jQuery("#target").html("%s");' % (' this is a strong
> > > > sentence that breaks the javascript
> > > > Notice the qoutes where it defines class=. Try  changing all double 
> > > > qoutes
> > > > to single qoutes, see if that fixes your problem.
>
> > > > I ran into this as well, and single qoutes in the html fixed my problem.
>
> > > > -Thadeus
>
> > > > On Sun, Oct 11, 2009 at 11:33 AM, weheh  
> > > > wrote:
>
> > > > > Massimo, I tried all your callbacks and none of them can render
> > > > > get_page. I should have noted that get_page is the exact same function
> > > > > that I use to successfully render the sub-page initially when the user
> > > > > clicks on the link that takes them to this particular page.
>
> > > > > That said, the text portion of get_page is rendered correctly by the
> > > > > following callbacks:
>
> > > > >  return "jQuery('#target').html(%s);" % repr(text)
> > > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > > > and this works, too, but ' is quoted \'
> > > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > > > > I would never have thought to invoke sj.dumps to do the job of
> > > > > rendering the text. I'm curious why this should even work?
>
> > > > > get_page calls a function show_buttons() that generates the buttons on
> > > > > the page. These are rollover-type buttons with a sharethis button,
> > > > > which is javascript. Taking, the divide and conquer approach to
> > > > > debugging the problem, I also tried the following callbacks, with the
> > > > > results shown as comments below. None of the javascripts worked to
> > > > > render the buttons.
>
> > > > >  return "jQuery('#target').html(%s);" % show_buttons() #fails: error
> > > > > missing } in sharethis javascript
> > > > >  return "jQuery('#target').html(%s);" % repr(show_buttons()) #fails:
> > > > > nothing renders, error "missing = in XML attribute"
> > > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(show_buttons()))
> > > > > #fails: only sharethis button renders, but sharethis function not
> > > > > defined when you click on the button. None of the css rollover buttons
> > > > > render. And rest of webpage is mysteriously cleared.
> > > > >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > > > > ())) #fails: Nothing renders, but target is cleared.
> > > > >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > > > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(show_buttons
> > > > > ())) #fails: renders pair of double quotes "" in target div
> > > > >  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> > > > > ())) #fails: nothing renders, error: "missing ) after argument list"
> > > > >  return 'jQuery("#target").html("%s");' % sj.dumps(repr(show_butto

[web2py:32677] Re: Need help with an ajax call

2009-10-11 Thread Thadeus Burgess
What about using response.render() to create the html?

This way you just have to write your html in your views?

return """
jQuery("#target").html("%s");
""" % (response.render(form=form).replace('"','\\"'))

-Thadeus




On Sun, Oct 11, 2009 at 1:38 PM, mr.freeze  wrote:

>
> Massimo's last suggestion should work as it will escape quotes in the
> output.  Have you considered using jQuery.load to populate the
> subsections? http://docs.jquery.com/Ajax/load#urldatacallback
>
>
> On Oct 11, 1:31 pm, weheh  wrote:
> > I will try these suggestions but I doubt they will work as the
> > javascript portions of get_page have both single and double quoted
> > sections that probably can't be replaced without breaking the
> > javascript.
> >
> > What's frustrating about jQuery and javascripted actions in context of
> > web development in general, and in this case, my web2py app, is that
> > they break the DRYness of my code. It seems like I always have to
> > write one set of page-rendering code for the initial page generation,
> > and then another set of html to generate the sub-sections of the page
> > that will be created in response to a javascript event. I really want
> > to render the different sections of the page from the same code at all
> > times. Does anyone have any insights into how to structure your code
> > to be DRY while still being able to pull off a page that can be
> > generated in its entirety by a straight URL call or in pieces by ajax
> > calls that target specific subsections of the page? It assumes a page
> > that has all sorts of different kinds of things, including css
> > widgets, straight html, and javascripts.
> >
> > On Oct 11, 2:02 pm, mdipierro  wrote:
> >
> > > assuming s is valid html you can also try
> > > 'jQuery("#target").html("%s");' % s.replace('"','\\"')
> >
> > > On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
> >
> > > > I would think that your function, is returning a qoute of some sort,
> which
> > > > is canceling out the qoute around .html, which is throwing off the
> > > > javascript errors.
> >
> > > > this
> >
> > > > 'jQuery("#target").html("%s");' % (' this is a
> strong
> > > > sentence that breaks the javascript >
> > > > Notice the qoutes where it defines class=. Try  changing all double
> qoutes
> > > > to single qoutes, see if that fixes your problem.
> >
> > > > I ran into this as well, and single qoutes in the html fixed my
> problem.
> >
> > > > -Thadeus
> >
> > > > On Sun, Oct 11, 2009 at 11:33 AM, weheh 
> wrote:
> >
> > > > > Massimo, I tried all your callbacks and none of them can render
> > > > > get_page. I should have noted that get_page is the exact same
> function
> > > > > that I use to successfully render the sub-page initially when the
> user
> > > > > clicks on the link that takes them to this particular page.
> >
> > > > > That said, the text portion of get_page is rendered correctly by
> the
> > > > > following callbacks:
> >
> > > > >  return "jQuery('#target').html(%s);" % repr(text)
> > > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > > > and this works, too, but ' is quoted \'
> > > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
> >
> > > > > I would never have thought to invoke sj.dumps to do the job of
> > > > > rendering the text. I'm curious why this should even work?
> >
> > > > > get_page calls a function show_buttons() that generates the buttons
> on
> > > > > the page. These are rollover-type buttons with a sharethis button,
> > > > > which is javascript. Taking, the divide and conquer approach to
> > > > > debugging the problem, I also tried the following callbacks, with
> the
> > > > > results shown as comments below. None of the javascripts worked to
> > > > > render the buttons.
> >
> > > > >  return "jQuery('#target').html(%s);" % show_buttons() #fails:
> error
> > > > > missing } in sharethis javascript
> > > > >  return "jQuery('#target').html(%s);" % repr(show_buttons())
> #fails:
> > > > > nothing renders, error "missing = in XML attribute"
> > > > >  return "jQuery('#target').html(%s);" %
> sj.dumps(str(show_buttons()))
> > > > > #fails: only sharethis button renders, but sharethis function not
> > > > > defined when you click on the button. None of the css rollover
> buttons
> > > > > render. And rest of webpage is mysteriously cleared.
> > > > >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > > > > ())) #fails: Nothing renders, but target is cleared.
> > > > >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > > > > ())) #fails: nothing renders, error: "missing ) after argument
> list"
> > > > >  return "jQuery('#target').html('%s');" %
> sj.dumps(repr(show_buttons
> > > > > ())) #fails: renders pair of double quotes "" in target div
> > > > >  return 'jQuery("#target").html("%s");' % sj.dumps(str(show_buttons
> > > > > ())) #fails: nothing renders, error: "missing ) after argument
> list"
> > > > >  return 'jQuery("#target").html("%s"

[web2py:32678] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mr.freeze

Nice! This would be doubly handy if it returned all matching
components (jQuery style).  What about adding a first=True arg to make
return all matches optional ? (or some other more graceful solution
that I'm sure you've already thought of before finishing this
sentence :)

def element(self, first=True, **kargs):
components = copy.copy(self.components)
matches = []
for c in components:
try:
components += copy.copy(c.components)
check = True
for (key, value) in kargs.items():
if c[key] != value:
check = False
if check:
if first:
return c
else:
matches.append(c)
except:
pass

if len(matches): return matches
return None


On Oct 11, 2:04 pm, mdipierro  wrote:
> It is there already
>
> form.element(_type='submit')['_style']="color:white; background-
> color:blue; font-weight:bold"
>
> It only finds the first matching element.
>
> On Oct 11, 1:16 pm, "mr.freeze"  wrote:
>
> > >Good point - and addresses the original post (as it could have been more
> > >simply done this way);
>
> > Not technically since this would affect everything inside the form and
> > not just the submit button.  What about a member function 'find' added
> > to XmlComponent or DIV (which I think most helpers inherit from) that
> > allows you to traverse the inner components and return the matching
> > components for given criteria.  The pseudo-code might look like this:
>
> > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > submit['_style'] = "color:white; background-color:blue; font-
> > weight:bold"
>
> > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  
> > > wrote:
>
> > > > I do not think you cannot use decorators this way.
>
> > > double negatives not sure what you intended to say (but logical 
> > > analysis
> > > says "... think you can use decorators this way...");
>
> > > > But I remind you crud.create is a function that returns  SQLFORM which
> > > > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > > > form = crud.create(...)
> > > > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> > > Good point - and addresses the original post (as it could have been more
> > > simply done this way);
>
> > > Regardless, then
>
> > > @style( color='white', background-color='blue', font-weight='bold')
> > > form = crud.create(...)
>
> > > would still be a readable thing (and just trivial to implement);
>
> > > Alternatively, form.style( ...same kinds of parameters)   could be 
> > > used;
>
> > > Anyway, this is about readability, and ease of infding this stuff (as this
> > > post shows);
>
> > > If there were a member function to FORM to set style, people who not have 
> > > to
> > > stumble upon it.
>
> > > Thoughts?
>
> > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > I really like that suggestion, would be much cleaner code and easier
> > > > > to configure different styles that have meaning by variable name
>
> > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > I wonder if we could encapsulate, simplify this with a decorator,
> > > > something
> > > > > > like:
>
> > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > form = crud.create(...)
>
> > > > > > Something like this could be useful for something like
>
> > > > > > @button( my_admin_style )
> > > > > > form = crud.create()
>
> > > > > > @button( my_warning_style )
> > > > > > form = ...
>
> > > > > >  just thinking out loud
>
> > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan 
> > > > > >  > > > >wrote:
>
> > > > > > > took me a while to dig up the answer/solution, maybe can save 
> > > > > > > someone
> > > > > > > else some time
>
> > > > > > >    form = crud.create(...)
> > > > > > >    form=DIV(
> > > > > > >      form,
> > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > >      $("input[type=submit]").val("Share");
> > > > > > >      });'''),
> > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > >      $("input[type=submit]").css({
> > > > > > >      color:'white',
> > > > > > >      background:'blue',
> > > > > > >      font: 'bold'});
> > > > > > >      });'''),
> > > > > > >       )
>
> > > > > > >     return dict(form=form)- Hide quoted text -
>
> > > > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~

[web2py:32679] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread Thadeus Burgess
What is wrong with using a .css file?

-Thadeus




On Sun, Oct 11, 2009 at 2:04 PM, mdipierro  wrote:

>
> It is there already
>
> form.element(_type='submit')['_style']="color:white; background-
> color:blue; font-weight:bold"
>
> It only finds the first matching element.
>
> On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> > >Good point - and addresses the original post (as it could have been more
> > >simply done this way);
> >
> > Not technically since this would affect everything inside the form and
> > not just the submit button.  What about a member function 'find' added
> > to XmlComponent or DIV (which I think most helpers inherit from) that
> > allows you to traverse the inner components and return the matching
> > components for given criteria.  The pseudo-code might look like this:
> >
> > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > submit['_style'] = "color:white; background-color:blue; font-
> > weight:bold"
> >
> > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
> >
> > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro 
> wrote:
> >
> > > > I do not think you cannot use decorators this way.
> >
> > > double negatives not sure what you intended to say (but logical
> analysis
> > > says "... think you can use decorators this way...");
> >
> > > > But I remind you crud.create is a function that returns  SQLFORM
> which
> > > > is a FORM which is a heper as any other helper. Therefore you can do:
> >
> > > > form = crud.create(...)
> > > > form['_style']="color:white; background-color:blue; font-weight:bold"
> >
> > > Good point - and addresses the original post (as it could have been
> more
> > > simply done this way);
> >
> > > Regardless, then
> >
> > > @style( color='white', background-color='blue', font-weight='bold')
> > > form = crud.create(...)
> >
> > > would still be a readable thing (and just trivial to implement);
> >
> > > Alternatively, form.style( ...same kinds of parameters)   could be
> used;
> >
> > > Anyway, this is about readability, and ease of infding this stuff (as
> this
> > > post shows);
> >
> > > If there were a member function to FORM to set style, people who not
> have to
> > > stumble upon it.
> >
> > > Thoughts?
> >
> > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > I really like that suggestion, would be much cleaner code and
> easier
> > > > > to configure different styles that have meaning by variable name
> >
> > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
> >
> > > > > > I wonder if we could encapsulate, simplify this with a decorator,
> > > > something
> > > > > > like:
> >
> > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > form = crud.create(...)
> >
> > > > > > Something like this could be useful for something like
> >
> > > > > > @button( my_admin_style )
> > > > > > form = crud.create()
> >
> > > > > > @button( my_warning_style )
> > > > > > form = ...
> >
> > > > > >  just thinking out loud
> >
> > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> mwkan...@gmail.com
> > > > >wrote:
> >
> > > > > > > took me a while to dig up the answer/solution, maybe can save
> someone
> > > > > > > else some time
> >
> > > > > > >form = crud.create(...)
> > > > > > >form=DIV(
> > > > > > >  form,
> > > > > > >  SCRIPT('''$(document).ready(function() {
> > > > > > >  $("input[type=submit]").val("Share");
> > > > > > >  });'''),
> > > > > > >  SCRIPT('''$(document).ready(function() {
> > > > > > >  $("input[type=submit]").css({
> > > > > > >  color:'white',
> > > > > > >  background:'blue',
> > > > > > >  font: 'bold'});
> > > > > > >  });'''),
> > > > > > >   )
> >
> > > > > > > return dict(form=form)- Hide quoted text -
> >
> > > > > > - Show quoted text -
> >
>

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



[web2py:32680] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mr.freeze

I think CSS is definitely the best way if you don't need this level of
dynamism and know all of the necessary selectors ahead of time.  But
if you wanted to style a form based on a runtime variable (auth
membership for example), or manipulate the form in any other way for
that matter, I think this is useful.

On Oct 11, 2:39 pm, Thadeus Burgess  wrote:
> What is wrong with using a .css file?
>
> -Thadeus
>
> On Sun, Oct 11, 2009 at 2:04 PM, mdipierro  wrote:
>
> > It is there already
>
> > form.element(_type='submit')['_style']="color:white; background-
> > color:blue; font-weight:bold"
>
> > It only finds the first matching element.
>
> > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> > > >Good point - and addresses the original post (as it could have been more
> > > >simply done this way);
>
> > > Not technically since this would affect everything inside the form and
> > > not just the submit button.  What about a member function 'find' added
> > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > allows you to traverse the inner components and return the matching
> > > components for given criteria.  The pseudo-code might look like this:
>
> > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > submit['_style'] = "color:white; background-color:blue; font-
> > > weight:bold"
>
> > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro 
> > wrote:
>
> > > > > I do not think you cannot use decorators this way.
>
> > > > double negatives not sure what you intended to say (but logical
> > analysis
> > > > says "... think you can use decorators this way...");
>
> > > > > But I remind you crud.create is a function that returns  SQLFORM
> > which
> > > > > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > > > > form = crud.create(...)
> > > > > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> > > > Good point - and addresses the original post (as it could have been
> > more
> > > > simply done this way);
>
> > > > Regardless, then
>
> > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > form = crud.create(...)
>
> > > > would still be a readable thing (and just trivial to implement);
>
> > > > Alternatively, form.style( ...same kinds of parameters)   could be
> > used;
>
> > > > Anyway, this is about readability, and ease of infding this stuff (as
> > this
> > > > post shows);
>
> > > > If there were a member function to FORM to set style, people who not
> > have to
> > > > stumble upon it.
>
> > > > Thoughts?
>
> > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > I really like that suggestion, would be much cleaner code and
> > easier
> > > > > > to configure different styles that have meaning by variable name
>
> > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > I wonder if we could encapsulate, simplify this with a decorator,
> > > > > something
> > > > > > > like:
>
> > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > form = crud.create(...)
>
> > > > > > > Something like this could be useful for something like
>
> > > > > > > @button( my_admin_style )
> > > > > > > form = crud.create()
>
> > > > > > > @button( my_warning_style )
> > > > > > > form = ...
>
> > > > > > >  just thinking out loud
>
> > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> > mwkan...@gmail.com
> > > > > >wrote:
>
> > > > > > > > took me a while to dig up the answer/solution, maybe can save
> > someone
> > > > > > > > else some time
>
> > > > > > > >    form = crud.create(...)
> > > > > > > >    form=DIV(
> > > > > > > >      form,
> > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > >      $("input[type=submit]").val("Share");
> > > > > > > >      });'''),
> > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > >      $("input[type=submit]").css({
> > > > > > > >      color:'white',
> > > > > > > >      background:'blue',
> > > > > > > >      font: 'bold'});
> > > > > > > >      });'''),
> > > > > > > >       )
>
> > > > > > > >     return dict(form=form)- Hide quoted text -
>
> > > > > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32681] .with_alias(..) not working (even in the dog.father, dog.mother example form slides)

2009-10-11 Thread Maciek Sykulski

Hi Everyone,

I'm using web2py Version 1.67.2 (2009-09-28 16:29:33)  with MySQL
and when I execute a following example I get an error.
in db.py:
 db.define_table("dog",
SQLField("name"),
SQLField("father_id", "reference dog"),
SQLField("mother_id", "reference dog"))
in index():
father=db.dog.with_alias("father")
mother=db.dog.with_alias("mother")
rows = db().select(db.dog.name, db.father.name, db.mother.name,
left=(db.father.on
(db.father.id==db.dog.father_id),
db.mother.on(db.mother.id==db.dog.mother_id)))
I get an error:
ProgrammingError: (1064, "You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 'LEFT JOIN dog ON dog.id=dog.father_id LEFT JOIN
dog ON dog.id=dog.mother_id' at line 1")

In fact the _select(...) on the query returns the following sql:
'SELECT dog.name, dog.name, dog.name FROM  LEFT JOIN dog ON
dog.id=dog.father_id LEFT JOIN dog ON dog.id=dog.mother_id;'
which does not have aliases inside?!?

I found this problem in my installation after trying to write my own
query using with_alias, and failed (I was getting queries without
aliases, that is: all aliases were the same original table in SQL)

Does anybody have a clue what might be going on here?
Is it only me, or the latest version of web2py? (I had the same with
1.66, upgraded and still same problem)

Thanks,
m
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32682] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

I would take a patch that defines elements (notice the -s) that
returns all matching elements.

On Oct 11, 2:36 pm, "mr.freeze"  wrote:
> Nice! This would be doubly handy if it returned all matching
> components (jQuery style).  What about adding a first=True arg to make
> return all matches optional ? (or some other more graceful solution
> that I'm sure you've already thought of before finishing this
> sentence :)
>
>     def element(self, first=True, **kargs):
>         components = copy.copy(self.components)
>         matches = []
>         for c in components:
>             try:
>                 components += copy.copy(c.components)
>                 check = True
>                 for (key, value) in kargs.items():
>                     if c[key] != value:
>                         check = False
>                 if check:
>                     if first:
>                         return c
>                     else:
>                         matches.append(c)
>             except:
>                 pass
>
>         if len(matches): return matches
>         return None
>
> On Oct 11, 2:04 pm, mdipierro  wrote:
>
> > It is there already
>
> > form.element(_type='submit')['_style']="color:white; background-
> > color:blue; font-weight:bold"
>
> > It only finds the first matching element.
>
> > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
>
> > > >Good point - and addresses the original post (as it could have been more
> > > >simply done this way);
>
> > > Not technically since this would affect everything inside the form and
> > > not just the submit button.  What about a member function 'find' added
> > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > allows you to traverse the inner components and return the matching
> > > components for given criteria.  The pseudo-code might look like this:
>
> > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > submit['_style'] = "color:white; background-color:blue; font-
> > > weight:bold"
>
> > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  
> > > > wrote:
>
> > > > > I do not think you cannot use decorators this way.
>
> > > > double negatives not sure what you intended to say (but logical 
> > > > analysis
> > > > says "... think you can use decorators this way...");
>
> > > > > But I remind you crud.create is a function that returns  SQLFORM which
> > > > > is a FORM which is a heper as any other helper. Therefore you can do:
>
> > > > > form = crud.create(...)
> > > > > form['_style']="color:white; background-color:blue; font-weight:bold"
>
> > > > Good point - and addresses the original post (as it could have been more
> > > > simply done this way);
>
> > > > Regardless, then
>
> > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > form = crud.create(...)
>
> > > > would still be a readable thing (and just trivial to implement);
>
> > > > Alternatively, form.style( ...same kinds of parameters)   could be 
> > > > used;
>
> > > > Anyway, this is about readability, and ease of infding this stuff (as 
> > > > this
> > > > post shows);
>
> > > > If there were a member function to FORM to set style, people who not 
> > > > have to
> > > > stumble upon it.
>
> > > > Thoughts?
>
> > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > I really like that suggestion, would be much cleaner code and easier
> > > > > > to configure different styles that have meaning by variable name
>
> > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > I wonder if we could encapsulate, simplify this with a decorator,
> > > > > something
> > > > > > > like:
>
> > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > form = crud.create(...)
>
> > > > > > > Something like this could be useful for something like
>
> > > > > > > @button( my_admin_style )
> > > > > > > form = crud.create()
>
> > > > > > > @button( my_warning_style )
> > > > > > > form = ...
>
> > > > > > >  just thinking out loud
>
> > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan 
> > > > > > >  > > > > >wrote:
>
> > > > > > > > took me a while to dig up the answer/solution, maybe can save 
> > > > > > > > someone
> > > > > > > > else some time
>
> > > > > > > >    form = crud.create(...)
> > > > > > > >    form=DIV(
> > > > > > > >      form,
> > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > >      $("input[type=submit]").val("Share");
> > > > > > > >      });'''),
> > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > >      $("input[type=submit]").css({
> > > > > > > >      color:'white',
> > > > > > > >      background:'blue',
> > > > > > > >      font: 'bold'});
> > > > > > > >      });'''),
> > > > > > > >       )
>
> > > > > > > >     return dict(form=form)- Hide quoted text -
>
> > > > > > > - Show quoted text -
--~--~-~--~~~---

[web2py:32683] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

I agree

On Oct 11, 2:58 pm, "mr.freeze"  wrote:
> I think CSS is definitely the best way if you don't need this level of
> dynamism and know all of the necessary selectors ahead of time.  But
> if you wanted to style a form based on a runtime variable (auth
> membership for example), or manipulate the form in any other way for
> that matter, I think this is useful.
>
> On Oct 11, 2:39 pm, Thadeus Burgess  wrote:
>
> > What is wrong with using a .css file?
>
> > -Thadeus
>
> > On Sun, Oct 11, 2009 at 2:04 PM, mdipierro  wrote:
>
> > > It is there already
>
> > > form.element(_type='submit')['_style']="color:white; background-
> > > color:blue; font-weight:bold"
>
> > > It only finds the first matching element.
>
> > > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> > > > >Good point - and addresses the original post (as it could have been 
> > > > >more
> > > > >simply done this way);
>
> > > > Not technically since this would affect everything inside the form and
> > > > not just the submit button.  What about a member function 'find' added
> > > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > > allows you to traverse the inner components and return the matching
> > > > components for given criteria.  The pseudo-code might look like this:
>
> > > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > > submit['_style'] = "color:white; background-color:blue; font-
> > > > weight:bold"
>
> > > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro 
> > > wrote:
>
> > > > > > I do not think you cannot use decorators this way.
>
> > > > > double negatives not sure what you intended to say (but logical
> > > analysis
> > > > > says "... think you can use decorators this way...");
>
> > > > > > But I remind you crud.create is a function that returns  SQLFORM
> > > which
> > > > > > is a FORM which is a heper as any other helper. Therefore you can 
> > > > > > do:
>
> > > > > > form = crud.create(...)
> > > > > > form['_style']="color:white; background-color:blue; 
> > > > > > font-weight:bold"
>
> > > > > Good point - and addresses the original post (as it could have been
> > > more
> > > > > simply done this way);
>
> > > > > Regardless, then
>
> > > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > > form = crud.create(...)
>
> > > > > would still be a readable thing (and just trivial to implement);
>
> > > > > Alternatively, form.style( ...same kinds of parameters)   could be
> > > used;
>
> > > > > Anyway, this is about readability, and ease of infding this stuff (as
> > > this
> > > > > post shows);
>
> > > > > If there were a member function to FORM to set style, people who not
> > > have to
> > > > > stumble upon it.
>
> > > > > Thoughts?
>
> > > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > > I really like that suggestion, would be much cleaner code and
> > > easier
> > > > > > > to configure different styles that have meaning by variable name
>
> > > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > > I wonder if we could encapsulate, simplify this with a 
> > > > > > > > decorator,
> > > > > > something
> > > > > > > > like:
>
> > > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > > form = crud.create(...)
>
> > > > > > > > Something like this could be useful for something like
>
> > > > > > > > @button( my_admin_style )
> > > > > > > > form = crud.create()
>
> > > > > > > > @button( my_warning_style )
> > > > > > > > form = ...
>
> > > > > > > >  just thinking out loud
>
> > > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> > > mwkan...@gmail.com
> > > > > > >wrote:
>
> > > > > > > > > took me a while to dig up the answer/solution, maybe can save
> > > someone
> > > > > > > > > else some time
>
> > > > > > > > >    form = crud.create(...)
> > > > > > > > >    form=DIV(
> > > > > > > > >      form,
> > > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > > >      $("input[type=submit]").val("Share");
> > > > > > > > >      });'''),
> > > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > > >      $("input[type=submit]").css({
> > > > > > > > >      color:'white',
> > > > > > > > >      background:'blue',
> > > > > > > > >      font: 'bold'});
> > > > > > > > >      });'''),
> > > > > > > > >       )
>
> > > > > > > > >     return dict(form=form)- Hide quoted text -
>
> > > > > > > > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32684] Re: A simple patch to provide upload progress

2009-10-11 Thread mdipierro

I am going to link it soon. I will take suggestions on the best way to
link it form the main page.

On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
> just to complete the link (I didn't immediately find web2pyslice searching
> the group):http://www.web2pyslices.com/main/default/index
>
> On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  wrote:
>
> > Would you post a web2pyslice on this?
>
> > Massimo
>
> > On Oct 10, 5:14 pm, AndCycle  wrote:
> > > @Massiom
>
> > >http://pastebin.com/f69e7b008
>
> > > here is the patch include a working sample,
> > > by the way you got another indent error in copystream_progress :p
>
> > > On Oct 11, 3:43 am, mdipierro  wrote:
>
> > > > @AndCycle
>
> > > > I rearranged the code in trunk a bit. Could you check it still works?
> > > > Thanks again.
>
> > > > Massimo
>
> > > > On Oct 8, 5:14 am, AndCycle  wrote:
>
> > > > > thanks :)
>
> > > > > I will take some free time to write a example base on trunk :p
>
> > > > > On Oct 7, 10:24 pm, mdipierro  wrote:
>
> > > > > > Check again. I added it now.
>
> > > > > > On Oct 7, 6:42 am, AndCycle 
> > wrote:
>
> > > > > > > oops, the patch been cut by width restriction on mailing list lol
>
> > > > > > > here is pastebinhttp://pastebin.com/f219d603b
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32685] Re: Need help with an ajax call

2009-10-11 Thread weheh

No, I'm afraid neither
  s=get_buttons()
  return 'jQuery("#target").html("%s");' % s.replace('"','\\"')
nor
  return """jQuery("#target").html("%s");""" % (response.render
(s).replace('"','\\"'))
do anything. Nothing is rendered.

On Oct 11, 3:31 pm, Thadeus Burgess  wrote:
> What about using response.render() to create the html?
>
> This way you just have to write your html in your views?
>
> return """
> jQuery("#target").html("%s");
> """ % (response.render(form=form).replace('"','\\"'))
>
> -Thadeus
>
>
>
> On Sun, Oct 11, 2009 at 1:38 PM, mr.freeze  wrote:
>
> > Massimo's last suggestion should work as it will escape quotes in the
> > output.  Have you considered using jQuery.load to populate the
> > subsections?http://docs.jquery.com/Ajax/load#urldatacallback
>
> > On Oct 11, 1:31 pm, weheh  wrote:
> > > I will try these suggestions but I doubt they will work as the
> > > javascript portions of get_page have both single and double quoted
> > > sections that probably can't be replaced without breaking the
> > > javascript.
>
> > > What's frustrating about jQuery and javascripted actions in context of
> > > web development in general, and in this case, my web2py app, is that
> > > they break the DRYness of my code. It seems like I always have to
> > > write one set of page-rendering code for the initial page generation,
> > > and then another set of html to generate the sub-sections of the page
> > > that will be created in response to a javascript event. I really want
> > > to render the different sections of the page from the same code at all
> > > times. Does anyone have any insights into how to structure your code
> > > to be DRY while still being able to pull off a page that can be
> > > generated in its entirety by a straight URL call or in pieces by ajax
> > > calls that target specific subsections of the page? It assumes a page
> > > that has all sorts of different kinds of things, including css
> > > widgets, straight html, and javascripts.
>
> > > On Oct 11, 2:02 pm, mdipierro  wrote:
>
> > > > assuming s is valid html you can also try
> > > > 'jQuery("#target").html("%s");' % s.replace('"','\\"')
>
> > > > On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
>
> > > > > I would think that your function, is returning a qoute of some sort,
> > which
> > > > > is canceling out the qoute around .html, which is throwing off the
> > > > > javascript errors.
>
> > > > > this
>
> > > > > 'jQuery("#target").html("%s");' % (' this is a
> > strong
> > > > > sentence that breaks the javascript
> > > > > Notice the qoutes where it defines class=. Try  changing all double
> > qoutes
> > > > > to single qoutes, see if that fixes your problem.
>
> > > > > I ran into this as well, and single qoutes in the html fixed my
> > problem.
>
> > > > > -Thadeus
>
> > > > > On Sun, Oct 11, 2009 at 11:33 AM, weheh 
> > wrote:
>
> > > > > > Massimo, I tried all your callbacks and none of them can render
> > > > > > get_page. I should have noted that get_page is the exact same
> > function
> > > > > > that I use to successfully render the sub-page initially when the
> > user
> > > > > > clicks on the link that takes them to this particular page.
>
> > > > > > That said, the text portion of get_page is rendered correctly by
> > the
> > > > > > following callbacks:
>
> > > > > >  return "jQuery('#target').html(%s);" % repr(text)
> > > > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > > > > and this works, too, but ' is quoted \'
> > > > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > > > > > I would never have thought to invoke sj.dumps to do the job of
> > > > > > rendering the text. I'm curious why this should even work?
>
> > > > > > get_page calls a function show_buttons() that generates the buttons
> > on
> > > > > > the page. These are rollover-type buttons with a sharethis button,
> > > > > > which is javascript. Taking, the divide and conquer approach to
> > > > > > debugging the problem, I also tried the following callbacks, with
> > the
> > > > > > results shown as comments below. None of the javascripts worked to
> > > > > > render the buttons.
>
> > > > > >  return "jQuery('#target').html(%s);" % show_buttons() #fails:
> > error
> > > > > > missing } in sharethis javascript
> > > > > >  return "jQuery('#target').html(%s);" % repr(show_buttons())
> > #fails:
> > > > > > nothing renders, error "missing = in XML attribute"
> > > > > >  return "jQuery('#target').html(%s);" %
> > sj.dumps(str(show_buttons()))
> > > > > > #fails: only sharethis button renders, but sharethis function not
> > > > > > defined when you click on the button. None of the css rollover
> > buttons
> > > > > > render. And rest of webpage is mysteriously cleared.
> > > > > >  return "jQuery('#target').html(%s);" % sj.dumps(repr(show_buttons
> > > > > > ())) #fails: Nothing renders, but target is cleared.
> > > > > >  return "jQuery('#target').html('%s');" % sj.dumps(str(show_buttons
> > > > > > ())) #fai

[web2py:32686] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread Thadeus Burgess
Then dynamically include different stylesheets?


{{if auth.is_logged_in():}}
@import "auth_form.css"
{{else:}}
@import "reg_form.css"
{{pass}}

-Thadeus




On Sun, Oct 11, 2009 at 2:58 PM, mr.freeze  wrote:

>
> I think CSS is definitely the best way if you don't need this level of
> dynamism and know all of the necessary selectors ahead of time.  But
> if you wanted to style a form based on a runtime variable (auth
> membership for example), or manipulate the form in any other way for
> that matter, I think this is useful.
>
> On Oct 11, 2:39 pm, Thadeus Burgess  wrote:
> > What is wrong with using a .css file?
> >
> > -Thadeus
> >
> > On Sun, Oct 11, 2009 at 2:04 PM, mdipierro 
> wrote:
> >
> > > It is there already
> >
> > > form.element(_type='submit')['_style']="color:white; background-
> > > color:blue; font-weight:bold"
> >
> > > It only finds the first matching element.
> >
> > > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> > > > >Good point - and addresses the original post (as it could have been
> more
> > > > >simply done this way);
> >
> > > > Not technically since this would affect everything inside the form
> and
> > > > not just the submit button.  What about a member function 'find'
> added
> > > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > > allows you to traverse the inner components and return the matching
> > > > components for given criteria.  The pseudo-code might look like this:
> >
> > > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > > submit['_style'] = "color:white; background-color:blue; font-
> > > > weight:bold"
> >
> > > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
> >
> > > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro <
> mdipie...@cs.depaul.edu>
> > > wrote:
> >
> > > > > > I do not think you cannot use decorators this way.
> >
> > > > > double negatives not sure what you intended to say (but logical
> > > analysis
> > > > > says "... think you can use decorators this way...");
> >
> > > > > > But I remind you crud.create is a function that returns  SQLFORM
> > > which
> > > > > > is a FORM which is a heper as any other helper. Therefore you can
> do:
> >
> > > > > > form = crud.create(...)
> > > > > > form['_style']="color:white; background-color:blue;
> font-weight:bold"
> >
> > > > > Good point - and addresses the original post (as it could have been
> > > more
> > > > > simply done this way);
> >
> > > > > Regardless, then
> >
> > > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > > form = crud.create(...)
> >
> > > > > would still be a readable thing (and just trivial to implement);
> >
> > > > > Alternatively, form.style( ...same kinds of parameters)   could
> be
> > > used;
> >
> > > > > Anyway, this is about readability, and ease of infding this stuff
> (as
> > > this
> > > > > post shows);
> >
> > > > > If there were a member function to FORM to set style, people who
> not
> > > have to
> > > > > stumble upon it.
> >
> > > > > Thoughts?
> >
> > > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > > I really like that suggestion, would be much cleaner code and
> > > easier
> > > > > > > to configure different styles that have meaning by variable
> name
> >
> > > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
> >
> > > > > > > > I wonder if we could encapsulate, simplify this with a
> decorator,
> > > > > > something
> > > > > > > > like:
> >
> > > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > > form = crud.create(...)
> >
> > > > > > > > Something like this could be useful for something like
> >
> > > > > > > > @button( my_admin_style )
> > > > > > > > form = crud.create()
> >
> > > > > > > > @button( my_warning_style )
> > > > > > > > form = ...
> >
> > > > > > > >  just thinking out loud
> >
> > > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> > > mwkan...@gmail.com
> > > > > > >wrote:
> >
> > > > > > > > > took me a while to dig up the answer/solution, maybe can
> save
> > > someone
> > > > > > > > > else some time
> >
> > > > > > > > >form = crud.create(...)
> > > > > > > > >form=DIV(
> > > > > > > > >  form,
> > > > > > > > >  SCRIPT('''$(document).ready(function() {
> > > > > > > > >  $("input[type=submit]").val("Share");
> > > > > > > > >  });'''),
> > > > > > > > >  SCRIPT('''$(document).ready(function() {
> > > > > > > > >  $("input[type=submit]").css({
> > > > > > > > >  color:'white',
> > > > > > > > >  background:'blue',
> > > > > > > > >  font: 'bold'});
> > > > > > > > >  });'''),
> > > > > > > > >   )
> >
> > > > > > > > > return dict(form=form)- Hide quoted text -
> >
> > > > > > > > - Show quoted text -
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.

[web2py:32687] Re: Need help with an ajax call

2009-10-11 Thread mdipierro

This may take forever. Can you show us what get_buttons() does and a
sample of its output that gives the problem?

Massimo

On Oct 11, 3:11 pm, weheh  wrote:
> No, I'm afraid neither
>   s=get_buttons()
>   return 'jQuery("#target").html("%s");' % s.replace('"','\\"')
> nor
>   return """jQuery("#target").html("%s");""" % (response.render
> (s).replace('"','\\"'))
> do anything. Nothing is rendered.
>
> On Oct 11, 3:31 pm, Thadeus Burgess  wrote:
>
> > What about using response.render() to create the html?
>
> > This way you just have to write your html in your views?
>
> > return """
> > jQuery("#target").html("%s");
> > """ % (response.render(form=form).replace('"','\\"'))
>
> > -Thadeus
>
> > On Sun, Oct 11, 2009 at 1:38 PM, mr.freeze  wrote:
>
> > > Massimo's last suggestion should work as it will escape quotes in the
> > > output.  Have you considered using jQuery.load to populate the
> > > subsections?http://docs.jquery.com/Ajax/load#urldatacallback
>
> > > On Oct 11, 1:31 pm, weheh  wrote:
> > > > I will try these suggestions but I doubt they will work as the
> > > > javascript portions of get_page have both single and double quoted
> > > > sections that probably can't be replaced without breaking the
> > > > javascript.
>
> > > > What's frustrating about jQuery and javascripted actions in context of
> > > > web development in general, and in this case, my web2py app, is that
> > > > they break the DRYness of my code. It seems like I always have to
> > > > write one set of page-rendering code for the initial page generation,
> > > > and then another set of html to generate the sub-sections of the page
> > > > that will be created in response to a javascript event. I really want
> > > > to render the different sections of the page from the same code at all
> > > > times. Does anyone have any insights into how to structure your code
> > > > to be DRY while still being able to pull off a page that can be
> > > > generated in its entirety by a straight URL call or in pieces by ajax
> > > > calls that target specific subsections of the page? It assumes a page
> > > > that has all sorts of different kinds of things, including css
> > > > widgets, straight html, and javascripts.
>
> > > > On Oct 11, 2:02 pm, mdipierro  wrote:
>
> > > > > assuming s is valid html you can also try
> > > > > 'jQuery("#target").html("%s");' % s.replace('"','\\"')
>
> > > > > On Oct 11, 12:04 pm, Thadeus Burgess  wrote:
>
> > > > > > I would think that your function, is returning a qoute of some sort,
> > > which
> > > > > > is canceling out the qoute around .html, which is throwing off the
> > > > > > javascript errors.
>
> > > > > > this
>
> > > > > > 'jQuery("#target").html("%s");' % (' this is a
> > > strong
> > > > > > sentence that breaks the javascript
> > > > > > Notice the qoutes where it defines class=. Try  changing all double
> > > qoutes
> > > > > > to single qoutes, see if that fixes your problem.
>
> > > > > > I ran into this as well, and single qoutes in the html fixed my
> > > problem.
>
> > > > > > -Thadeus
>
> > > > > > On Sun, Oct 11, 2009 at 11:33 AM, weheh 
> > > wrote:
>
> > > > > > > Massimo, I tried all your callbacks and none of them can render
> > > > > > > get_page. I should have noted that get_page is the exact same
> > > function
> > > > > > > that I use to successfully render the sub-page initially when the
> > > user
> > > > > > > clicks on the link that takes them to this particular page.
>
> > > > > > > That said, the text portion of get_page is rendered correctly by
> > > the
> > > > > > > following callbacks:
>
> > > > > > >  return "jQuery('#target').html(%s);" % repr(text)
> > > > > > >  return "jQuery('#target').html(%s);" % sj.dumps(str(text))
> > > > > > > and this works, too, but ' is quoted \'
> > > > > > >  return "jQuery('#target').html('%s');" % sj.dumps(repr(text))
>
> > > > > > > I would never have thought to invoke sj.dumps to do the job of
> > > > > > > rendering the text. I'm curious why this should even work?
>
> > > > > > > get_page calls a function show_buttons() that generates the 
> > > > > > > buttons
> > > on
> > > > > > > the page. These are rollover-type buttons with a sharethis button,
> > > > > > > which is javascript. Taking, the divide and conquer approach to
> > > > > > > debugging the problem, I also tried the following callbacks, with
> > > the
> > > > > > > results shown as comments below. None of the javascripts worked to
> > > > > > > render the buttons.
>
> > > > > > >  return "jQuery('#target').html(%s);" % show_buttons() #fails:
> > > error
> > > > > > > missing } in sharethis javascript
> > > > > > >  return "jQuery('#target').html(%s);" % repr(show_buttons())
> > > #fails:
> > > > > > > nothing renders, error "missing = in XML attribute"
> > > > > > >  return "jQuery('#target').html(%s);" %
> > > sj.dumps(str(show_buttons()))
> > > > > > > #fails: only sharethis button renders, but sharethis function not
> > > > > > > defined when you click on the butto

[web2py:32688] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mr.freeze

I sent you a patch. Same as 'element' but returns a list or None.

On Oct 11, 3:01 pm, mdipierro  wrote:
> I would take a patch that defines elements (notice the -s) that
> returns all matching elements.
>
> On Oct 11, 2:36 pm, "mr.freeze"  wrote:
>
> > Nice! This would be doubly handy if it returned all matching
> > components (jQuery style).  What about adding a first=True arg to make
> > return all matches optional ? (or some other more graceful solution
> > that I'm sure you've already thought of before finishing this
> > sentence :)
>
> >     def element(self, first=True, **kargs):
> >         components = copy.copy(self.components)
> >         matches = []
> >         for c in components:
> >             try:
> >                 components += copy.copy(c.components)
> >                 check = True
> >                 for (key, value) in kargs.items():
> >                     if c[key] != value:
> >                         check = False
> >                 if check:
> >                     if first:
> >                         return c
> >                     else:
> >                         matches.append(c)
> >             except:
> >                 pass
>
> >         if len(matches): return matches
> >         return None
>
> > On Oct 11, 2:04 pm, mdipierro  wrote:
>
> > > It is there already
>
> > > form.element(_type='submit')['_style']="color:white; background-
> > > color:blue; font-weight:bold"
>
> > > It only finds the first matching element.
>
> > > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
>
> > > > >Good point - and addresses the original post (as it could have been 
> > > > >more
> > > > >simply done this way);
>
> > > > Not technically since this would affect everything inside the form and
> > > > not just the submit button.  What about a member function 'find' added
> > > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > > allows you to traverse the inner components and return the matching
> > > > components for given criteria.  The pseudo-code might look like this:
>
> > > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > > submit['_style'] = "color:white; background-color:blue; font-
> > > > weight:bold"
>
> > > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro  
> > > > > wrote:
>
> > > > > > I do not think you cannot use decorators this way.
>
> > > > > double negatives not sure what you intended to say (but logical 
> > > > > analysis
> > > > > says "... think you can use decorators this way...");
>
> > > > > > But I remind you crud.create is a function that returns  SQLFORM 
> > > > > > which
> > > > > > is a FORM which is a heper as any other helper. Therefore you can 
> > > > > > do:
>
> > > > > > form = crud.create(...)
> > > > > > form['_style']="color:white; background-color:blue; 
> > > > > > font-weight:bold"
>
> > > > > Good point - and addresses the original post (as it could have been 
> > > > > more
> > > > > simply done this way);
>
> > > > > Regardless, then
>
> > > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > > form = crud.create(...)
>
> > > > > would still be a readable thing (and just trivial to implement);
>
> > > > > Alternatively, form.style( ...same kinds of parameters)   could 
> > > > > be used;
>
> > > > > Anyway, this is about readability, and ease of infding this stuff (as 
> > > > > this
> > > > > post shows);
>
> > > > > If there were a member function to FORM to set style, people who not 
> > > > > have to
> > > > > stumble upon it.
>
> > > > > Thoughts?
>
> > > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > > I really like that suggestion, would be much cleaner code and 
> > > > > > > easier
> > > > > > > to configure different styles that have meaning by variable name
>
> > > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > > I wonder if we could encapsulate, simplify this with a 
> > > > > > > > decorator,
> > > > > > something
> > > > > > > > like:
>
> > > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > > form = crud.create(...)
>
> > > > > > > > Something like this could be useful for something like
>
> > > > > > > > @button( my_admin_style )
> > > > > > > > form = crud.create()
>
> > > > > > > > @button( my_warning_style )
> > > > > > > > form = ...
>
> > > > > > > >  just thinking out loud
>
> > > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan 
> > > > > > > >  > > > > > >wrote:
>
> > > > > > > > > took me a while to dig up the answer/solution, maybe can save 
> > > > > > > > > someone
> > > > > > > > > else some time
>
> > > > > > > > >    form = crud.create(...)
> > > > > > > > >    form=DIV(
> > > > > > > > >      form,
> > > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > > >      $("input[type=submit]").val("Share");
> > > > > > > > >      });'''),
> > > > > > > > >      SCRIPT(

[web2py:32689] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mr.freeze

The example I gave was for auth membership.  Say you wanted to style
the form based on which group they were a member of.  You would need a
style sheet for each group.  Also, what would happen when a new group
was created?

On Oct 11, 3:24 pm, Thadeus Burgess  wrote:
> Then dynamically include different stylesheets?
>
> 
> {{if auth.is_logged_in():}}
> @import "auth_form.css"
> {{else:}}
> @import "reg_form.css"
> {{pass}}
> 
> -Thadeus
>
> On Sun, Oct 11, 2009 at 2:58 PM, mr.freeze  wrote:
>
> > I think CSS is definitely the best way if you don't need this level of
> > dynamism and know all of the necessary selectors ahead of time.  But
> > if you wanted to style a form based on a runtime variable (auth
> > membership for example), or manipulate the form in any other way for
> > that matter, I think this is useful.
>
> > On Oct 11, 2:39 pm, Thadeus Burgess  wrote:
> > > What is wrong with using a .css file?
>
> > > -Thadeus
>
> > > On Sun, Oct 11, 2009 at 2:04 PM, mdipierro 
> > wrote:
>
> > > > It is there already
>
> > > > form.element(_type='submit')['_style']="color:white; background-
> > > > color:blue; font-weight:bold"
>
> > > > It only finds the first matching element.
>
> > > > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
> > > > > >Good point - and addresses the original post (as it could have been
> > more
> > > > > >simply done this way);
>
> > > > > Not technically since this would affect everything inside the form
> > and
> > > > > not just the submit button.  What about a member function 'find'
> > added
> > > > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > > > allows you to traverse the inner components and return the matching
> > > > > components for given criteria.  The pseudo-code might look like this:
>
> > > > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > > > submit['_style'] = "color:white; background-color:blue; font-
> > > > > weight:bold"
>
> > > > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro <
> > mdipie...@cs.depaul.edu>
> > > > wrote:
>
> > > > > > > I do not think you cannot use decorators this way.
>
> > > > > > double negatives not sure what you intended to say (but logical
> > > > analysis
> > > > > > says "... think you can use decorators this way...");
>
> > > > > > > But I remind you crud.create is a function that returns  SQLFORM
> > > > which
> > > > > > > is a FORM which is a heper as any other helper. Therefore you can
> > do:
>
> > > > > > > form = crud.create(...)
> > > > > > > form['_style']="color:white; background-color:blue;
> > font-weight:bold"
>
> > > > > > Good point - and addresses the original post (as it could have been
> > > > more
> > > > > > simply done this way);
>
> > > > > > Regardless, then
>
> > > > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > > > form = crud.create(...)
>
> > > > > > would still be a readable thing (and just trivial to implement);
>
> > > > > > Alternatively, form.style( ...same kinds of parameters)   could
> > be
> > > > used;
>
> > > > > > Anyway, this is about readability, and ease of infding this stuff
> > (as
> > > > this
> > > > > > post shows);
>
> > > > > > If there were a member function to FORM to set style, people who
> > not
> > > > have to
> > > > > > stumble upon it.
>
> > > > > > Thoughts?
>
> > > > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > > > I really like that suggestion, would be much cleaner code and
> > > > easier
> > > > > > > > to configure different styles that have meaning by variable
> > name
>
> > > > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > > > I wonder if we could encapsulate, simplify this with a
> > decorator,
> > > > > > > something
> > > > > > > > > like:
>
> > > > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > > > form = crud.create(...)
>
> > > > > > > > > Something like this could be useful for something like
>
> > > > > > > > > @button( my_admin_style )
> > > > > > > > > form = crud.create()
>
> > > > > > > > > @button( my_warning_style )
> > > > > > > > > form = ...
>
> > > > > > > > >  just thinking out loud
>
> > > > > > > > > On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> > > > mwkan...@gmail.com
> > > > > > > >wrote:
>
> > > > > > > > > > took me a while to dig up the answer/solution, maybe can
> > save
> > > > someone
> > > > > > > > > > else some time
>
> > > > > > > > > >    form = crud.create(...)
> > > > > > > > > >    form=DIV(
> > > > > > > > > >      form,
> > > > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > > > >      $("input[type=submit]").val("Share");
> > > > > > > > > >      });'''),
> > > > > > > > > >      SCRIPT('''$(document).ready(function() {
> > > > > > > > > >      $("input[type=submit]").css({
> > > > > > > > > >      color:'white',
> > > > > > > > > >      background:'blue',
> > > >

[web2py:32690] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread Jonathan Lundell

On Oct 11, 2009, at 2:04 PM, mr.freeze wrote:

>
> The example I gave was for auth membership.  Say you wanted to style
> the form based on which group they were a member of.  You would need a
> style sheet for each group.  Also, what would happen when a new group
> was created?

You could generate the CSS file dynamically (new feature!), though  
it'd probably be overkill here.

Alternatively you could generate the class definition in , which  
would override the CSS file's default. That would be a little cleaner  
that a local style=, I think.

>
> On Oct 11, 3:24 pm, Thadeus Burgess  wrote:
>> Then dynamically include different stylesheets?
>>
>> 
>> {{if auth.is_logged_in():}}
>> @import "auth_form.css"
>> {{else:}}
>> @import "reg_form.css"
>> {{pass}}
>> 
>> -Thadeus
>>
>> On Sun, Oct 11, 2009 at 2:58 PM, mr.freeze   
>> wrote:
>>
>>> I think CSS is definitely the best way if you don't need this  
>>> level of
>>> dynamism and know all of the necessary selectors ahead of time.  But
>>> if you wanted to style a form based on a runtime variable (auth
>>> membership for example), or manipulate the form in any other way for
>>> that matter, I think this is useful.
>>
>>> On Oct 11, 2:39 pm, Thadeus Burgess  wrote:
 What is wrong with using a .css file?
>>
 -Thadeus
>>
 On Sun, Oct 11, 2009 at 2:04 PM, mdipierro  
 
>>> wrote:
>>
> It is there already
>>
> form.element(_type='submit')['_style']="color:white; background-
> color:blue; font-weight:bold"
>>
> It only finds the first matching element.
>>
> On Oct 11, 1:16 pm, "mr.freeze"  wrote:
>>> Good point - and addresses the original post (as it could have  
>>> been
>>> more
>>> simply done this way);
>>
>> Not technically since this would affect everything inside the  
>> form
>>> and
>> not just the submit button.  What about a member function 'find'
>>> added
>> to XmlComponent or DIV (which I think most helpers inherit  
>> from) that
>> allows you to traverse the inner components and return the  
>> matching
>> components for given criteria.  The pseudo-code might look like  
>> this:
>>
>> submit = form.components.find(XML.attribute("type")=="submit")[0]
>> submit['_style'] = "color:white; background-color:blue; font-
>> weight:bold"
>>
>> On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>>
>>> On Sun, Oct 11, 2009 at 11:04 AM, mdipierro <
>>> mdipie...@cs.depaul.edu>
> wrote:
>>
 I do not think you cannot use decorators this way.
>>
>>> double negatives not sure what you intended to say (but  
>>> logical
> analysis
>>> says "... think you can use decorators this way...");
>>
 But I remind you crud.create is a function that returns   
 SQLFORM
> which
 is a FORM which is a heper as any other helper. Therefore you  
 can
>>> do:
>>
 form = crud.create(...)
 form['_style']="color:white; background-color:blue;
>>> font-weight:bold"
>>
>>> Good point - and addresses the original post (as it could have  
>>> been
> more
>>> simply done this way);
>>
>>> Regardless, then
>>
>>> @style( color='white', background-color='blue', font- 
>>> weight='bold')
>>> form = crud.create(...)
>>
>>> would still be a readable thing (and just trivial to implement);
>>
>>> Alternatively, form.style( ...same kinds of parameters)
>>> could
>>> be
> used;
>>
>>> Anyway, this is about readability, and ease of infding this  
>>> stuff
>>> (as
> this
>>> post shows);
>>
>>> If there were a member function to FORM to set style, people who
>>> not
> have to
>>> stumble upon it.
>>
>>> Thoughts?
>>
 On Oct 11, 10:47 am, Web2py-SuperFan   
 wrote:
> I really like that suggestion, would be much cleaner code and
> easier
> to configure different styles that have meaning by variable
>>> name
>>
> On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>>
>> I wonder if we could encapsulate, simplify this with a
>>> decorator,
 something
>> like:
>>
>> @button( color='white', background='blue', font='bold' )
>> form = crud.create(...)
>>
>> Something like this could be useful for something like
>>
>> @button( my_admin_style )
>> form = crud.create()
>>
>> @button( my_warning_style )
>> form = ...
>>
>>  just thinking out loud
>>
>> On Sat, Oct 10, 2009 at 11:10 PM, Web2py-SuperFan <
> mwkan...@gmail.com
> wrote:
>>
>>> took me a while to dig up the answer/solution, maybe can
>>> save
> someone
>>> else some time
>>
>>>form = crud.create(...)
>>>form=DIV(
>>>  form,
>>>  SCRIPT('''$(document).ready(function() {
>>>  $("input[type=submit]").val("Share");
>>>  });'''),
>>

[web2py:32691] Re: How to Change the css style color and text of submit button on a crud.create form in controller

2009-10-11 Thread mdipierro

The patch is in trunk. I changed three things:
1) both elements and element include the current element in the
search, not just components of the current element.
2) elements returns an empty list if not matching. element still
returns None because it is not intended to return a list anyaway.
3) following your original suggestion I introduced first_only=False
argument so that now element calls elements.

Massimo

On Oct 11, 4:00 pm, "mr.freeze"  wrote:
> I sent you a patch. Same as 'element' but returns a list or None.
>
> On Oct 11, 3:01 pm, mdipierro  wrote:
>
> > I would take a patch that defines elements (notice the -s) that
> > returns all matching elements.
>
> > On Oct 11, 2:36 pm, "mr.freeze"  wrote:
>
> > > Nice! This would be doubly handy if it returned all matching
> > > components (jQuery style).  What about adding a first=True arg to make
> > > return all matches optional ? (or some other more graceful solution
> > > that I'm sure you've already thought of before finishing this
> > > sentence :)
>
> > >     def element(self, first=True, **kargs):
> > >         components = copy.copy(self.components)
> > >         matches = []
> > >         for c in components:
> > >             try:
> > >                 components += copy.copy(c.components)
> > >                 check = True
> > >                 for (key, value) in kargs.items():
> > >                     if c[key] != value:
> > >                         check = False
> > >                 if check:
> > >                     if first:
> > >                         return c
> > >                     else:
> > >                         matches.append(c)
> > >             except:
> > >                 pass
>
> > >         if len(matches): return matches
> > >         return None
>
> > > On Oct 11, 2:04 pm, mdipierro  wrote:
>
> > > > It is there already
>
> > > > form.element(_type='submit')['_style']="color:white; background-
> > > > color:blue; font-weight:bold"
>
> > > > It only finds the first matching element.
>
> > > > On Oct 11, 1:16 pm, "mr.freeze"  wrote:
>
> > > > > >Good point - and addresses the original post (as it could have been 
> > > > > >more
> > > > > >simply done this way);
>
> > > > > Not technically since this would affect everything inside the form and
> > > > > not just the submit button.  What about a member function 'find' added
> > > > > to XmlComponent or DIV (which I think most helpers inherit from) that
> > > > > allows you to traverse the inner components and return the matching
> > > > > components for given criteria.  The pseudo-code might look like this:
>
> > > > > submit = form.components.find(XML.attribute("type")=="submit")[0]
> > > > > submit['_style'] = "color:white; background-color:blue; font-
> > > > > weight:bold"
>
> > > > > On Oct 11, 12:29 pm, Yarko Tymciurak  wrote:
>
> > > > > > On Sun, Oct 11, 2009 at 11:04 AM, mdipierro 
> > > > > >  wrote:
>
> > > > > > > I do not think you cannot use decorators this way.
>
> > > > > > double negatives not sure what you intended to say (but logical 
> > > > > > analysis
> > > > > > says "... think you can use decorators this way...");
>
> > > > > > > But I remind you crud.create is a function that returns  SQLFORM 
> > > > > > > which
> > > > > > > is a FORM which is a heper as any other helper. Therefore you can 
> > > > > > > do:
>
> > > > > > > form = crud.create(...)
> > > > > > > form['_style']="color:white; background-color:blue; 
> > > > > > > font-weight:bold"
>
> > > > > > Good point - and addresses the original post (as it could have been 
> > > > > > more
> > > > > > simply done this way);
>
> > > > > > Regardless, then
>
> > > > > > @style( color='white', background-color='blue', font-weight='bold')
> > > > > > form = crud.create(...)
>
> > > > > > would still be a readable thing (and just trivial to implement);
>
> > > > > > Alternatively, form.style( ...same kinds of parameters)   could 
> > > > > > be used;
>
> > > > > > Anyway, this is about readability, and ease of infding this stuff 
> > > > > > (as this
> > > > > > post shows);
>
> > > > > > If there were a member function to FORM to set style, people who 
> > > > > > not have to
> > > > > > stumble upon it.
>
> > > > > > Thoughts?
>
> > > > > > > On Oct 11, 10:47 am, Web2py-SuperFan  wrote:
> > > > > > > > I really like that suggestion, would be much cleaner code and 
> > > > > > > > easier
> > > > > > > > to configure different styles that have meaning by variable name
>
> > > > > > > > On Oct 10, 9:47 pm, Yarko Tymciurak  wrote:
>
> > > > > > > > > I wonder if we could encapsulate, simplify this with a 
> > > > > > > > > decorator,
> > > > > > > something
> > > > > > > > > like:
>
> > > > > > > > > @button( color='white', background='blue', font='bold' )
> > > > > > > > > form = crud.create(...)
>
> > > > > > > > > Something like this could be useful for something like
>
> > > > > > > > > @button( my_admin_style )
> > > > > > > > > form = crud.create()
>
> > > > > > > > > @bu

[web2py:32692] Re: please check trunks

2009-10-11 Thread Alex Fanjul

You are forgetting plugin support (even its not completed at all), I 
tried with Ajax=true and it worked Massimo.
Alex F

El 10/10/2009 22:27, mdipierro escribió:
> there a lot of new things in trunk. Please check it.
>
> In particular:
> 1) cached uploads allow for progress bars (thanks AndCycle)
> 2) ingres support (thanks Chris)
> 3) legacy database support for db2, mssql (thanks Denes)
> 4) default setting of content-type (this may cause strange behavior in
> old apps when downloading images. please check it!)
> 5) new cron
>
> Please let me know if you tried and was ok with you or not. I would
> like to post a new version of web2py next week.
>
> Massimo
>
>
> >
>
>

-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

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



[web2py:32693] Re: Need help with an ajax call

2009-10-11 Thread weheh

def show_buttons():
  return DIV(podcast_button(),share_button(),delete_button
(),_class='buttons')

def podcast_button():
  return DIV(
A(
  IMG(
_src=URL(
  r=request,c='static',f='images',args=
['buttons','podcast_0.gif']),
_alt='Podcast audio',
_border='0'
  ),
  SPAN('Podcast',_class='button-label'),
  _href=URL(r=request,c='info',f='podcast'),
),
_class='rollover-podcast'
  )

def share_button():
  return DIV(
XML("""
  
  var object = SHARETHIS.addEntry({
  title:"domain.com",
  url: "http://www.domain.com/12345";,
  summary: "This is really good stuff and you need some of it."},
  {button:false});
  //write customized button
  document.write('
Share This
Share'); var element = document.getElementById("share"); object.attachButton(element); """), _class='rollover-sharethis' ) def delete_button(): return DIV( A( IMG( _src=URL(r=request,c='static',f='images',args= ['buttons','delete_0.gif']), _alt='Delete', _border='0' ), SPAN('Delete',_class='button-label'), _onclick="return confirm('T('Confirm delete!')');", _href=URL(r=request,c='info',f='delete'), ), _class='rollover-delete' ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---

[web2py:32694] Re: please check trunks

2009-10-11 Thread Richard

cached uploads with progress bar - sounds useful. Are there any
examples available how to use it?

Richard



On Oct 12, 8:52 am, Alex Fanjul  wrote:
> You are forgetting plugin support (even its not completed at all), I
> tried with Ajax=true and it worked Massimo.
> Alex F
>
> El 10/10/2009 22:27, mdipierro escribió:
>
>
>
> > there a lot of new things in trunk. Please check it.
>
> > In particular:
> > 1) cached uploads allow for progress bars (thanks AndCycle)
> > 2) ingres support (thanks Chris)
> > 3) legacy database support for db2, mssql (thanks Denes)
> > 4) default setting of content-type (this may cause strange behavior in
> > old apps when downloading images. please check it!)
> > 5) new cron
>
> > Please let me know if you tried and was ok with you or not. I would
> > like to post a new version of web2py next week.
>
> > Massimo
>
> --
> Alejandro Fanjul Fdez.
> alex.fan...@gmail.comwww.mhproject.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32695] Re: hg and google

2009-10-11 Thread Richard

is web2py going to move to mercurial on Google Code? There was talk
about this a few months back.


On Oct 11, 3:16 am, mdipierro  wrote:
> http://googlecode.blogspot.com/2009/10/mercurial-server-side-clone-su...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32696] Re: A simple patch to provide upload progress

2009-10-11 Thread mr.freeze

I may have mentioned this already, but you could create an 'Other
Resources' section under the Documentation page at web2py.com for
unofficial docs/sites/wiki posts.

On Oct 11, 3:02 pm, mdipierro  wrote:
> I am going to link it soon. I will take suggestions on the best way to
> link it form the main page.
>
> On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
>
> > just to complete the link (I didn't immediately find web2pyslice searching
> > the group):http://www.web2pyslices.com/main/default/index
>
> > On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  wrote:
>
> > > Would you post a web2pyslice on this?
>
> > > Massimo
>
> > > On Oct 10, 5:14 pm, AndCycle  wrote:
> > > > @Massiom
>
> > > >http://pastebin.com/f69e7b008
>
> > > > here is the patch include a working sample,
> > > > by the way you got another indent error in copystream_progress :p
>
> > > > On Oct 11, 3:43 am, mdipierro  wrote:
>
> > > > > @AndCycle
>
> > > > > I rearranged the code in trunk a bit. Could you check it still works?
> > > > > Thanks again.
>
> > > > > Massimo
>
> > > > > On Oct 8, 5:14 am, AndCycle  wrote:
>
> > > > > > thanks :)
>
> > > > > > I will take some free time to write a example base on trunk :p
>
> > > > > > On Oct 7, 10:24 pm, mdipierro  wrote:
>
> > > > > > > Check again. I added it now.
>
> > > > > > > On Oct 7, 6:42 am, AndCycle 
> > > wrote:
>
> > > > > > > > oops, the patch been cut by width restriction on mailing list 
> > > > > > > > lol
>
> > > > > > > > here is pastebinhttp://pastebin.com/f219d603b
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32697] Re: please check trunks

2009-10-11 Thread mdipierro

You are right. Keeping it a secret since the API is till up in the
air.

On Oct 11, 4:52 pm, Alex Fanjul  wrote:
> You are forgetting plugin support (even its not completed at all), I
> tried with Ajax=true and it worked Massimo.
> Alex F
>
> El 10/10/2009 22:27, mdipierro escribió:
>
>
>
> > there a lot of new things in trunk. Please check it.
>
> > In particular:
> > 1) cached uploads allow for progress bars (thanks AndCycle)
> > 2) ingres support (thanks Chris)
> > 3) legacy database support for db2, mssql (thanks Denes)
> > 4) default setting of content-type (this may cause strange behavior in
> > old apps when downloading images. please check it!)
> > 5) new cron
>
> > Please let me know if you tried and was ok with you or not. I would
> > like to post a new version of web2py next week.
>
> > Massimo
>
> --
> Alejandro Fanjul Fdez.
> alex.fan...@gmail.comwww.mhproject.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32698] Re: please check trunks

2009-10-11 Thread mdipierro

Yes there is a recent thread on that although I cannot find it right
now.

On Oct 11, 5:51 pm, Richard  wrote:
> cached uploads with progress bar - sounds useful. Are there any
> examples available how to use it?
>
> Richard
>
> On Oct 12, 8:52 am, Alex Fanjul  wrote:
>
> > You are forgetting plugin support (even its not completed at all), I
> > tried with Ajax=true and it worked Massimo.
> > Alex F
>
> > El 10/10/2009 22:27, mdipierro escribió:
>
> > > there a lot of new things in trunk. Please check it.
>
> > > In particular:
> > > 1) cached uploads allow for progress bars (thanks AndCycle)
> > > 2) ingres support (thanks Chris)
> > > 3) legacy database support for db2, mssql (thanks Denes)
> > > 4) default setting of content-type (this may cause strange behavior in
> > > old apps when downloading images. please check it!)
> > > 5) new cron
>
> > > Please let me know if you tried and was ok with you or not. I would
> > > like to post a new version of web2py next week.
>
> > > Massimo
>
> > --
> > Alejandro Fanjul Fdez.
> > alex.fan...@gmail.comwww.mhproject.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32699] Re: A simple patch to provide upload progress

2009-10-11 Thread mdipierro

Yes but I think web2pyslices and the new wiki are as official as it
gets so there should also be a link from the main page.

On Oct 11, 6:01 pm, "mr.freeze"  wrote:
> I may have mentioned this already, but you could create an 'Other
> Resources' section under the Documentation page at web2py.com for
> unofficial docs/sites/wiki posts.
>
> On Oct 11, 3:02 pm, mdipierro  wrote:
>
> > I am going to link it soon. I will take suggestions on the best way to
> > link it form the main page.
>
> > On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
>
> > > just to complete the link (I didn't immediately find web2pyslice searching
> > > the group):http://www.web2pyslices.com/main/default/index
>
> > > On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  
> > > wrote:
>
> > > > Would you post a web2pyslice on this?
>
> > > > Massimo
>
> > > > On Oct 10, 5:14 pm, AndCycle  wrote:
> > > > > @Massiom
>
> > > > >http://pastebin.com/f69e7b008
>
> > > > > here is the patch include a working sample,
> > > > > by the way you got another indent error in copystream_progress :p
>
> > > > > On Oct 11, 3:43 am, mdipierro  wrote:
>
> > > > > > @AndCycle
>
> > > > > > I rearranged the code in trunk a bit. Could you check it still 
> > > > > > works?
> > > > > > Thanks again.
>
> > > > > > Massimo
>
> > > > > > On Oct 8, 5:14 am, AndCycle  wrote:
>
> > > > > > > thanks :)
>
> > > > > > > I will take some free time to write a example base on trunk :p
>
> > > > > > > On Oct 7, 10:24 pm, mdipierro  wrote:
>
> > > > > > > > Check again. I added it now.
>
> > > > > > > > On Oct 7, 6:42 am, AndCycle 
> > > > wrote:
>
> > > > > > > > > oops, the patch been cut by width restriction on mailing list 
> > > > > > > > > lol
>
> > > > > > > > > here is pastebinhttp://pastebin.com/f219d603b
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32700] Re: A simple patch to provide upload progress

2009-10-11 Thread Alex Fanjul

web2pyslices its getting very cool indeed... i like the ¿new? user 
interface..
Alex F

El 12/10/2009 1:12, mdipierro escribió:
> Yes but I think web2pyslices and the new wiki are as official as it
> gets so there should also be a link from the main page.
>
> On Oct 11, 6:01 pm, "mr.freeze"  wrote:
>
>> I may have mentioned this already, but you could create an 'Other
>> Resources' section under the Documentation page at web2py.com for
>> unofficial docs/sites/wiki posts.
>>
>> On Oct 11, 3:02 pm, mdipierro  wrote:
>>
>>  
>>> I am going to link it soon. I will take suggestions on the best way to
>>> link it form the main page.
>>>
>>  
>>> On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
>>>
>>  
 just to complete the link (I didn't immediately find web2pyslice searching
 the group):http://www.web2pyslices.com/main/default/index
  
>>  
 On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  wrote:
  
>>  
> Would you post a web2pyslice on this?
>
>>  
> Massimo
>
>>  
> On Oct 10, 5:14 pm, AndCycle  wrote:
>
>> @Massiom
>>  
>>  
>> http://pastebin.com/f69e7b008
>>  
>>  
>> here is the patch include a working sample,
>> by the way you got another indent error in copystream_progress :p
>>  
>>  
>> On Oct 11, 3:43 am, mdipierro  wrote:
>>  
>>  
>>> @AndCycle
>>>
>>  
>>> I rearranged the code in trunk a bit. Could you check it still works?
>>> Thanks again.
>>>
>>  
>>> Massimo
>>>
>>  
>>> On Oct 8, 5:14 am, AndCycle  wrote:
>>>
>>  
 thanks :)
  
>>  
 I will take some free time to write a example base on trunk :p
  
>>  
 On Oct 7, 10:24 pm, mdipierro  wrote:
  
>>  
> Check again. I added it now.
>
>>  
> On Oct 7, 6:42 am, AndCycle
>
> wrote:
>
>>  
>> oops, the patch been cut by width restriction on mailing list lol
>>  
>>  
>> here is pastebinhttp://pastebin.com/f219d603b
>>  
> >
>
>

-- 
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

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



[web2py:32701] crud forms for multiple records? Multiple tables?

2009-10-11 Thread Peter Woolf

Can I create a crud  form that simultaneously update multiple rows and
multiple tables?  I’ve been through the web2py manual a number of
times, but don’t see this issue addressed.  Below is an example:

In db.py

db.define_table(
'users'
Field('name')
)

db.define_table(
'dogs',
Field('owner_id', db.users),
Field('name'),
Field('vaccination_id', db.vaccinations)
)

db.define_table(
'vaccinations',
Field('dog_id', db.dogs),
Field('vaccination')
)

Given these three tables, I want to be create a crud form where I can
update the names and vaccinations of all of the dogs of a particular
owner.  For example, if I have two dogs, muffy and fluffy, then I want
to create a form where both the records of muffy AND fluffy are
presented in ONE form to allow me to edit the tables ‘dogs” and
‘vaccinations’ with one submit button.

Any thoughts on how to do this?  I can easily make a crud form for a
single record, but this would mean I have many submit buttons on a
page or a very long series of pages to do something simpler.

Any thoughts would be appreciated.

Thanks,
--Peter

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



[web2py:32702] Re: reCaptcha example not working?

2009-10-11 Thread devnull

Sorry. Yes it works completely. My code was just incorrect. Here's my
fixed example.

def cap():
from gluon.tools import Recaptcha
form=FORM(
Recaptcha(request,public_key,private_key),
INPUT(_type='submit'))
if form.accepts(request.vars, session):
response.flash = "yay"
elif form.errors:
response.flash = "nay"
else:
response.flash = "hey"
return dict(form=form)


On Oct 9, 10:38 pm, devnull  wrote:
> Hm. The page loads with the error response flash. Other than that it
> works.
>
> def cap():
>     from gluon.tools import Recaptcha
>     form=FORM(
>             Recaptcha(request,public_key,private_key),
>             INPUT(_type='submit'))
>     if form.accepts(request.vars,session):
>         response.flash='done!'
>     else:
>         response.flash='nope.'
>     return dict(form=form)
>
> On Oct 9, 6:16 pm, mdipierro  wrote:
>
>
>
> > oops. fixed thanks. Please let us know if this works for you.
>
> > On Oct 9, 4:57 pm, devnull  wrote:
>
> > > Awesome -- thanks! (By the way, the page says [captcha and recaptha]
> > > and should say [captcha and recaptcha])
>
> > > On Oct 9, 5:24 pm, mdipierro  wrote:
>
> > > > The example was incorrect because uses an old file with bugs. You
> > > > should use the Recaptcha helper built in web2py. I fixed the example
>
> > > >http://www.web2py.com/AlterEgo/default/show/99
>
> > > > On Oct 9, 2:26 pm, devnull  wrote:
>
> > > > > The controller below initially displays the flash 'some other error in
> > > > > your form' right when the page loads.
>
> > > > > If I leave the captcha field blank and hit submit, it flashes 'done!'
> > > > > The same thing happens if I type something incorrect in the captcha
> > > > > field and then hit submit.
>
> > > > > What should I do differently? The example 
> > > > > fromhttp://www.web2py.com/AlterEgo/default/show/99
> > > > > looks ok to me... (Thanks in advance)
>
> > > > > public_key='(a very long key from reCAPTCHA)'
> > > > > private_key='(a very long key from reCAPTCHA with a hyphen in it)'
>
> > > > > def cap():
> > > > >     form=FORM(RECAPTCHA(request,public_key,private_key),INPUT
> > > > > (_type='submit'))
> > > > >     if form.accepts(request.vars,session): response.flash='done!'
> > > > >     elif form.errors.has_key('captcha'): response.flash='invalid
> > > > > captcha'
> > > > >     else: response.flash='some other error in your form'
> > > > >     return dict(form=form)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32703] Re: A simple patch to provide upload progress

2009-10-11 Thread mr.freeze

Thanks! I am going through a code cleanup but will be posting the
source when done for anyone interested.

On Oct 11, 6:26 pm, Alex Fanjul  wrote:
> web2pyslices its getting very cool indeed... i like the ¿new? user
> interface..
> Alex F
>
> El 12/10/2009 1:12, mdipierro escribió:
>
>
>
> > Yes but I think web2pyslices and the new wiki are as official as it
> > gets so there should also be a link from the main page.
>
> > On Oct 11, 6:01 pm, "mr.freeze"  wrote:
>
> >> I may have mentioned this already, but you could create an 'Other
> >> Resources' section under the Documentation page at web2py.com for
> >> unofficial docs/sites/wiki posts.
>
> >> On Oct 11, 3:02 pm, mdipierro  wrote:
>
> >>> I am going to link it soon. I will take suggestions on the best way to
> >>> link it form the main page.
>
> >>> On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
>
>  just to complete the link (I didn't immediately find web2pyslice 
>  searching
>  the group):http://www.web2pyslices.com/main/default/index
>
>  On Sun, Oct 11, 2009 at 2:42 AM, mdipierro  
>  wrote:
>
> > Would you post a web2pyslice on this?
>
> > Massimo
>
> > On Oct 10, 5:14 pm, AndCycle  wrote:
>
> >> @Massiom
>
> >>http://pastebin.com/f69e7b008
>
> >> here is the patch include a working sample,
> >> by the way you got another indent error in copystream_progress :p
>
> >> On Oct 11, 3:43 am, mdipierro  wrote:
>
> >>> @AndCycle
>
> >>> I rearranged the code in trunk a bit. Could you check it still works?
> >>> Thanks again.
>
> >>> Massimo
>
> >>> On Oct 8, 5:14 am, AndCycle  wrote:
>
>  thanks :)
>
>  I will take some free time to write a example base on trunk :p
>
>  On Oct 7, 10:24 pm, mdipierro  wrote:
>
> > Check again. I added it now.
>
> > On Oct 7, 6:42 am, AndCycle
>
> > wrote:
>
> >> oops, the patch been cut by width restriction on mailing list lol
>
> >> here is pastebinhttp://pastebin.com/f219d603b
>
> --
> Alejandro Fanjul Fdez.
> alex.fan...@gmail.comwww.mhproject.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32704] Re: hg and google

2009-10-11 Thread mdipierro

It is one of those things that is not technically difficult but would
require lots of people to change habits. Starting with me. I am still
leaning toward switching but I would like to hear if there is any
opposition to this.

On Oct 11, 5:54 pm, Richard  wrote:
> is web2py going to move to mercurial on Google Code? There was talk
> about this a few months back.
>
> On Oct 11, 3:16 am, mdipierro  wrote:
>
> >http://googlecode.blogspot.com/2009/10/mercurial-server-side-clone-su...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32705] Re: hg and google

2009-10-11 Thread Jonathan Lundell

On Oct 11, 2009, at 5:37 PM, mdipierro wrote:

> It is one of those things that is not technically difficult but would
> require lots of people to change habits. Starting with me. I am still
> leaning toward switching but I would like to hear if there is any
> opposition to this.

It does look like it'd make it easier to submit patches

>
> On Oct 11, 5:54 pm, Richard  wrote:
>> is web2py going to move to mercurial on Google Code? There was talk
>> about this a few months back.
>>
>> On Oct 11, 3:16 am, mdipierro  wrote:
>>
>>> http://googlecode.blogspot.com/2009/10/mercurial-server-side-clone-su 
>>> ...
>



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



[web2py:32706] Re: crud forms for multiple records? Multiple tables?

2009-10-11 Thread mdipierro

Something is wrong with this:

db.define_table('dogs',
...
Field('vaccination_id', db.vaccinations))

db.define_table('vaccinations',
Field('dog_id', db.dogs),
...
)
there is a circular definition and seems to indicate each dog can have
a single vaccination.

I would go with this:

db.define_table(
'users'
Field('name')
)

db.define_table(
'dogs',
Field('owner_id', db.users),
Field('name'),
)

db.define_table(
'vaccinations',
Field('dog_id'),
Field('vaccination')
)

You can do things like:

form=SQLFORM.factory(db.dogs,db.vaccinations)

but you have to be careful about repeated fields.

If you describe  the workflow of what you need to do perhaps we can
help more.

Massimo


On Oct 11, 6:47 pm, Peter Woolf  wrote:
> Can I create a crud  form that simultaneously update multiple rows and
> multiple tables?  I’ve been through the web2py manual a number of
> times, but don’t see this issue addressed.  Below is an example:
>
> In db.py
>
> db.define_table(
>     'users'
>     Field('name')
> )
>
> db.define_table(
>     'dogs',
>     Field('owner_id', db.users),
>     Field('name'),
>     Field('vaccination_id', db.vaccinations)
> )
>
> db.define_table(
>     'vaccinations',
> Field('dog_id', db.dogs),
> Field('vaccination')
> )
>
> Given these three tables, I want to be create a crud form where I can
> update the names and vaccinations of all of the dogs of a particular
> owner.  For example, if I have two dogs, muffy and fluffy, then I want
> to create a form where both the records of muffy AND fluffy are
> presented in ONE form to allow me to edit the tables ‘dogs” and
> ‘vaccinations’ with one submit button.
>
> Any thoughts on how to do this?  I can easily make a crud form for a
> single record, but this would mean I have many submit buttons on a
> page or a very long series of pages to do something simpler.
>
> Any thoughts would be appreciated.
>
> Thanks,
> --Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32707] Re: crud forms for multiple records? Multiple tables?

2009-10-11 Thread Peter Woolf

thanks Massimo!  Let me see if I can get this going via the
SQLFORM.factory--thanks for the suggestion.
--Peter


On Oct 11, 9:37 pm, mdipierro  wrote:
> Something is wrong with this:
>
> db.define_table('dogs',
>     ...
>     Field('vaccination_id', db.vaccinations))
>
> db.define_table('vaccinations',
>     Field('dog_id', db.dogs),
>     ...
> )
> there is a circular definition and seems to indicate each dog can have
> a single vaccination.
>
> I would go with this:
>
> db.define_table(
>     'users'
>     Field('name')
> )
>
> db.define_table(
>     'dogs',
>     Field('owner_id', db.users),
>     Field('name'),
> )
>
> db.define_table(
>     'vaccinations',
> Field('dog_id'),
> Field('vaccination')
> )
>
> You can do things like:
>
> form=SQLFORM.factory(db.dogs,db.vaccinations)
>
> but you have to be careful about repeated fields.
>
> If you describe  the workflow of what you need to do perhaps we can
> help more.
>
> Massimo
>
> On Oct 11, 6:47 pm, Peter Woolf  wrote:
>
>
>
> > Can I create a crud  form that simultaneously update multiple rows and
> > multiple tables?  I’ve been through the web2py manual a number of
> > times, but don’t see this issue addressed.  Below is an example:
>
> > In db.py
>
> > db.define_table(
> >     'users'
> >     Field('name')
> > )
>
> > db.define_table(
> >     'dogs',
> >     Field('owner_id', db.users),
> >     Field('name'),
> >     Field('vaccination_id', db.vaccinations)
> > )
>
> > db.define_table(
> >     'vaccinations',
> > Field('dog_id', db.dogs),
> > Field('vaccination')
> > )
>
> > Given these three tables, I want to be create a crud form where I can
> > update the names and vaccinations of all of the dogs of a particular
> > owner.  For example, if I have two dogs, muffy and fluffy, then I want
> > to create a form where both the records of muffy AND fluffy are
> > presented in ONE form to allow me to edit the tables ‘dogs” and
> > ‘vaccinations’ with one submit button.
>
> > Any thoughts on how to do this?  I can easily make a crud form for a
> > single record, but this would mean I have many submit buttons on a
> > page or a very long series of pages to do something simpler.
>
> > Any thoughts would be appreciated.
>
> > Thanks,
> > --Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32708] Re: Need help with an ajax call

2009-10-11 Thread weheh

OK, I'm seeing the slightest glimmer of light. I'm now able to get the
callbacks to work under the simplest of cases using Massimo's replace
('"','\\"') trick. The problem was in the mix of single and double
quotes in the return from the callback.

HOWEVER, now I'm running into other funky characters that are causing
me more headaches. Now I'm seeing the following error:

unterminated string literal
  [Break on this error] String.prototype.reverse = function () {...rn
this.split('').reverse().join('');};\n


So, I'm looking into this unterminated string literal issue, and I see
that many people have run into it, also.

Does anyone have a simple python routine to clean up a string so it'll
pass this javascript hurdle? Thx.

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



[web2py:32709] Re: Need help with an ajax call [Resolved]

2009-10-11 Thread weheh

OK! Light is clearly visible at the end of the tunnel.

I'm now able to get callbacks to work under the simplest of cases
using Massimo's replace
('"','\\"') trick. The problem was in the mix of single and double
quotes in the return from the callback. It requires an eagle eye to
pick out the mistakes. That's why I'm gravitating to triple quotes """
around the return string as per Thadeus' suggestion.

After I got the callback to work, I still ran into trouble with
unterminated strings. Basically, any string you want to display can
neither have a '\n' or a '\r\n' character sequence in it, or
javascript will choke. Those are easily gotten rid of with s.replace
('\r\n','') and s.replace('\n','') statements.

So, I'm going to close this issue (and hopefully, it'll stay
closed ;^). Thanks, all, for your generous help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32710] Re: A simple patch to provide upload progress

2009-10-11 Thread Yarko Tymciurak
so glad to hear it - it is a really nice job!   (consider have a "code
review" at post, and posting to google code in mercurial to enable such).
- Yarko

On Sun, Oct 11, 2009 at 7:23 PM, mr.freeze  wrote:

>
> Thanks! I am going through a code cleanup but will be posting the
> source when done for anyone interested.
>
> On Oct 11, 6:26 pm, Alex Fanjul  wrote:
> > web2pyslices its getting very cool indeed... i like the ¿new? user
> > interface..
> > Alex F
> >
> > El 12/10/2009 1:12, mdipierro escribió:
> >
> >
> >
> > > Yes but I think web2pyslices and the new wiki are as official as it
> > > gets so there should also be a link from the main page.
> >
> > > On Oct 11, 6:01 pm, "mr.freeze"  wrote:
> >
> > >> I may have mentioned this already, but you could create an 'Other
> > >> Resources' section under the Documentation page at web2py.com for
> > >> unofficial docs/sites/wiki posts.
> >
> > >> On Oct 11, 3:02 pm, mdipierro  wrote:
> >
> > >>> I am going to link it soon. I will take suggestions on the best way
> to
> > >>> link it form the main page.
> >
> > >>> On Oct 11, 12:00 pm, Yarko Tymciurak  wrote:
> >
> >  just to complete the link (I didn't immediately find web2pyslice
> searching
> >  the group):http://www.web2pyslices.com/main/default/index
> >
> >  On Sun, Oct 11, 2009 at 2:42 AM, mdipierro
>  wrote:
> >
> > > Would you post a web2pyslice on this?
> >
> > > Massimo
> >
> > > On Oct 10, 5:14 pm, AndCycle
>  wrote:
> >
> > >> @Massiom
> >
> > >>http://pastebin.com/f69e7b008
> >
> > >> here is the patch include a working sample,
> > >> by the way you got another indent error in copystream_progress :p
> >
> > >> On Oct 11, 3:43 am, mdipierro  wrote:
> >
> > >>> @AndCycle
> >
> > >>> I rearranged the code in trunk a bit. Could you check it still
> works?
> > >>> Thanks again.
> >
> > >>> Massimo
> >
> > >>> On Oct 8, 5:14 am, AndCycle
>  wrote:
> >
> >  thanks :)
> >
> >  I will take some free time to write a example base on trunk :p
> >
> >  On Oct 7, 10:24 pm, mdipierro  wrote:
> >
> > > Check again. I added it now.
> >
> > > On Oct 7, 6:42 am, AndCycle
> >
> > > wrote:
> >
> > >> oops, the patch been cut by width restriction on mailing list
> lol
> >
> > >> here is pastebinhttp://pastebin.com/f219d603b
> >
> > --
> > Alejandro Fanjul Fdez.
> > alex.fan...@gmail.comwww.mhproject.org
> >
>

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



[web2py:32711] Re: hg and google

2009-10-11 Thread Yarko Tymciurak
I have pushed for this for over a year;  I need to do something about it -
web2conf will move there tomorrow afternoon, and then I will take notes, and
share...

On Sun, Oct 11, 2009 at 7:43 PM, Jonathan Lundell wrote:

>
> On Oct 11, 2009, at 5:37 PM, mdipierro wrote:
>
> > It is one of those things that is not technically difficult but would
> > require lots of people to change habits. Starting with me. I am still
> > leaning toward switching but I would like to hear if there is any
> > opposition to this.
>
> It does look like it'd make it easier to submit patches
>
> >
> > On Oct 11, 5:54 pm, Richard  wrote:
> >> is web2py going to move to mercurial on Google Code? There was talk
> >> about this a few months back.
> >>
> >> On Oct 11, 3:16 am, mdipierro  wrote:
> >>
> >>> http://googlecode.blogspot.com/2009/10/mercurial-server-side-clone-su
> >>> ...
> >
>
>
>
> >
>

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



[web2py:32712] Interesting Javascript Project

2009-10-11 Thread Thadeus Burgess
It's python, with a javascript compiler! So you can write python client side
code.

I just thought this was a very interesting project and wanted to share it.

http://www.skulpt.org/

-Thadeus

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