Re: [web2py] Re: How to use requires with list:reference

2014-06-12 Thread Anthony


 Are you saying you want the user to enter a last name for the child and 
 then have the drop-down dynamically updated with the list of parents with 
 the entered last name? If so, obviously that cannot be done at the time the 
 form is generated on the server because you don't know what name the user 
 will enter in the form. 


 Hmm.. I did not thing of that.
 Actually I was trying only Edit option - where last name of the child is 
 known, but parent information is not populated.
 Did not think of New scenario - my bad.


In the edit scenario, you do have the child last name, so you can take 
the approach I showed, though you have to set the validator after you 
retrieve the relevant record. So you would do something like:

child_record = db.child([some id])
db.child.parents.requires = IS_IN_DB(db(db.parent.lname = child_record.
last_name), ...)
edit_form = SQLFORM(db.child, record=child_record)
   

 You'll instead have to handle this with Javascript in the browser, 
 possibly with an Ajax call back to the server to populate the list 

 (unless the list of parents is small enough to send to the browser with 
 the initial page load).


Makes sense. In that case :


should I even use reference parent ? Cause I think it will automatically 
 create and populate the widget for me (which I think I will need to hide 
 somehow ?)


You still want it to be a reference field. If you don't want the default 
widget associated with the IS_IN_DB validator, you can always put it in a 
list (which suppresses the drop-down list widget):

Field('parents', 'list:reference parent', requires=[IS_IN_DB(...)])

Anthony
 

-Mandar

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


[web2py] Re: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-12 Thread Anthony
On Wednesday, June 11, 2014 3:48:15 PM UTC-4, 黄祥 wrote:

 Hi, Anthony, is it possible to combine the represent for change the color 
 depend on the value with the represent for is_in_set translate above?
 e.g.


Sure, instead of SPAN(status, ...) do SPAN(mydict[status], ...).

Anthony

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


[web2py] {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
Hello,

I'm trying to pass a variable which has json data into infovis for a 
visualization

It's interesting because when I type {{=XML(data)}} in the view I can see 
the correct json data is being passed, but when I edit the .js file and try 
to include the variable there nothing happens (it says undefined).

Here is what i'm creating: 
http://philogb.github.io/jit/static/v20/Jit/Examples/ForceDirected/example1.html

If you click on example code you'll see they have json already defined 
there in the , but I want to pass the json as a variable to the js file.

When I copy and paste the json code from my view and paste it directly into 
the .js it works fine, so I'm thinking I'm not passing the variable 
properly.

I've tried {{=XML(data)}} with and without quotes, and still the same 
result.

Any help is greatly appreciated!


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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
Just an update this is where I'm trying to place the variable:
var json = '{{=XML(data_returned_from_controller)}}';

On Thursday, June 12, 2014 10:11:58 AM UTC-4, LoveWeb2py wrote:

 Hello,

 I'm trying to pass a variable which has json data into infovis for a 
 visualization

 It's interesting because when I type {{=XML(data)}} in the view I can see 
 the correct json data is being passed, but when I edit the .js file and try 
 to include the variable there nothing happens (it says undefined).

 Here is what i'm creating: 
 http://philogb.github.io/jit/static/v20/Jit/Examples/ForceDirected/example1.html

 If you click on example code you'll see they have json already defined 
 there in the , but I want to pass the json as a variable to the js file.

 When I copy and paste the json code from my view and paste it directly 
 into the .js it works fine, so I'm thinking I'm not passing the variable 
 properly.

 I've tried {{=XML(data)}} with and without quotes, and still the same 
 result.

 Any help is greatly appreciated!




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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread Leonel Câmara
.js files are static files so they don't go trough the view templating 
process. See the welcome application web2py_ajax.html file for an example 
of how to setup variables for javascript.

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


[web2py] modal form - is this a good approach?

2014-06-12 Thread Vincent
Hi,

wanted to ask the community if the approach I am taking is sound. If so 
this may be of use to others. If not, please tell me the way to do this 
correctly.
My objective is to have form submission in a modal way (using bootstrap 
modal).
Here is the approach I am taking, reduced to the simplest case, which works 
fine but may not be the most elegant:

db.py:
db = DAL('sqlite://storage.sqlite')
db.define_table('person', 
Field('firstname','string'), 
Field('lastname','string'))


default.py
def index():
 button = A(modal form, _href=#myModal, _role=button, _class=btn
, **{'_data-toggle':'modal'})
 return dict(button=button)

def modal_form():
form = SQLFORM(db.person)
form.element(_type='submit')['_onclick']=
jQuery('#myModal').modal('hide')
if form.process().accepted:
response.flash = 'Accepted! %s %s added' %(form.vars.firstname, form
.vars.lastname)
return dict(form=form)


default/index.html
{{extend 'layout.html'}}
{{=button}}
div id=myModal class=modal hide fade tabindex=-1 role=dialog aria-
labelledby=myModalLabel aria-hidden=true
div class=modal-header
button type=button class=close data-dismiss=modal aria-hidden
=true×/button
h3 id=myModalLabelModal header/h3
/div
div class=modal-body
{{=LOAD('default','modal_form.load', ajax=True)}}
/div
/div


default/modal_form.load

{{=form}}


any feedback of a better or more modular approach would be appreciated

Ideally, I would like the complete myModal div to be the loaded component 
but I was not able to figure out how to do this.


Thanks!

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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
so would it be better if I just paste the code into the view? Would it make 
it easier?

On Thursday, June 12, 2014 12:53:10 PM UTC-4, Leonel Câmara wrote:

 .js files are static files so they don't go trough the view templating 
 process. See the welcome application web2py_ajax.html file for an example 
 of how to setup variables for javascript.


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


[web2py] Re: scheduler worker assignment and disable behavior

2014-06-12 Thread DeanK
Thanks for the detailed response! Lot's to cover so here we go..haha


mysql is the uttermost/personal top 1 dislike/non-standard behaving backend 
 out there, but we'll manage ^_^


Interesting.  What do you like more?



and if by node you mean a completely different server, you have 7*5 = 35 
 additional workers on top of the 11 on the head. That's quite a number of 
 workers, I hope they are there because you need to process at least 46 
 tasks in parallel


 
So I am *certainly* using the scheduler in a way it wasn't intended, but 
that's part of the fun right? I'm in an interesting situation where I have 
access to a cluster of 5 computers that each have 7 GPUs.  There 
currently isn't a proper task scheduler (e.g. SGE, LSF, slurm, etc.) 
installed yet...sot it's not really much of a cluster beyond a shared 
filesystem...but I want to use the system now instead of waiting for 
everything to get setup.  I don't have sudo accessso I thought: 
hey...in less than a day's work I can set up web2py + the built-in 
scheduler + the comfort scheduler monitor and be able to run distributed 
GPU processing with a shiny web2py frontend!  That is why I need 7 compQ 
workers per machine (1 per GPU).  It is also why I include a unique group 
name for *each* worker (hostname_compXX). This lets me issue 
terminate/disable commands to a group and be able to stop specific workers. 
 I need this to control which GPUs will pick up work, since I can't use all 
of them all the time.

From your description, it is still my understanding that after ~30 seconds 
a disabled worker will go back to work.  As you can see from my odd use 
case above, I don't want this to happen.  If i'm disabling a worker it's 
because i don't want that worker to pick up any tasks until it is commanded 
to resumeso I have resorted to terminating and manually restarting. 
 This works for now.
 


Howdy4 minutes to 4 hours ok, we are flexible but hey, 4 hours 
 isn't a task, it's a nightmare


Haha...again...obviously stretching things here, but it is pretty much 
working which is cool.  This more or less makes sense, and I'm definitely 
seeing the impact of a long running task being the TICKER.   When this 
happens nothing moves out of the queued state for a LONG time.  Based on 
what you've said, forcing a new TICKER should make this go away I think. So 
i may need a simple script i can run to clear the worker table when i see 
this happen. This won't re-assign already assigned tasks though, correct? 
 For example I see stuff like this:

2 workers: A and B
4 tasks: 1,2,3,4 - tasks 1 and 2 take 5 minutes, tasks 3 and 4 take 1 hour.

Worker A gets assigned tasks 1 and 2, B gets 3 and 4.  Tasks 1 and 2 finish 
in 10 minutes.  Worker A sits idle while worker B runs for 2 hours.  Is 
this a correct understanding how things work, or if I force the ticker to 
PICK it will actually reassign these tasks to an idle worker?


I don't see why for tasks that take 4 minutes to 4 hours, you should use 
 immediate. 


I totally agree.  It kind of got copy/paste carried over from other code 
for a web app where it did make sense to use immediate.  I'm not doing it 
anymore.  I did go back an check the output from the workers and i do see 
some errors.  There are some application specific things from my code, but 
also two others of this flavor:

2014-05-23 13:18:10,544 - web2py.scheduler.XX#16361 - ERROR - Error 
cleaning up 

Traceback (most recent call last):
  File /home/x/anaconda/lib/python2.7/logging/handlers.py, line 76, in 
emit
if self.shouldRollover(record):
  File /home/x/anaconda/lib/python2.7/logging/handlers.py, line 157, 
in shouldRollover
self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
IOError: [Errno 116] Stale file handle
Logged from file scheduler.py, line 822

Note: I do have the web2py logging setup, but i'm not using it for anything 
anymore so i could delete the config file.  It looks like all the output 
from the workers is getting put into the web2py log file. Maybe one worker 
is causing the log file to roll over while another is trying to write to it?


Finally, looking at my notes I've seen some other weird behavior.  I'm not 
sure this is the place for it to go since this post is ridiculously dense 
to begin with, so let me know if you want me to repost it somewhere else

   - If the ticker is a worker who is running a long task, nothing gets 
   assigned for a very long time (I think until the job completes).  I think 
   we've covered this behavior above and it makes sense.  Forcing a new ticker 
   should fix it.
   - Sometimes I see tasks that complete successfully, but get re-run for 
   some reason (i've only seen it with my long running 3-4 hr tasks).  Looking 
   in the comfy monitor, the task has a complete run and i see the output, but 
   it gets scheduled and run again.  Since my code does cleanup after the 
   first run, the input data is missing so the second run 

[web2py] Re: Developer wanted!

2014-06-12 Thread samuel bonill
$8k ??

El martes, 10 de junio de 2014 16:06:50 UTC-5, Yanni Shainsky escribió:

 I am looking for a paid developer for project that goes from 
 concept-to-completion. 

 1. Database driven

 2. Functionality similar to yelp, craiglist, angieslist

 3. We will have at least 5 different user-types: visitors, authenticated 
 users, business users, moderators, administrators

 4. Users are able to submit how much they paid for a service.

 5. Graphs and tables that display information. The individual items on the 
 graph are linked to specific submissions. 

 6. Would prefer a modern design, utilizing HTML5 and/or Bootstrap.

 7. Would prefer Python based development, using a web framework such as 
 Web2Py or Django

 8. Would need some basic authentication integration with Facebook and/or 
 Google.

 9. Would prefer someone that has experience building sites that consider 
 geographical areas (zip codes,

 area codes).

 10. Would prefer someone that has worked on a classified's type project. 


 The budget for the project is $8k - but somewhat flexible (initial 
 deployment), and then per-hour support.

 Please email me at yanni.s...@gmail.com javascript:, or reply here if 
 you're interested. I will invite you to bid a private project on oDesk.com, 
 so if possible please provide your oDesk contact information. 

  


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


[web2py] Re: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-12 Thread 黄祥
it works, thank you so much, anthony
e.g.
product_status = {'On Sale': T('On Sale'), 'Hold': T('Hold'), 'Sold': 
T('Sold')}

table.status.represent = lambda status, field: SPAN(product_status[status], 
_class = 'text-success' if status == 'Sold' else 'text-warning' if status 
== 'Hold' else 'text-error')
table.status.requires = IS_IN_SET([('On Sale', T('On Sale') ), ('Hold', 
T('Hold') ), ('Sold', T('Sold') ) ] )

best regards,
stifan

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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread Andrew W
Yes.  Add a script section

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


[web2py] lambda cannot contain assignment

2014-06-12 Thread Fabiano Almeida
Hi,

In a table I need to change the field value (name: cadastro, type:
datetime) to request.now depending on the value assigned to another field
(name: status) of the same record.

I thought of using the _before_update callbcak for this purpose:

db.solicitacao._before_update.append(lambda f: f.cadastro=request.now if
(f.status == 'Edição') or (f.status =='Enviado') else None)

Thus returns the message *lambda cannot contain assignment*

Any suggestions?

Thanks in advance,

Fabiano.

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


[web2py] Re: lambda cannot contain assignment

2014-06-12 Thread Anthony
First, note that you are not limited to using a lambda -- you can use any 
function/callable. So, if you need to do an assignment, write a separate 
function.

In this case, though, you can instead use the .update method:

db.solicitacao._before_update.append(lambda qset, f:
f.update(cadastro=request.now if f['status'] in ['Edição', 'Enviado'] 
else None)) 

Also, note that the first argument passed to the callback is the set 
object, not the fields; and the fields object is a dictionary, so you have 
to do f['status'] rather than f.status.

Anthony


On Thursday, June 12, 2014 2:54:03 PM UTC-4, Fabiano Almeida wrote:

 Hi,

 In a table I need to change the field value (name: cadastro, type: 
 datetime) to request.now depending on the value assigned to another field 
 (name: status) of the same record. 

 I thought of using the _before_update callbcak for this purpose:

 db.solicitacao._before_update.append(lambda f: f.cadastro=request.now if 
 (f.status == 'Edição') or (f.status =='Enviado') else None)

 Thus returns the message *lambda cannot contain assignment*

 Any suggestions?

 Thanks in advance,

 Fabiano.
  

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


[web2py] Re: scheduler worker assignment and disable behavior

2014-06-12 Thread Niphlod


On Thursday, June 12, 2014 7:37:26 PM UTC+2, DeanK wrote:

 Thanks for the detailed response! Lot's to cover so here we go..haha


 mysql is the uttermost/personal top 1 dislike/non-standard behaving 
 backend out there, but we'll manage ^_^


 Interesting.  What do you like more?


in the real life I'm a MSSQL dba. I enjoy using it but as far as 
concurrency issues (that is more likely your problem), I observed that more 
than 20 active workers pose a problem. To be fair I didn't test the new 
shiny in-memory tables, but that's completely not fair (and not free). For 
my OSS project (and by measurements on my rig) postgresql handles a lot 
better the kind of queries the scheduler needs to be executed, so if you're 
not locked in with mysql, I'll definitely give it a try (at least just 
for the scheduler_* related tables).
 




 and if by node you mean a completely different server, you have 7*5 = 35 
 additional workers on top of the 11 on the head. That's quite a number of 
 workers, I hope they are there because you need to process at least 46 
 tasks in parallel


  
 So I am *certainly* using the scheduler in a way it wasn't intended, but 
 that's part of the fun right? I'm in an interesting situation where I have 
 access to a cluster of 5 computers that each have 7 GPUs.  There 
 currently isn't a proper task scheduler (e.g. SGE, LSF, slurm, etc.) 
 installed yet...sot it's not really much of a cluster beyond a shared 
 filesystem...but I want to use the system now instead of waiting for 
 everything to get setup.  I don't have sudo accessso I thought: 
 hey...in less than a day's work I can set up web2py + the built-in 
 scheduler + the comfort scheduler monitor and be able to run distributed 
 GPU processing with a shiny web2py frontend!  That is why I need 7 compQ 
 workers per machine (1 per GPU).  It is also why I include a unique group 
 name for *each* worker (hostname_compXX). This lets me issue 
 terminate/disable commands to a group and be able to stop specific workers. 
  I need this to control which GPUs will pick up work, since I can't use all 
 of them all the time.


ok, seems fair. But if you're using the comfort scheduler monitor, you can 
cherry-pick the exact worker to disable (or kill, or terminate) without 
fiddling with group_names. This is valid only if comp_01 can process the 
exact same tasks as comp_02, and so on, and if hostnames are different, 
because the worker_name has the hostname in it.

 


 From your description, it is still my understanding that after ~30 seconds 
 a disabled worker will go back to work. 


Nope. A DISABLED worker will SLEEP for 30 seconds and then simply mark 
itself as beating, while not processing tasks. This alleviates the db 
pressure because if you don't need to process tasks, there's no need to hit 
the db every 3 seconds to look for new tasks (but the worker still needs to 
checkin every 30 seconds, marking the last_heartbeat column). This is the 
relevant excerpt that makes the loop jump without doing nothing

https://github.com/web2py/web2py/blob/master/gluon/scheduler.py#L635

and this 
https://github.com/web2py/web2py/blob/master/gluon/scheduler.py#L973

shows that no tasks can be assigned to a worker that is NOT active. 
 


 Howdy4 minutes to 4 hours ok, we are flexible but hey, 4 hours 
 isn't a task, it's a nightmare


 Haha...again...obviously stretching things here, but it is pretty much 
 working which is cool.  This more or less makes sense, and I'm definitely 
 seeing the impact of a long running task being the TICKER.   When this 
 happens nothing moves out of the queued state for a LONG time.  Based on 
 what you've said, forcing a new TICKER should make this go away I think. So 
 i may need a simple script i can run to clear the worker table when i see 
 this happen. This won't re-assign already assigned tasks though, correct? 
  For example I see stuff like this:

 2 workers: A and B
 4 tasks: 1,2,3,4 - tasks 1 and 2 take 5 minutes, tasks 3 and 4 take 1 hour.

 Worker A gets assigned tasks 1 and 2, B gets 3 and 4.  Tasks 1 and 2 
 finish in 10 minutes.  Worker A sits idle while worker B runs for 2 hours. 
  Is this a correct understanding how things work, or if I force the ticker 
 to PICK it will actually reassign these tasks to an idle worker?


well, this should definitely NOT happen 
(https://github.com/web2py/web2py/blob/master/gluon/scheduler.py#L990). All 
QUEUED or ASSIGNED tasks are shuffled among active workers every ~15 
seconds, to counteract exactly what you describe. To be fair, workers are 
assigned tasks that can process, and this is specified by the 
group_name(s). Assuming A and B have a common group_name and 1,2,3,4 are 
tasks with that group_name.

..beginning..Ticker assigns tasks. Wait a few seconds and
1 is RUNNING (A got it)
2 is ASSIGNED to A (A will eventually process it)
3 is RUNNING (B got it)
4 is assigned to B (B will eventually process it)

[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
So I currently have it like this:

function init(){
 var json = '{{=XML(json_data_from_controller)}}';

but I'm still getting undefined

On Thursday, June 12, 2014 2:42:31 PM UTC-4, Andrew W wrote:

 Yes.  Add a script section

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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
if I type {{=XML(json_data_from_controller)}} outside of the var I can see 
the json data.

Also, if I copy and paste the json data right into the variable that also 
works. 

On Thursday, June 12, 2014 5:26:21 PM UTC-4, LoveWeb2py wrote:

 So I currently have it like this:

 function init(){
  var json = '{{=XML(json_data_from_controller)}}';

 but I'm still getting undefined

 On Thursday, June 12, 2014 2:42:31 PM UTC-4, Andrew W wrote:

 Yes.  Add a script section



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


[web2py] Re: {{=XML(data)}} for javascript variable issue

2014-06-12 Thread LoveWeb2py
Sigh it was the apostrophes around the XML statement. 

Sorry about that guys I didn't realize I didn't need the ' enclosures...

On Thursday, June 12, 2014 10:11:58 AM UTC-4, LoveWeb2py wrote:

 Hello,

 I'm trying to pass a variable which has json data into infovis for a 
 visualization

 It's interesting because when I type {{=XML(data)}} in the view I can see 
 the correct json data is being passed, but when I edit the .js file and try 
 to include the variable there nothing happens (it says undefined).

 Here is what i'm creating: 
 http://philogb.github.io/jit/static/v20/Jit/Examples/ForceDirected/example1.html

 If you click on example code you'll see they have json already defined 
 there in the , but I want to pass the json as a variable to the js file.

 When I copy and paste the json code from my view and paste it directly 
 into the .js it works fine, so I'm thinking I'm not passing the variable 
 properly.

 I've tried {{=XML(data)}} with and without quotes, and still the same 
 result.

 Any help is greatly appreciated!




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


[web2py] SQLFORM.grid search - boolean precedence? - nested queries?

2014-06-12 Thread Vincent
How would one go about doing the equivalent of  
A and (B or C)
in the grid or smartgrid search?
Tried reading the source but got lost.

Given 
db.person.firstname
db.person.lastname

this fails as an invalid query:
person.firstname = John and (person.lastname = Smith or person.lastname 
= Williams)

Boolean precedence also does not seem to be implemented (and before or) as 
this doesn't return the expected results:
person.firstname = John and person.lastname = Smith or person.firstname 
= John and person.lastname = Williams

Any suggestions?

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


[web2py] Re: SQLFORM.grid search - boolean precedence? - nested queries?

2014-06-12 Thread Derek
You have your queries all wrong. Can you share your code? You should use 
the python bitwise operators not the words. Also, why are you using 
assignment when you should be testing for equality?

On Thursday, June 12, 2014 2:35:25 PM UTC-7, Vincent wrote:

 How would one go about doing the equivalent of  
 A and (B or C)
 in the grid or smartgrid search?
 Tried reading the source but got lost.

 Given 
 db.person.firstname
 db.person.lastname

 this fails as an invalid query:
 person.firstname = John and (person.lastname = Smith or 
 person.lastname = Williams)

 Boolean precedence also does not seem to be implemented (and before or) as 
 this doesn't return the expected results:
 person.firstname = John and person.lastname = Smith or 
 person.firstname = John and person.lastname = Williams

 Any suggestions?


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


[web2py] Re: Is there a web2py plugin which lays out divs in a neat grid?

2014-06-12 Thread Spokes
Thanks, Derek. I'd like to not animate at all, and I've adjusted freewall's 
settings accordingly, to no avail. The animation effect only happens under 
particular circumstances (i.e. when the page is updated with an ajax call, 
rather than refreshed or loaded through a link), which makes me suspect 
that the animation in this particular case is a side-effect of the 
plugin's basic functionality, and something is going slightly screwy.

I tried masonry (that was actually the first one I tried), and there was 
some issue with that as well, but that was in the early stages of 
development, and I've since made some fixes to the site, so perhaps it's 
worth another look...

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


Re: [web2py] Re: SQLFORM.grid search - boolean precedence? - nested queries?

2014-06-12 Thread Vincent Chevrier
I guess I wasn't clear enough, my example queries are not python code, they
are text that would be entered in the search box in the default search
widget generated by SQLFORM.grid.

I know how to do it in python code, but I am looking for an answer
regarding if this is possible from the search box (and equivalently
directly by URL)

Thanks
Vincent


On Thu, Jun 12, 2014 at 5:38 PM, Derek sp1d...@gmail.com wrote:

 You have your queries all wrong. Can you share your code? You should use
 the python bitwise operators not the words. Also, why are you using
 assignment when you should be testing for equality?


 On Thursday, June 12, 2014 2:35:25 PM UTC-7, Vincent wrote:

 How would one go about doing the equivalent of
 A and (B or C)
 in the grid or smartgrid search?
 Tried reading the source but got lost.

 Given
 db.person.firstname
 db.person.lastname

 this fails as an invalid query:
 person.firstname = John and (person.lastname = Smith or
 person.lastname = Williams)

 Boolean precedence also does not seem to be implemented (and before or)
 as this doesn't return the expected results:
 person.firstname = John and person.lastname = Smith or
 person.firstname = John and person.lastname = Williams

 Any suggestions?

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


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