Re: [web2py] Re: Scheduler - a second try

2013-11-08 Thread Johann Spies
Postgresql


On 7 November 2013 15:16, Niphlod niph...@gmail.com wrote:

 what db are you using ?


 On Thursday, November 7, 2013 12:07:40 PM UTC+1, Johann Spies wrote:

 It was a year ago that I have tried for 4 days to get the scheduler
 working.  In the end I gave up and decided to use the operating systems's
 cron to handle scheduled jobs.

 I am trying again and so far I have no success.

 Running web2py with D0 I get the message

  DEBUG:web2py.scheduler.artikel#29645:sleeping...
 DEBUG:web2py.scheduler.artikel#29645:recording heartbeat (ACTIVE)
 DEBUG:web2py.scheduler.artikel#29645:freeing workers that have not
 sent heartbeat
 ERROR:web2py.scheduler.artikel#29645:Error cleaning up
 DEBUG:web2py.scheduler.artikel#29645:looping...
 INFO:web2py.scheduler.artikel#29645:nothing to do


 My scheduler is simple:

 # -*- coding: utf-8 -*-

 from gluon.scheduler import Scheduler
 scheduler = Scheduler(db)

 And in the scheduler_tasks table I have:
 scheduler_task.idhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.id
 scheduler_task.application_namehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.application_name
 scheduler_task.task_namehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.task_name
 scheduler_task.group_namehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.group_name
 scheduler_task.statushttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.status
 scheduler_task.function_namehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.function_name
 scheduler_task.uuidhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.uuid
 scheduler_task.argshttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.args
 scheduler_task.varshttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.vars
 scheduler_task.enabledhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.enabled
 scheduler_task.start_timehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.start_time
 scheduler_task.next_run_timehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.next_run_time
 scheduler_task.stop_timehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.stop_time
 scheduler_task.repeatshttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.repeats
 scheduler_task.retry_failedhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.retry_failed
 scheduler_task.periodhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.period
 scheduler_task.timeouthttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.timeout
 scheduler_task.sync_outputhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.sync_output
 scheduler_task.times_runhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.times_run
 scheduler_task.times_failedhttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.times_failed
 scheduler_task.last_run_timehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.last_run_time
 scheduler_task.assigned_worker_namehttp://localhost:8000/nkb/appadmin/select/db?orderby=scheduler_task.assigned_worker_name
 45 http://localhost:8000/nkb/appadmin/update/db/scheduler_task/45
 nkb/isiherboumainQUEUEDherbou15dc16e59-9e30...[]{}True2013-11-07 
 12:40:552013-11-07
 12:40:55None12 6006None

 with the starting time in the past.

 herbou1 is   a function in my isi-controller.


 I am not sure what I am supposed to do to get this workinig.

 Regards
 Johann

  --
 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/groups/opt_out.




-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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/groups/opt_out.


[web2py] Re: Converting python list into javascript array in views (web2py) ?

2013-11-08 Thread Alex
or use JSON.stringify to get the textual representation of the object. e.g.

alert(JSON.stringify(t));

Am Donnerstag, 7. November 2013 21:46:36 UTC+1 schrieb Niphlod:

 oh my.

 json_object *IS* an object (the name should have been pretty obvious).

 if you want the value of a, just do

 alert(t.a)

 On Thursday, November 7, 2013 9:30:31 PM UTC+1, Gaurav singh wrote:

 Sorry But its not working , its displying object obect in the pop up



-- 
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/groups/opt_out.


Re: [web2py] Re: Scheduler documentation question

2013-11-08 Thread Johann Spies
Thanks.  Please put that in the book.


On 7 November 2013 15:22, Niphlod niph...@gmail.com wrote:

 that if you have multiple workers you can have them assigned a multiple
 fraction of the work if you know that they'll process tasks faster.
 i.e. you have a local worker fetching from the interwebs big chunks of
 data. You observe that you're queueing tasks faster than that server can
 process them.
 You start another worker in another server and since it'll be just
 churning data, you want it to process 3 times the tasks the other worker
 gets (i.e. to offload the local worker).
 This means that when the scheduler ticker (the coordinator) sees two
 workers, it won't assign 5 tasks to one and 5 to the other, but 5 to the
 first and 15 to the second.
 In the end, the tasks will always be assigned and processed, but you can
 steer the assignment process acting on group names.



 On Thursday, November 7, 2013 10:19:45 AM UTC+1, Johann Spies wrote:

 Can somebody please explain to me what this sentence from the book is
 trying to tell me?

 ['mygroup','mygroup']. Tasks will be distributed taking into
 consideration that a worker with group_names ['mygroup','mygroup'] is
 able to process the double of the tasks a worker with group_names
 ['mygroup'] is.


 Regards
 Johann

 --
 Because experiencing your loyal love is better than life itself,
 my lips will praise you.  (Psalm 63:3)

  --
 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/groups/opt_out.




-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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/groups/opt_out.


[web2py] Re: response.files.append and response.files.insert

2013-11-08 Thread Leonel Câmara
This is actually a python question. It's the same difference that there is 
for a python list between an append and an insert. Append always adds the 
item to the end of the list, insert puts the item in the position you 
requested (the first argument).

In web2py terms the second version avoids problems if you append your own 
css files since the framework ones will always be positioned first so your 
styles, which will come later, take precedence.

-- 
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/groups/opt_out.


[web2py] Re: urllib2.HTTPError

2013-11-08 Thread Leonel Câmara
From what I could test the problem is that your query is wrong in one of 
those steps. Check exactly what you are putting there.

-- 
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/groups/opt_out.


[web2py] Re: R/W restrictions specific to a form

2013-11-08 Thread Leonel Câmara
The models get reloaded every request so you can just set the writable and 
readable attributes for the fields before creating the form and it will 
only affect this form.

For instance you could add this before your call  to SQLFORM.factory

db.auth_user.email.writable = db.auth_user.email.readable = False
db.auth_user.username.writable = db.auth_user.username.readable = False
db.auth_user.password.writable = db.auth_user.password.readable = False

(might want to use auth.settings.passfield on the last one)

Quinta-feira, 7 de Novembro de 2013 9:46:52 UTC, subbaram...@gmail.com 
escreveu:

 Hello All,
 I have these two tables
 db.auth_user - which is the default table created for Auth
 email, password, first name, last name

 db.b
 b0, b1, b2, b3

 db.b.b0 foreign-key linked to db.auth_user.id 

 My requirement: Display only fields first name, last name, b2, b3. Updates 
 can only happen to these fields, and no other. I do not want the password, 
 or email fields to be displayed, because I want to use the default change 
 password form to change passwords. 

 I experimented with
 form = SQLFORM.factory(db.auth_user, db.b)
 if form.process().accepted:
 id = db.auth_user.insert(**db.auth_user._filter_fields(form.vars)) # 
 this needs to be corrected to accept only first and last names.
 form.vars.b = id
 id = db.b.insert(**db.b._filter_fields(form.vars))


 Wasn't sure how to explicitly restrict writes to certain fields, only for 
 this form. It is possible that these fields need to be updated from a 
 different form.
 I had a look at this discussion on the forum, and it helped me understand 
 this a bit better, but not sure it helps my case: 
 https://groups.google.com/forum/#!topic/web2py/qd6blGfnVTA
 Also, factory seems to create a SQLFORM which does not work with the 
 database(?). So, am not sure how to proceed on this one. 

 
 Kiran Subbaramanhttp://subbaraman.wordpress.com/about/





-- 
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/groups/opt_out.


Re: [web2py] Re: Web2py freezing on live deployment!

2013-11-08 Thread Tim Richardson


 I had a puzzling problem with 2.7.4 as a rocket service on Windows 2003, 
 but this was a problem with sqlform.grids. There was a print statement left 
 in code which caused the service to stop working. This cause doesn't match 
 with your insights into the problem, but I mention it anyway. You only see 
 the problem when web2py is running as a service (I use nssm to create the 
 service, but this is not relevant). 

 

 The problem was very quickly fixed in trunk, but as far as I know the fix 
 is not in any stable version yet. 

 

 I'm still using 2.6.4 for production apps in this scenario (rocket as a 
 service on windows server). 


-- 
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/groups/opt_out.


[web2py] How to make registrations invitation-only with Janrain login/registrations

2013-11-08 Thread Dragan Matic
When using web2py authentication I can check if user is logging in or 
registering a new user and then I can check if it has proper invitation 
code in and deny him registration. 

But what if user is using Janrain? Login and registraton is then done 
through an external app. Is there a way to intercept registration and check 
for invitation code and deny it somehow if necessary?


-- 
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/groups/opt_out.


Re: [web2py] Re: Web2py freezing on live deployment!

2013-11-08 Thread Andrew Buchan
Yes, I've been caught out by that quite a few times! Not a problem with
Apached I may add, the wsgi file redirects stdout to show up in the apache
error log, but I suppose you could point it anywhere really.


On Fri, Nov 8, 2013 at 12:31 PM, Tim Richardson t...@growthpath.com.auwrote:

 I had a puzzling problem with 2.7.4 as a rocket service on Windows 2003,
 but this was a problem with sqlform.grids. There was a print statement left
 in code which caused the service to stop working. This cause doesn't match
 with your insights into the problem, but I mention it anyway. You only see
 the problem when web2py is running as a service (I use nssm to create the
 service, but this is not relevant).



 The problem was very quickly fixed in trunk, but as far as I know the fix
 is not in any stable version yet.



 I'm still using 2.6.4 for production apps in this scenario (rocket as a
 service on windows server).

  --
 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/PEC1uLfzlrU/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/groups/opt_out.


-- 
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/groups/opt_out.


[web2py] Re: Use view to generate a string

2013-11-08 Thread Leonel Câmara
I think what you want is a controller with a cached view, if it is then, 
check the example in the book 
http://web2py.com/book/default/chapter/04#cache for cache/view.

Of course that if you explain more thoroughly what you are trying to do, 
other options may be better.



Sexta-feira, 8 de Novembro de 2013 2:49:14 UTC, Scott Hunter escreveu:

 Is it possible to use a view to generate a string?  In this particular 
 case, I want to generate a snippet of HTML  cache it away.  I suppose this 
 could be done using straight python  helpers, but a view seems so much 
 more natural.

 - Scott


-- 
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/groups/opt_out.


[web2py] Re: Use view to generate a string

2013-11-08 Thread Niphlod
response.render is what you're seeking for ... 

On Friday, November 8, 2013 3:49:14 AM UTC+1, Scott Hunter wrote:

 Is it possible to use a view to generate a string?  In this particular 
 case, I want to generate a snippet of HTML  cache it away.  I suppose this 
 could be done using straight python  helpers, but a view seems so much 
 more natural.

 - Scott


-- 
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/groups/opt_out.


Re: [web2py] Re: Scheduler - a second try

2013-11-08 Thread Niphlod
the only thing is that only syslog-ng is multiprocess-safe, so the standard 
logging to file and/or console may incur in problems.

On Friday, November 8, 2013 5:46:29 AM UTC+1, Jonathan Lundell wrote:

 On 7 Nov 2013, at 7:05 PM, Andrew W awill...@gmail.com javascript: 
 wrote:

 Thanks.   I've never been quite sure what to put in logging.conf for the 
 scheduler debug key, based on the logger = statement in scheduler.py.


 We should add a schedule section to the logging example file.



-- 
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/groups/opt_out.


[web2py] Re: Use view to generate a string

2013-11-08 Thread Anthony
You can use the render() function:

import os
from gluon.template import render
mytext = cache.ram('mytext',
   lambda: render(filename=os.path.join(request.folder, 
'path', 'to', 'template.html')),
   time_expire=3600)

If the template contains any {{include ...}} directives, then you must also 
provide a path argument to render() specifying the file system path where 
any included files can be found. render() also takes a dictionary-like 
context argument and will render the template in the environment of that 
context. If you need the entire web2py environment available in the 
template, then set context=globals().

render(filename=os.path.join(request.folder, 'path', 'to', 'template.html'),
   path=os.path.join(request.folder, 'path', 'to', 'included', 
'templates')
   context=globals())

Anthony

On Thursday, November 7, 2013 9:49:14 PM UTC-5, Scott Hunter wrote:

 Is it possible to use a view to generate a string?  In this particular 
 case, I want to generate a snippet of HTML  cache it away.  I suppose this 
 could be done using straight python  helpers, but a view seems so much 
 more natural.

 - Scott


-- 
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/groups/opt_out.


Re: [web2py] OnSelect how to?

2013-11-08 Thread Richard Vézina
In the view with javascript you can do that :

To set content of session.var you will need a python function for that,
something like that :

def __create_update_session_var():
id = request.vars.id
value = request.vars.value
session.var = id
#or
#session.var = value
#or
#session.var = db.table(id).value

$(function() {
var id = $('#myselect option:selected').val();
// or
//var value = $('#myselect option:selected').text(); // But you don't
really need to you can get the value from the id

$.ajax({
  url: {{=URL('controller', 'create_update_session_var', vars=dict(id=id,
value=value))}}
});

});

Not tested, but you can work around this example the basic idea is there.
Note that javascript is asynchrone and for that reason the session.var may
not be there when you need it. But if you just need to put something in
session for the next page to load there should be no problem.

If you disclose more detail about what you really want to do, we can
propose other/better design...

Richard


On Thu, Nov 7, 2013 at 4:25 PM, greenpoise danel.sega...@gmail.com wrote:

 Hi Richard

 Thanks for the help. I keep looking. If I select the item from the
 autocomplete, I just want to grab the id and all the info pertaining to
 that record and put it in a session. I dont know how to do it. Do you have
 a better picture of my question?

 THanks again



 On Wednesday, November 6, 2013 7:21:44 AM UTC-8, Richard wrote:

 Wait, you just want to redirect on a list base on a drop box selected
 item?

 What do yo do with the list? Select again, or just consult?

 For the latter you can easely do it with 2 LOAD component into a
 container page. One component is your form with your dropbox and the other
 component containt you selected item list, it is empty at first and when
 you form id submit it get updated. You can do that with web2py_component()
 and LOAD().

 I can help you, by showing some piece of code that you could adapt.

 You can also avoid submitting the form by adding a piece of js that will
 submit the form onclick of a item in the dropbox...

 Richard


 On Wed, Nov 6, 2013 at 10:14 AM, Richard Vézina ml.richa...@gmail.comwrote:

 But I may be fooled by the title... I am not sure now if it a
 replacement for lazy option plugin - http://dev.s-cubism.com/
 plugin_lazy_options_widget - or not... I thought it was, but I didn't
 test it yet.

 But I use lazy_option_widget, and I broke it dependency to the other
 plugin... If you want the piece of js for that, just tell me.

 :)

 Richard


 On Wed, Nov 6, 2013 at 10:11 AM, Richard Vézina 
 ml.richa...@gmail.comwrote:

 No, this : https://groups.google.com/d/msg/web2py/HhK8o0RBDNc/Ralcjl_
 q5MQJ

 Conditional field...

 2.5.1

- New style virtual fields in grid
- Conditional fields (experimental) db.table.field.show_if =
db.table.otherfield==True or db.table.field.show_if =
db.table.otherfiel.contains(values)
- auth.settings.manager_group_role=manager enables http://.../app/
appadmin/auth_manage and http://.../app/appadmin/manage for members
of the manager group. (also experimental)
- support for POST variables in DELETE
- Fixed memory leak when using the TAG helper


 Richard


 On Tue, Nov 5, 2013 at 2:42 PM, greenpoise danel@gmail.com wrote:

 you mean this one?

 http://www.web2pyslices.com/slice/show/1724/cascading-
 dropdowns-simplified



 On Tuesday, November 5, 2013 10:57:08 AM UTC-8, Richard wrote:

 You want a kind of conditional drop down from what I understand...
 There recent new feature exactly for this...

 I don't know if it has been documented, but there is example of the
 synthax on the group.

 Richard


 On Tue, Nov 5, 2013 at 12:49 PM, greenpoise danel@gmail.comwrote:

 is very simple. The autocomplete works fine. The only thing that I
 want is once the product is searched and selected, to go into some sort 
 of
 list of items. So technically my subject is wrong, it should be OnClick
 instead of OnSelect:

 db.define_table('productsearch',




Field http://127.0.0.1:8000/examples/global/vars/Field('tilename'))



 db.productsearch.tilename.widget=SQLFORM 
 http://127.0.0.1:8000/examples/global/vars/SQLFORM.widgets.autocomplete(request
  
 http://127.0.0.1:8000/examples/global/vars/request,db.product.tilename,
  id_field=db.product.id)


 def psearch():
  form=SQLFORM http://127.0.0.1:8000/examples/global/vars/SQLFORM(
 db.productsearch)
  return dict(form=form)


 On Monday, November 4, 2013 6:07:42 PM UTC-8, Richard wrote:

 Can show you some code, but it is heavily customized so it may be
 not what you want...

 Just let me know.

 Richard


 On Mon, Nov 4, 2013 at 4:41 PM, greenpoise danel@gmail.comwrote:

 Thanks, will check!



 On Monday, November 4, 2013 12:10:59 PM UTC-8, Richard wrote:

 Notice this : http://stackoverflow.com/que
 stions/17903645/where-is-the-typeahead-javascript-module-in-
 bootstrap-3-rc-1

 Richard


 On Mon, Nov 4, 2013 at 2:58 PM, 

[web2py] Re: Problems with response.view =

2013-11-08 Thread David
It is rendering the 'test.html'

On Thursday, November 7, 2013 2:52:59 PM UTC-5, Niphlod wrote:

 put in your test.html an element and render the response.view value in it, 
 so you'll know what actually is the response.view passed ...




-- 
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/groups/opt_out.


Re: [web2py] Scheduler - a second try

2013-11-08 Thread Jonathan Lundell
On 8 Nov 2013, at 5:45 AM, Niphlod niph...@gmail.com wrote:

 the only thing is that only syslog-ng is multiprocess-safe, so the standard 
 logging to file and/or console may incur in problems.

That applies to more than the scheduler, though, and using syslog isn't so bad.

(Maybe we could add a database-based handler?)

In any event, the scheduler's current use of pid to distinguish logging 
facilities is problematic because it can't be configured. Or at least I don't 
think it can; I don't see any wildcard capability in the logging conf syntax. 
Have you actually used it? How?

 
 On Friday, November 8, 2013 5:46:29 AM UTC+1, Jonathan Lundell wrote:
 On 7 Nov 2013, at 7:05 PM, Andrew W awill...@gmail.com wrote:
 
 Thanks.   I've never been quite sure what to put in logging.conf for the 
 scheduler debug key, based on the logger = statement in scheduler.py.
 
 We should add a schedule section to the logging example file.
 

-- 
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/groups/opt_out.


[web2py] Re: Use view to generate a string

2013-11-08 Thread Anthony
Good point. You can also use response.render(), which may be a bit simpler:

mytext = cache.ram('mytext',
   lambda: response.render('path/to/template.html'),
   time_expire=3600)

The path must be relative to the app's /views folder (you can use ../ to 
get out of that folder), and the view will be rendered in the current 
web2py environment. response.render() also takes a dictionary-like second 
argument to add variables to the environment, as well as keyword arguments 
to do the same. The gluon.template.render() function provides a little more 
flexibility to render in a different environment and to more easily point 
to templates and included files outside the usual /views folder (or to use 
template code stored in the database).

Anthony

On Friday, November 8, 2013 8:43:07 AM UTC-5, Niphlod wrote:

 response.render is what you're seeking for ... 

 On Friday, November 8, 2013 3:49:14 AM UTC+1, Scott Hunter wrote:

 Is it possible to use a view to generate a string?  In this particular 
 case, I want to generate a snippet of HTML  cache it away.  I suppose this 
 could be done using straight python  helpers, but a view seems so much 
 more natural.

 - Scott



-- 
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/groups/opt_out.


Re: [web2py] Custom login form error display

2013-11-08 Thread Ruud Schroen
I got the errors working. I forgot to use form.errors like you said. Do you 
guys also know of a way to show an error if the password is incorrect?

-- 
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/groups/opt_out.


[web2py] Re: Problem getting auth.wiki('slug', env=dict(mytest=...)) to work in a view?

2013-11-08 Thread Chuck Paulson
After further experimentation, it seems the default is for the wiki page to 
get processed once when you submit it after editing. Further auth.wiki 
calls on that slug just retrieve the computed html, they do not do 
processing, hence the env argument is ignored. There is a force_render flag 
which would reprocess the wiki page, but of course that slows down page 
retrieval. Anyway, its working now and I wanted to let everyone know the 
answer.

On Tuesday, November 5, 2013 4:58:15 PM UTC-5, Chuck Paulson wrote:

 In a simple test app I have defined a controller, view, and wiki page. The 
 idea is that the controller decides which wiki page to display (ex. 
 'slug'), and the view calls auth.wiki() to get the wiki page. The wiki page 
 contains @{mytest:hi} which should be processed by the auth.wiki() call 
 in the view.

 The problem is that the @{mytest:hi} line in the wiki page does not do 
 anything. It is as if the env argument to the auth.wiki() call in the view 
 is ignored. Could someone tell me why this is? Is there is a workaround? 
 Thanks.

 The controller:

 def test():
 return dict(myslug='slug')

 The view:

 {{extend 'layout.html'}}
 h1This is the default/test.html template/h1
 {{=auth.wiki(myslug, env=dict(mytest=lambda x: %s-%s % (x,x)))}}
 {{=BEAUTIFY(response._vars)}}

 The 'slug':

 ## Slug
 @{mytest:hi}
 [[NEWLINE]]
 page content


-- 
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/groups/opt_out.


[web2py] Web2py (2.7.4) not working on IE9

2013-11-08 Thread Luca Zacchetti
Web2py (version 2.7.4) forms are not working on my IE9 browser.
Just tried with a fresh web2py installation and even the form to access 
to web2py admin interface is not working, it reloads itself without doing 
the login and every other forms in my app is doing the same.

Do you also have this kind of problem? How can I Fix it?

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/groups/opt_out.


[web2py] Re: Installing the jqmobile plugin

2013-11-08 Thread Philip Kilner
Hi All,

On 07/11/13 18:30, Philip Kilner wrote:
 Found a note here: -
 
 https://groups.google.com/forum/#!topic/web2py/W9b3RZBrmYQ
 
 ...where Massimo says the posted plugin online is old and broken (I
 need to fix it).now a working version of plugin jquery comes with
 web2py. It is in admin.
 
 ...which I imagine is out of date, but the link in the UI is to the
 online version, even though there is indeed a version in admin.
 

Nope, looks like I was wrong about that - the version offered in the
mobile preview page, which links to: -

http://web2py.com/plugins/static/web2py.plugin.jqmobile.w2p

...is very old and flat out does not work, so I think that Massimo's
comment above from March, still applies.

Creating an application, uploading this plugin, and fixing up the
layouts results in a broken application.

Copying the jqmobile-related files from the admin app to the broken app
fixes it - yay!

:-)

Should I open a ticket about this? If so, under web2py, or somewhere else?

I'm happy that I can get on with mobile-ising my app now, but I'm very
curious as to how other people have been installing this plugin?


-- 

Regards,

PhilK


e: p...@xfr.co.uk - m: 07775 796 747

'work as if you lived in the early days of a better nation'
- alasdair gray



-- 

Regards,

PhilK


'a bell is a cup...until it is struck'

-- 
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/groups/opt_out.


[web2py] Re: I need help understanding an issue with SQLFORM.factory ( in the context of a form wizard )

2013-11-08 Thread Carlos Zenteno
Don, can you tell me how you made it work?
I am not having any luck making it work and Anthony's 
answer has been deleted for some reason.

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/groups/opt_out.


[web2py] development server slow

2013-11-08 Thread Vinicius Assef
Hi guys, I'm facing an issue: in my development environment, my
browser stays waiting for static files (css and/or js) for a long
time.

It's not always, but it occurs *many* times.

When I use nginx this doesn't happen.

I'm using we2py 2.7.4, but his happens a long time in my ubuntu 12.04 precise.

Does anybody knows how to solve it?

-- 
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/groups/opt_out.


Re: [web2py] development server slow

2013-11-08 Thread Ovidio Marinho
I think this happened to me yesterday while trying to put controls in my
css bootstrap index.html

* Acho que aconteceu isto comigo ontem quando tentei inserir controles do
Bootstrap na minha index.html, travou.




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



2013/11/8 Vinicius Assef vinicius...@gmail.com

 Hi guys, I'm facing an issue: in my development environment, my
 browser stays waiting for static files (css and/or js) for a long
 time.

 It's not always, but it occurs *many* times.

 When I use nginx this doesn't happen.

 I'm using we2py 2.7.4, but his happens a long time in my ubuntu 12.04
 precise.

 Does anybody knows how to solve it?

 --
 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/groups/opt_out.


-- 
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/groups/opt_out.


[web2py] Autocomplete trigger callback function using ID

2013-11-08 Thread Ari Lion BR Sp
Dear All,

I have searched in the list, without success.
Is there a way to trigger a function after having filled Autocomplete (ID 
based) field?
(If I would use simple SELECT field, it would be easy - doing a onchage, 
but onchange  or onblur , but I have a very large database of products, 
impossible to load it in a SELECT).

Autocomplete  seems to conflict with widget onchange/onblur.

For example, I use Autocomplete to choose a Product in a Selling Invoice, 
and as I have thousands of products, Autocomplete is the only way to handle 
it. What I want is to populate a second field with the product/item price.

Is there a way for me to receive back the ID for a just autocompleted 
Product Field allowing me to use it at any function I want (such as a 
callback function)?
I succeed partialy to get it via jQuery pointing to the Input which 
contains the ID, but for some reason it only works at the second time I 
choose the same Product at the same field. 

Happy to receive answers.

Thanks and regards,
Ari

-- 
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/groups/opt_out.


[web2py] Re: Web2py (2.7.4) not working on IE9

2013-11-08 Thread Massimo Di Pierro
Can you isolate the problem?

On Friday, 8 November 2013 10:44:02 UTC-6, Luca Zacchetti wrote:

 Web2py (version 2.7.4) forms are not working on my IE9 browser.
 Just tried with a fresh web2py installation and even the form to access 
 to web2py admin interface is not working, it reloads itself without doing 
 the login and every other forms in my app is doing the same.

 Do you also have this kind of problem? How can I Fix it?

 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/groups/opt_out.


Re: [web2py] Re: Web2py (2.7.4) not working on IE9

2013-11-08 Thread Michele Comitini
cookies?


2013/11/8 Massimo Di Pierro massimo.dipie...@gmail.com

 Can you isolate the problem?


 On Friday, 8 November 2013 10:44:02 UTC-6, Luca Zacchetti wrote:

 Web2py (version 2.7.4) forms are not working on my IE9 browser.
 Just tried with a fresh web2py installation and even the form to access
 to web2py admin interface is not working, it reloads itself without doing
 the login and every other forms in my app is doing the same.

 Do you also have this kind of problem? How can I Fix it?

 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/groups/opt_out.


-- 
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/groups/opt_out.


Re: [web2py] Re: I need help understanding an issue with SQLFORM.factory ( in the context of a form wizard )

2013-11-08 Thread Richard Vézina
Anthony's answer :
https://groups.google.com/d/msg/web2py/AVes-nFhxnw/nF9J1tEo6_QJ


On Fri, Nov 8, 2013 at 12:36 PM, Carlos Zenteno cmzent...@gmail.com wrote:

 Don, can you tell me how you made it work?
 I am not having any luck making it work and Anthony's
 answer has been deleted for some reason.

 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/groups/opt_out.


-- 
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/groups/opt_out.


[web2py] Re: urllib2.HTTPError

2013-11-08 Thread sonu kumar
I checked my query it is working fine but I found error sometime when I run 

responsemmpn = urllib2.urlopen(requestmmpn)

In first go it throws below error but second time I run this same command 
it works fine for me. Why this is happening??

Traceback (most recent call last):
  File stdin, line 1, in module
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 124, in urlopen
return _opener.open(url, data, timeout)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 389, in open
response = meth(req, response)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 502, in http_response
'http', request, response, code, msg, hdrs)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 421, in error
result = self._call_chain(*args)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 361, in _call_chain
result = func(*args)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 608, in http_error_302
return self.parent.open(new)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 389, in open
response = meth(req, response)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 502, in http_response
'http', request, response, code, msg, hdrs)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 427, in error
return self._call_chain(*args)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 361, in _call_chain
result = func(*args)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py,
 
line 510, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found





On Friday, 8 November 2013 03:50:30 UTC-8, Leonel Câmara wrote:

 From what I could test the problem is that your query is wrong in one of 
 those steps. Check exactly what you are putting there.


-- 
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/groups/opt_out.


Re: [web2py] Re: I need help understanding an issue with SQLFORM.factory ( in the context of a form wizard )

2013-11-08 Thread Anthony
That answer is still on Google Groups. The message that was deleted was 
another message from Don_X and didn't appear to contain anything relevant 
to the problem solution.

Anthony

On Friday, November 8, 2013 1:41:00 PM UTC-5, Richard wrote:

 Anthony's answer :
 https://groups.google.com/d/msg/web2py/AVes-nFhxnw/nF9J1tEo6_QJ


 On Fri, Nov 8, 2013 at 12:36 PM, Carlos Zenteno 
 cmze...@gmail.comjavascript:
  wrote:

 Don, can you tell me how you made it work?
 I am not having any luck making it work and Anthony's 
 answer has been deleted for some reason.

 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+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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/groups/opt_out.


Re: [web2py] Scheduler - a second try

2013-11-08 Thread Niphlod
of course the syslog-ng makes sense only for the scheduler (but, if you're 
using uwsgi with multiple processes, syslog-ng is the only handler that 
works without issues, for the exact same limitation)
Logging into database (if not something like mongodb  co.) seems a little 
bit daunting, given that most of the problems are usually coming from 
database contention.

I'm not a logging guru, but scheduler identity is 

*web2py.scheduler*.%s % PID 

so *web2py.scheduler* works fine as qualname


[loggers]
keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome,scheduler

[logger_scheduler]
level=INFO
handlers=consoleHandler,rotatingFileHandler
qualname=web2py.scheduler


-- 
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/groups/opt_out.


[web2py] Re: Problems with response.view =

2013-11-08 Thread Niphlod
if so, there's a piece of your code resetting the response.view call.
Please attach a minimal app to reproduce the issue.

On Friday, November 8, 2013 3:24:52 PM UTC+1, David wrote:

 It is rendering the 'test.html'

 On Thursday, November 7, 2013 2:52:59 PM UTC-5, Niphlod wrote:

 put in your test.html an element and render the response.view value in 
 it, so you'll know what actually is the response.view passed ...




-- 
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/groups/opt_out.


[web2py] Re: urllib2.HTTPError

2013-11-08 Thread Leonel Câmara
Probably the server is doing the redirect wrong.

I would use something like this
http://stackoverflow.com/questions/554446/how-do-i-prevent-pythons-urllib2-from-following-a-redirect

To further inspect what's going on. Check the location you get in the 302.

-- 
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/groups/opt_out.


[web2py] is this possible db.table(id).field.represent

2013-11-08 Thread Richard
Hello,

How can I do this :

db.table(id).field.represent

Could a short cut be created to handle this use case?

{{=form.custom.begin}}
table class=table table-condensed table-hover
theadtrth{{=T('Field label')}}/th/tr/thead
tbody
{{for r in rows:}}
tr
{{if record_id is not None and r.id == record_id:}}
td{{=form.custom.widget.referenced_field_id}}/td

{{else:}}
td{{=db.table(r.id).referenced_field_id.represent
}}/td
   * !-- So I don't have to do --*
*!-- 
{{=db.referenced_table(r.referenced_field_id).field_representing_id_referenced}}
 
--*
{{pass}}
/tr
{{pass}}

/tbody
/table
{{=form.custom.end}}


Thanks

Richard

-- 
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/groups/opt_out.


[web2py] Re: Improving database performance

2013-11-08 Thread Jim S
Can you post some code to review?

-Jim

On Thursday, November 7, 2013 4:45:25 AM UTC-6, Arto Huhtala wrote:

 Hi,

 I am developing a test application with web2py to test database 
 performance. The idea is to see how long does it take to fetch information 
 from database on different loads.
 So far I have tested with SQLite and I've made test databases of size ~1K 
 and 10K.
 Now I'm trying to test a ~100K and ~1M databases, but once I have 
 populated the database to ~100K, the app is really slow. It takes forever 
 to load the plain index page.
 I tried to solve this by using PostgreSQL instead but still it takes 
 forever to load the index page. What gives?

 I have been looking advice on improving the performance and some have come 
 across (Deployment recipes from web2py book), but I also have questions 
 concerning them:


- Minimize the code in models: do not define functions there, define 
functions in the controllers that need them or - even better - define 
functions in modules, import them and use those functions as needed.

 Q: I need to manipulate database contents in separate functions but if I 
 place the code to a separate module it can't connect to the database.
 How can I access the database from separate module? Should I use the same 
 connection string in them as used in model files (db.py)?


- Do not put many functions in the same controller but use many 
controllers with few functions.

 Q: Do I need to create a view for every separate controller? Or can I use 
 the same view in many controllers?

 - Use indexes
 Q: Should indexes be defined in model file after defining tables or 
 somewhere else? So far I have found no difference in performance when 
 defining indexes.

 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/groups/opt_out.


Re: [web2py] is this possible db.table(id).field.represent

2013-11-08 Thread Anthony
Are you saying you want the represent function applied specifically to a 
reference field?

Note, a Row object does not know with what DAL table it is associated, so 
it can't automatically apply the represent attributes of its fields. 
However, the Rows object has a new .render() method for this purpose -- see 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Rendering-rows-using-represent.
 
In this case:

{{=db(db.table.id == id).select().render(0).field}}

Above, .render(0) extracts the first Row and applies the represent 
attributes to all fields.

For reference fields, you can also simply do a recursive select as long as 
you know the name of the field to be used to represent the reference:

{{=db.table(id).reference_field.field_in_referenced_table}}

Anthony


On Friday, November 8, 2013 4:06:40 PM UTC-5, Richard wrote:

 Hello,

 How can I do this :

 db.table(id).field.represent

 Could a short cut be created to handle this use case?

 {{=form.custom.begin}}
 table class=table table-condensed table-hover
 theadtrth{{=T('Field label')}}/th/tr/thead
 tbody
 {{for r in rows:}}
 tr
 {{if record_id is not None and r.id == record_id:}}
 td{{=form.custom.widget.referenced_field_id}}/td
 
 {{else:}}
 td{{=db.table(r.id).referenced_field_id.represent
 }}/td
* !-- So I don't have to do --*
 *!-- 
 {{=db.referenced_table(r.referenced_field_id).field_representing_id_referenced}}
  
 --*
 {{pass}}
 /tr
 {{pass}}

 /tbody
 /table
 {{=form.custom.end}}


 Thanks

 Richard


-- 
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/groups/opt_out.


Re: [web2py] Scheduler - a second try

2013-11-08 Thread Jonathan Lundell

On 8 Nov 2013, at 11:40 AM, Niphlod niph...@gmail.com wrote:

 of course the syslog-ng makes sense only for the scheduler (but, if you're 
 using uwsgi with multiple processes, syslog-ng is the only handler that works 
 without issues, for the exact same limitation)
 Logging into database (if not something like mongodb  co.) seems a little 
 bit daunting, given that most of the problems are usually coming from 
 database contention.

I was thinking a dedicated sqlite database for logging. I believe its support 
for multiple processes is adequate (reader/writer locks) for most logging 
purposes. And it'd be easy enough to browse.

 
 I'm not a logging guru, but scheduler identity is 
 
 web2py.scheduler.%s % PID 
 
 so web2py.scheduler works fine as qualname

That's good to know.

 
 
 [loggers]
 keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome,scheduler
 
 [logger_scheduler]
 level=INFO
 handlers=consoleHandler,rotatingFileHandler
 qualname=web2py.scheduler
 

-- 
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/groups/opt_out.


[web2py] AD LDAP Auth without creating Auth tables

2013-11-08 Thread GregD
We want to perform AD Auth but Web2Py seems to need to create the Auth 
Tables OR it want to see existing Auth tables. 

Our problem is that we're using an older database Firebird 1.5 and can't 
seem to get Web2Py to recognize Auth tables from that database.

Is there a way to do AD Auth without Web2Py needing to see Auth Tables? 
 After all, the username and password is stored in AD.

Thoughts?

Greg

-- 
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/groups/opt_out.


[web2py] Re: response.files.append and response.files.insert

2013-11-08 Thread 黄祥
thank you so much for your detail explaination leonel.

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/groups/opt_out.


Re: [web2py] Re: R/W restrictions specific to a form

2013-11-08 Thread Kiran Subbaraman

Leonel,
Thanks. Will try this out. Wasn't aware of auth.settings.passfield; any 
documentation around this? Looked for this here: 
http://web2py.com/books/default/chapter/29/09/access-control#Settings-and-messages


Finally, any thoughts on Also, factory seems to create a SQLFORM which 
does not work with the database(?). So, am not sure how to proceed on 
this one.



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 11/8/2013 5:49 PM, Leonel Câmara wrote:
The models get reloaded every request so you can just set the writable 
and readable attributes for the fields before creating the form and it 
will only affect this form.


For instance you could add this before your call  to SQLFORM.factory

db.auth_user.email.writable = db.auth_user.email.readable = False
db.auth_user.username.writable = db.auth_user.username.readable = False
db.auth_user.password.writable = db.auth_user.password.readable = False

(might want to use auth.settings.passfield on the last one)

Quinta-feira, 7 de Novembro de 2013 9:46:52 UTC, subbaram...@gmail.com 
escreveu:


Hello All,he
I have these two tables
db.auth_user - which is the default table created for Auth
email, password, first name, last name

db.b
b0, b1, b2, b3

db.b.b0 foreign-key linked to db.auth_user.id
http://db.auth_user.id

My requirement: Display only fields first name, last name, b2, b3.
Updates can only happen to these fields, and no other. I do not
want the password, or email fields to be displayed, because I want
to use the default change password form to change passwords.

I experimented with
|
form =SQLFORM.factory(db.auth_user,db.b)
ifform.process().accepted:
id
=db.auth_user.insert(**db.auth_user._filter_fields(form.vars))#
this needs to be corrected to accept only first and last names.
form.vars.b =id
id =db.b.insert(**db.b._filter_fields(form.vars))
|


Wasn't sure how to explicitly restrict writes to certain fields,
only for this form. It is possible that these fields need to be
updated from a different form.
I had a look at this discussion on the forum, and it helped me
understand this a bit better, but not sure it helps my case:
https://groups.google.com/forum/#!topic/web2py/qd6blGfnVTA
https://groups.google.com/forum/#%21topic/web2py/qd6blGfnVTA
Also, factory seems to create a SQLFORM which does not work with
the database(?). So, am not sure how to proceed on this one.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/  
http://subbaraman.wordpress.com/about/



--
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/groups/opt_out.


--
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/groups/opt_out.


Re: [web2py] Re: smartgrid divided in columns

2013-11-08 Thread kwebb
I know this is an older post.  Is it now possible to user radio buttons in 
smartgrid?
The documentation on this is light.

Many thanks!
Kris

On Wednesday, August 8, 2012 1:21:28 AM UTC-6, Johann Spies wrote:

 On 7 August 2012 15:40, Martin Weissenboeck mwei...@gmail.comjavascript:
  wrote:

 Additional question:
 is it possible to use radio buttons instead of checkboxes in a smart grid?


 I wish it was but I don't think it is possible with te present code.

 Regards

 Johann 
 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)



-- 
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/groups/opt_out.


[web2py] Re: retrieve auth_group.role from auth_user table

2013-11-08 Thread 黄祥
why the same query not work when i use it on smartgrid?
e.g.
def report_doctor():
query = (
(db.auth_user.id == db.auth_membership.user_id) 
(db.auth_membership.group_id == db.auth_group.id) 
(db.auth_group.role.like('doctor'))
)
#constraints = dict(auth_user = query)
constraints = {'auth_user' : query}
grid = SQLFORM.smartgrid(db.auth_user, constraints = constraints)
return locals()

it return an error :
Error snapshot [image: 
help]http://127.0.0.1:8000/admin/default/ticket/clinic/127.0.0.1.2013-11-09.08-54-12.1bf94417-c0a1-4922-8236-513068d1d392#
Detailed traceback description

type 'exceptions.AttributeError'('Row' object has no attribute 'address')

thanks and 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/groups/opt_out.


[web2py] Re: Problem getting auth.wiki('slug', env=dict(mytest=...)) to work in a view?

2013-11-08 Thread Dave S
On Friday, November 8, 2013 7:43:19 AM UTC-8, Chuck Paulson wrote:

 After further experimentation, it seems the default is for the wiki page 
 to get processed once when you submit it after editing. Further auth.wiki 
 calls on that slug just retrieve the computed html, they do not do 
 processing, hence the env argument is ignored. There is a force_render flag 
 which would reprocess the wiki page, but of course that slows down page 
 retrieval. Anyway, its working now and I wanted to let everyone know the 
 answer.


Thanks for the update!  Good work to track it down yourself.

/dps
 

-- 
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/groups/opt_out.


[web2py] Re: Improving database performance

2013-11-08 Thread Paolo Valleri
Hi,
if the index is slow with 100k dummy data you should create an index and on 
the other hand review your code. 
Create indexes on columns used by the query that generates the index; for 
what concerns the query, can you please post that code?
Finally, be aware that for the moment you should create the indexes outside 
web2py, there is a plan to add this feature in the upcoming releases see: 
https://code.google.com/p/web2py/issues/detail?id=1665sort=-id

Paolo
On Thursday, November 7, 2013 11:45:25 AM UTC+1, Arto Huhtala wrote:

 Hi,

 I am developing a test application with web2py to test database 
 performance. The idea is to see how long does it take to fetch information 
 from database on different loads.
 So far I have tested with SQLite and I've made test databases of size ~1K 
 and 10K.
 Now I'm trying to test a ~100K and ~1M databases, but once I have 
 populated the database to ~100K, the app is really slow. It takes forever 
 to load the plain index page.
 I tried to solve this by using PostgreSQL instead but still it takes 
 forever to load the index page. What gives?

 I have been looking advice on improving the performance and some have come 
 across (Deployment recipes from web2py book), but I also have questions 
 concerning them:


- Minimize the code in models: do not define functions there, define 
functions in the controllers that need them or - even better - define 
functions in modules, import them and use those functions as needed.

 Q: I need to manipulate database contents in separate functions but if I 
 place the code to a separate module it can't connect to the database.
 How can I access the database from separate module? Should I use the same 
 connection string in them as used in model files (db.py)?


- Do not put many functions in the same controller but use many 
controllers with few functions.

 Q: Do I need to create a view for every separate controller? Or can I use 
 the same view in many controllers?

 - Use indexes
 Q: Should indexes be defined in model file after defining tables or 
 somewhere else? So far I have found no difference in performance when 
 defining indexes.

 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/groups/opt_out.