Re: [web2py] Date null display

2013-02-15 Thread Simon Ashley
Thanks Bruno, that works.

(had tried that earlier, but didn't get it.
Time to flex off for the weekend, me thinks)

-- 

--- 
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 + exceptions(tickets) service?

2013-02-15 Thread Niphlod



 Thanks for the answer Niphlod, but didn't understand the last part about 
 being alerted(besides taking a look at the admin app).

 Cheers!


http://web2py.com/books/default/chapter/29/13#Collecting-tickets
and 
https://github.com/web2py/web2py/blob/master/scripts/tickets2email.py

If you need additional features contribute back some code (or at least the 
ideas :P)

-- 

--- 
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: 2 grids loaded in a single form: back button reference

2013-02-15 Thread Niphlod
uhm. Can you try passing different formname(s) to the grids ?
i.e. 

grid = SQLFORM.grid(db.dogs, ., formname='wholetthedogsout')
#and
grid = SQLFORM.grid(db.fleas, .., formname='itwasthefleas')


-- 

--- 
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 + exceptions(tickets) service?

2013-02-15 Thread Luciano Laporta Podazza
Whenever I think web2py can't surprise me with cool stuff it happens again
:P

Thanks Niphlod, you rock :D


On Fri, Feb 15, 2013 at 7:00 AM, Niphlod niph...@gmail.com wrote:



 Thanks for the answer Niphlod, but didn't understand the last part about
 being alerted(besides taking a look at the admin app).

 Cheers!


 http://web2py.com/books/default/chapter/29/13#Collecting-tickets
 and
 https://github.com/web2py/web2py/blob/master/scripts/tickets2email.py

 If you need additional features contribute back some code (or at least the
 ideas :P)

  --

 ---
 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.






-- 
Atte
Luciano Laporta Podazza

-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread Anthony
In the second and third cases, you delete session.order[id] but then try to 
return it, which will generate an error (so the response to the Ajax call 
will be a 500 error). This doesn't happen in the first case because the 
redirect happens before the return.

Anthony

On Thursday, February 14, 2013 10:36:24 PM UTC-5, 黄祥 wrote:

 hi,

 i'm trying to delete session using del session, and found strange 
 behaviour 

 for example
 *#**views/default/order.html*
 table width=100%
 {{for id, qty in order.items():}}
 {{p=db.product(id)}}
 tr
 td{{=p.product_name}}/td
 tdRp. {{=p.unit_price}}/td
 tdspan id={{='item%s'%p.id}}{{=qty}}/span
 {{=SPAN(A('+', callback=URL('order_callback', vars=dict(id=p.id, 
 action='add')), target='item%s'%p.id, _title='Add Product', _class='btn 
 btn-navbar'))}} {{=SPAN(A('-', callback=URL('order_callback', vars=dict(id=
 p.id, action='subtract')), target='item%s'%p.id, _title='Substract 
 Product', _class='btn btn-navbar'))}} *{{=SPAN(A('X', 
 callback=URL('order_callback', vars=dict(id=p.id, action='remove')), 
 delete='tr', _title='Remove Product', _class='btn btn-navbar'))}}*/td
 /tr
 {{pass}}
 /table
 *
 work*
 *#controllers/default.py*
 def order_callback():
 id=int(request.vars.id)
 if request.vars.action=='add':
 session.order[id]=session.order.get(id, 0)+1
 if request.vars.action=='subtract':
 session.order[id]=max(0,session.order.get(id, 0)-1)
 *if request.vars.action=='remove':*
 *del session.order[id]*
 *redirect(URL('product'))*
 return str(session.order[id])
 *
 not work*
 *#controllers/default.py*
 def order_callback():
 id=int(request.vars.id)
 if request.vars.action=='add':
 session.order[id]=session.order.get(id, 0)+1
 if request.vars.action=='subtract':
 session.order[id]=max(0,session.order.get(id, 0)-1)
 *if request.vars.action=='remove':*
 *del session.order[id]*
 *session.flash=T(Order Deleted!!!)*
 return str(session.order[id])
 *
 not work*
 *#controllers/default.py*
 def order_callback():
 id=int(request.vars.id)
 if request.vars.action=='add':
 session.order[id]=session.order.get(id, 0)+1
 if request.vars.action=='subtract':
 session.order[id]=max(0,session.order.get(id, 0)-1)
 *if request.vars.action=='remove':*
 *del session.order[id]*
 return str(session.order[id])

 my question is it normal, or there is something error or lack in my code?

 thank you so much before


-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Anthony
I like the idea of including the ANY and CUSTOM validators (we don't need 
ALL, though, right? -- that's the default behavior for a list of 
validators).

Anthony

On Thursday, February 14, 2013 10:04:03 PM UTC-5, rochacbruno wrote:

 It gives me the idea of a CUSTOM validator


 class CUSTOM(object):
 def __init__(self, function):
 self.function = function

 def __call__(self, value):
 # the function should return the error_message or None
 return(value, self.function(value))


 So the use should be:

 def my_validator_function(value):
  # do anything
  return error message or None

 db.table.field.requires = CUSTOM(my_validator_function)

 So, it works the same as onvalidation but can be applied in models.


-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Martin Weissenboeck
Very good ideas!
Ok, ALL is not necessary, but it could make a program more readable if
there is ANY in teh same program.


2013/2/15 Anthony abasta...@gmail.com

 I like the idea of including the ANY and CUSTOM validators (we don't need
 ALL, though, right? -- that's the default behavior for a list of
 validators).

 Anthony


 On Thursday, February 14, 2013 10:04:03 PM UTC-5, rochacbruno wrote:

 It gives me the idea of a CUSTOM validator


 class CUSTOM(object):
 def __init__(self, function):
 self.function = function

 def __call__(self, value):
 # the function should return the error_message or None
 return(value, self.function(value))


 So the use should be:

 def my_validator_function(value):
  # do anything
  return error message or None

 db.table.field.requires = CUSTOM(my_validator_function)

 So, it works the same as onvalidation but can be applied in models.

  --

 ---
 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.




-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Anthony
Maybe the custom validator could also allow for transformations:

class CUSTOM(object):
def __init__(self, validate=lambda value: None, transform=lambda value:value
):
self.validate = validate
self.transform = transform

def __call__(self, value):
# the validate function should return the error_message or None
return(self.transform(value), self.validate(value))

Anthony


On Thursday, February 14, 2013 10:04:03 PM UTC-5, rochacbruno wrote:

 It gives me the idea of a CUSTOM validator


 class CUSTOM(object):
 def __init__(self, function):
 self.function = function

 def __call__(self, value):
 # the function should return the error_message or None
 return(value, self.function(value))


 So the use should be:

 def my_validator_function(value):
  # do anything
  return error message or None

 db.table.field.requires = CUSTOM(my_validator_function)

 So, it works the same as onvalidation but can be applied in models.


-- 

--- 
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: custom auth table on separate file not in db.py

2013-02-15 Thread Anthony


 when upgrade to the new version, web2py will updated the scaffolding that 
 generated by default (like db.py, menu.py, default.py, layout.html, css, 
 etc), isn't it?


Well, it won't actually update your specific application files, which are 
just a copy of the welcome app (it will only update the welcome app 
itself). You will have to manually copy the new files to your app. But it's 
probably not a good idea to do this anyway -- when changes are made to the 
scaffolding app, there's no guarantee that those changes will then work 
properly with your separate model, view, and controller files. The 
scaffolding app really isn't intended to be frozen, with an app being built 
around it, as you are attempting. You're probably creating more trouble for 
yourself than it is worth. If there are minor changes to the scaffolding 
app in the future, you can just copy the changes you like. In general, the 
model and controller files aren't likely to change that much anyway.

Anthony

-- 

--- 
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] Send Email with Web2py on GAE development framework

2013-02-15 Thread José Manuel López Muñoz
Hi, 
I'm trying to send an email from GAE (mac OS), and I've config the mail 
settings. 
Now I'm getting this into the LOG:

INFO 2013-02-15 10:19:36,770 mail_stub.py:138] MailService.Send

From: x...@gmail.com

 To: x...@gmail.com

 Reply-to: u...@example.com

 Subject:Identificador 8E de su compra

 Body:

   Content-type: text/plain

   Data length: 8

INFO 2013-02-15 10:19:36,771 mail_stub.py:294] You are not currently 
sending out real email.  If you have sendmail installed you can use it by 
using the server with --enable_sendmail

How can I send real email from the development framework  without uploading 
the App to GAE?.

Thank you!

-- 

--- 
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: How to include a select field in a many to many relationship

2013-02-15 Thread José Manuel López Muñoz
Thank you Derek, I've search an example. I will try it. 


On Thursday, February 14, 2013 9:14:01 PM UTC+1, Derek wrote:

 You could make it a list:reference and then process that on accept by 
 assigning the appropriate groups.

 On Wednesday, February 13, 2013 11:58:02 PM UTC-7, José Manuel López Muñoz 
 wrote:

 Hi, 
 I want to make a user creation form, and I need to select the group that 
 this user belongs. 
 As you know the user have a many to many relation with group using 
 membership, here is the book chapter: 
 http://web2py.com/books/default/chapter/29/9#Access-Control 
 I don't know how to make a form in where I can select the group of this 
 new user, I need a selection field. Do I need to code it or there is any 
 way to make this with SQLFORM or something like that?.

 Thank you for your help



-- 

--- 
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: 2 grids loaded in a single form: back button reference

2013-02-15 Thread Simon Ashley
Thanks Niphlod, that worked.

(Eventually. 
Had some weird caching going on. 
The submit was originally redirecting to an unrelated controller and 
function. 
Eventually cleared itself after deleting and reinserting the formname 
attribute.
Using current trunk)

-- 

--- 
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] Submit button Id

2013-02-15 Thread waqasiqbal . knysys
I want to access submit button id but the button is created in CRUD form, 
is there any way possible to access the id of submit type button??
I want to show fancy popup using that ID..

 

-- 

--- 
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: Submit button Id

2013-02-15 Thread Niphlod
$('form :submit').attr('id') ?

On Friday, February 15, 2013 1:10:30 PM UTC+1, waqasiqb...@gmail.com wrote:

 I want to access submit button id but the button is created in CRUD form, 
 is there any way possible to access the id of submit type button??
 I want to show fancy popup using that ID..

  


-- 

--- 
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: Submit button Id

2013-02-15 Thread Anthony
The submit button doesn't have an ID, but you can identify it in the DOM 
via type=submit. Or you can add an ID:

form.element(_type='submit').update(_id='myid')

Anthony

On Friday, February 15, 2013 7:10:30 AM UTC-5, waqasiqb...@gmail.com wrote:

 I want to access submit button id but the button is created in CRUD form, 
 is there any way possible to access the id of submit type button??
 I want to show fancy popup using that ID..

  


-- 

--- 
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: 2 grids loaded in a single form: back button reference

2013-02-15 Thread Niphlod
the problem is that by default the referrer (i.e. the last page browsed, 
that of course is used to fill the back link) is stored in a session 
variable: fortunately it is formname dependant.
https://github.com/niphlod/web2py/blob/master/gluon/sqlhtml.py#L1833
Maybe we could use a formname='auto' parameter that fills the formname with 
something request dependant, such as %s_%s % (request.controller, 
request.function), so if the grid(s) comes from a different function it 
automatically works without having to rely on the explicit different 
formname parameter. If so, please open a ticket pointing to this thread.

However, I was glad to help.

On Friday, February 15, 2013 12:36:50 PM UTC+1, Simon Ashley wrote:

 Thanks Niphlod, that worked.

 (Eventually. 
 Had some weird caching going on. 
 The submit was originally redirecting to an unrelated controller and 
 function. 
 Eventually cleared itself after deleting and reinserting the formname 
 attribute.
 Using current trunk)


-- 

--- 
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] Scheduler Task + Worker + Run with DAL

2013-02-15 Thread operE Aperte
Hi all,

I need to merge scheduler task, worker and run tables to get in one Rows 
object all the tasks, their assigned workers and the last run for each task.
With sql I can achieve this with something like:
rows_sch=db.executesql(SELECT t.*,w.*,r.* 
FROM SCHEDULER_TASK AS t
LEFT JOIN SCHEDULER_WORKER AS w ON 
t.ASSIGNED_WORKER_NAME=w.WORKER_NAME 
LEFT JOIN (SELECT * FROM SCHEDULER_RUN AS a
   NATURAL LEFT JOIN
   (SELECT SCHEDULER_TASK,MAX(START_TIME) 
AS START_TIME_MAX FROM SCHEDULER_RUN
GROUP BY SCHEDULER_TASK) AS b 
   WHERE START_TIME=START_TIME_MAX) r
ON t.ID=r.SCHEDULER_TASK)

but I can't get this working with DAL, mostly because it seems I can't use 
the select left option with groupby and having.
Any suggestion?

-- 

--- 
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] restrict multiple services decorators?

2013-02-15 Thread ecall
I'd like to have a service using multiple decorators.

e.g.
@service.run
@service.json
def concat(a,b):
return a+b


Calls such as:
http://127.0.0.1:8000/app/default/call/run/concat/hello/world
http://127.0.0.1:8000/app/default/call/json/concat/hello/world

But XML works as well?

How can I restrict to some decorators?

Thanks

-- 

--- 
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: Submit button Id

2013-02-15 Thread Waqas Iqbal
i will try both of these , i think one of them  will be the optimum
solution.
thanks alot Anthony and Niphlod.

Best Regards,

Waqas Iqbal | Associate Software Engineer

[image: Inline image 1] http://www.knysys.com/

W +92-21-34972358 | M +92-342-3146972

Gtalk: waqasiqbal.knysys| wiq...@knysys.com jk...@knysys.com**

www.knysys.com | www.knyapps.com


On Fri, Feb 15, 2013 at 5:22 AM, Anthony abasta...@gmail.com wrote:

 The submit button doesn't have an ID, but you can identify it in the DOM
 via type=submit. Or you can add an ID:

 form.element(_type='submit').update(_id='myid')

 Anthony

 On Friday, February 15, 2013 7:10:30 AM UTC-5, waqasiqb...@gmail.comwrote:

 I want to access submit button id but the button is created in CRUD form,
 is there any way possible to access the id of submit type button??
 I want to show fancy popup using that ID..



  --

 ---
 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.




-- 

--- 
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.


image.png

[web2py] anyone using the Issue Tracker appliance?

2013-02-15 Thread Jim S
I can't get it to upload through the admin interface.  I just get a message 
saying 'unable to install application ticket'.

Jim

-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Bruno Rocha
Great idea Anthony, CUSTOM can be used in many ways when a builtin
validator does not match the requirements.

I documented this here:
http://rochacbruno.com.br/more-web2py-custom-validators/


@Massimo

Can we include at least the CUSTOM in gluon.validators ?

-- 

--- 
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: Scheduler Task + Worker + Run with DAL

2013-02-15 Thread Niphlod
DAL can abstract some deal of queries but not such complex ones. Either you 
use executesql or you create a view and access it inside web2py as a fake 
table defining it with migrate=False.
PS: unless for some weird requirements, that select is incredibly expensive.
You'd be better off fetching the task, the worker associated and the 
scheduler_run record with the max id with scheduler_task == id of the task 
(it'll do the max with the PK of the scheduler_run table and the groupby on 
the FK).

On Friday, February 15, 2013 2:21:39 PM UTC+1, operE Aperte wrote:

 Hi all,

 I need to merge scheduler task, worker and run tables to get in one Rows 
 object all the tasks, their assigned workers and the last run for each task.
 With sql I can achieve this with something like:
 rows_sch=db.executesql(SELECT t.*,w.*,r.* 
 FROM SCHEDULER_TASK AS t
 LEFT JOIN SCHEDULER_WORKER AS w ON 
 t.ASSIGNED_WORKER_NAME=w.WORKER_NAME 
 LEFT JOIN (SELECT * FROM SCHEDULER_RUN AS a
NATURAL LEFT JOIN
(SELECT SCHEDULER_TASK,MAX(START_TIME) 
 AS START_TIME_MAX FROM SCHEDULER_RUN
 GROUP BY SCHEDULER_TASK) AS b 
WHERE START_TIME=START_TIME_MAX) r
 ON t.ID=r.SCHEDULER_TASK)

 but I can't get this working with DAL, mostly because it seems I can't use 
 the select left option with groupby and having.
 Any suggestion?



-- 

--- 
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] type 'exceptions.KeyError' 'appadmin' on trying ot load data admin

2013-02-15 Thread Andrew Buchan


Here's the exception I get:


Traceback (most recent call last):
  File C:\Program Files\Hub Pages\web2py\gluon\restricted.py, line 212, in 
restricted
exec ccode in environment
  File C:/Program Files/Hub 
Pages/web2py/applications/HubFormsTidy/views/appadmin.html 
http://localhost/admin/default/edit/HubFormsTidy/views/appadmin.html, line 
86, in module
{{elif request.function=='update':}}
KeyError: 'appadmin'



-- 

--- 
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] requires _ verification = True , no Flash?

2013-02-15 Thread António Ramos
Its not working the flash message


def checkInbox(form):
print on_accept triggered
response.flash = Por favor verifique a sua caixa de correio
print end

after my auth custom fields and
auth.define_tables()
i have
auth.settings.register_onaccept = checkInbox

I see in console log the on accepted triggered but no flash  and then
end
i tried also response but no luck.



2013/2/4 António Ramos ramstei...@gmail.com

 thank you

 2013/2/4 Bruno Rocha rochacbr...@gmail.com

 def flash(user): response.flash = Please check your inbox





-- 

--- 
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] Database connection error

2013-02-15 Thread Hector Magnanao
Can someone help me out with an annoying database connection problem ?
 
I have a local database in my PC using MySQL.  I created the tables and 
loaded the data.  But whenever I try to start my application,  it keeps 
saying that some table already exist 

127.0.0.1.2013-02-15.09-51-45.a00216cb-bedd-484c-b1be-e79b3fd7d3e7
class 'gluon.contrib.pymysql.err.InternalError' (1050, uTable 
'location_tracking' already exists)

I have another application that uses this database already.  All I want to 
do is create another application using tthe same database schema.  Is this 
possible ?

-- 

--- 
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: Database connection error

2013-02-15 Thread Niphlod
yep, but you have either to:
1. copy over the databases/ folder (the .table files holds the state of the 
tables on the db as far as web2py knows, so the 2nd one if doesn't find the 
table files thinks it has to create them)
2. set migrate=False for the tables on the 2nd app (so web2py will trust 
your models and never try to create any table). Usually on the 2nd app you 
want to do
db = DAL('same uri as the one for the 1st app', migrate_enabled=False)
##optionally auth.define_table(migrate=False) 

3. fake migrate all the tables on the 2nd app (so web2py will trust that 
the current model is in sync with the db and recreate the .table files)
db = DAL('same uri as the one for the 1st app', fake_migrate_all=True)
  then hit the appadmin (one time only is enough to create the files), then 
continue with
db = DAL('same uri as the one for the 1st app')

I vote for 2.

-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread 黄祥
thank you so much for your detail explaination about the differnce logic, 
anthony.
according to your explaination about return so that i've modified into :

*#controllers/default.py*
def order_callback():
id=int(request.vars.id)
if request.vars.action=='add':
session.order[id]=session.order.get(id, 0)+1
if request.vars.action=='subtract':
session.order[id]=max(0,session.order.get(id, 0)-1)
*if request.vars.action=='remove':*
*del session.order[id]*
*return locals()*
return str(session.order[id])

is the logic above is correct? i mean there is two return types in 1 
definition, is it allowed? i've already tested it, it can work same like 
using redirect, if it not correct or not allowed, should i create into the 
different definition like :

*#controllers/default.py*
def order_callback():
id=int(request.vars.id)
if request.vars.action=='add':
session.order[id]=session.order.get(id, 0)+1
if request.vars.action=='subtract':
session.order[id]=max(0,session.order.get(id, 0)-1)
*if request.vars.action=='remove':*
*del session.order[id]*
*redirect(URL('product'))*
return str(session.order[id])

def order_remove():
id=int(request.vars.id)
del session.order[id]
return locals()

*#**views/default/order.html*
table width=100%
{{for id, qty in order.items():}}
{{p=db.product(id)}}
tr
td{{=p.product_name}}/td
tdRp. {{=p.unit_price}}/td
tdspan id={{='item%s'%p.id}}{{=qty}}/span
{{=SPAN(A('+', callback=URL('order_callback', vars=dict(id=p.id, 
action='add')), target='item%s'%p.id, _title='Add Product', _class='btn 
btn-navbar'))}} {{=SPAN(A('-', callback=URL('order_callback', vars=dict(id=
p.id, action='subtract')), target='item%s'%p.id, _title='Substract 
Product', _class='btn btn-navbar'))}} *{{=SPAN(A('X', 
callback=URL('order_remove', vars=dict(id=p.id)), delete='tr', 
_title='Remove Product', _class='btn btn-navbar'))}}*/td
/tr
{{pass}}
/table

both are work, i've already test it.

thank you

-- 

--- 
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: Database connection error

2013-02-15 Thread Hector Magnanao
Awesome !!! Option 2 worked.  Thanks.

On Friday, February 15, 2013 10:00:54 AM UTC-6, Niphlod wrote:

 yep, but you have either to:
 1. copy over the databases/ folder (the .table files holds the state of 
 the tables on the db as far as web2py knows, so the 2nd one if doesn't find 
 the table files thinks it has to create them)
 2. set migrate=False for the tables on the 2nd app (so web2py will trust 
 your models and never try to create any table). Usually on the 2nd app you 
 want to do
 db = DAL('same uri as the one for the 1st app', migrate_enabled=False)
 ##optionally auth.define_table(migrate=False) 

 3. fake migrate all the tables on the 2nd app (so web2py will trust that 
 the current model is in sync with the db and recreate the .table files)
 db = DAL('same uri as the one for the 1st app', fake_migrate_all=True)
   then hit the appadmin (one time only is enough to create the files), 
 then continue with
 db = DAL('same uri as the one for the 1st app')

 I vote for 2.



-- 

--- 
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: custom auth table on separate file not in db.py

2013-02-15 Thread 黄祥
thank you so much for your detail explaination anthony.
i understand now, so that i'm just focus on the created the layout.html and 
created layout_custom.html for example which is often update when the new 
vesion is arrive.

-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Massimo Di Pierro
I changed the IS_EXPR validator to allow the same notation suggested for 
CUSTOM. Can you check?


On Thursday, 14 February 2013 21:04:03 UTC-6, rochacbruno wrote:

 It gives me the idea of a CUSTOM validator


 class CUSTOM(object):
 def __init__(self, function):
 self.function = function

 def __call__(self, value):
 # the function should return the error_message or None
 return(value, self.function(value))


 So the use should be:

 def my_validator_function(value):
  # do anything
  return error message or None

 db.table.field.requires = CUSTOM(my_validator_function)

 So, it works the same as onvalidation but can be applied in models.


-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread Anthony
Yes, you can have multiple return statements in different logic branches of 
a function.

Anthony

On Friday, February 15, 2013 11:44:02 AM UTC-5, 黄祥 wrote:

 thank you so much for your detail explaination about the differnce logic, 
 anthony.
 according to your explaination about return so that i've modified into :

 *#controllers/default.py*
 def order_callback():
 id=int(request.vars.id)
 if request.vars.action=='add':
 session.order[id]=session.order.get(id, 0)+1
 if request.vars.action=='subtract':
 session.order[id]=max(0,session.order.get(id, 0)-1)
 *if request.vars.action=='remove':*
 *del session.order[id]*
 *return locals()*
 return str(session.order[id])

 is the logic above is correct? i mean there is two return types in 1 
 definition, is it allowed? i've already tested it, it can work same like 
 using redirect, if it not correct or not allowed, should i create into the 
 different definition like :

 *#controllers/default.py*
 def order_callback():
 id=int(request.vars.id)
 if request.vars.action=='add':
 session.order[id]=session.order.get(id, 0)+1
 if request.vars.action=='subtract':
 session.order[id]=max(0,session.order.get(id, 0)-1)
 *if request.vars.action=='remove':*
 *del session.order[id]*
 *redirect(URL('product'))*
 return str(session.order[id])

 def order_remove():
 id=int(request.vars.id)
 del session.order[id]
 return locals()

 *#**views/default/order.html*
 table width=100%
 {{for id, qty in order.items():}}
 {{p=db.product(id)}}
 tr
 td{{=p.product_name}}/td
 tdRp. {{=p.unit_price}}/td
 tdspan id={{='item%s'%p.id}}{{=qty}}/span
 {{=SPAN(A('+', callback=URL('order_callback', vars=dict(id=p.id, 
 action='add')), target='item%s'%p.id, _title='Add Product', _class='btn 
 btn-navbar'))}} {{=SPAN(A('-', callback=URL('order_callback', vars=dict(id=
 p.id, action='subtract')), target='item%s'%p.id, _title='Substract 
 Product', _class='btn btn-navbar'))}} *{{=SPAN(A('X', 
 callback=URL('order_remove', vars=dict(id=p.id)), delete='tr', 
 _title='Remove Product', _class='btn btn-navbar'))}}*/td
 /tr
 {{pass}}
 /table

 both are work, i've already test it.

 thank you


-- 

--- 
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] Connecting to MySQL via SSL

2013-02-15 Thread Richard Vézina
Better use SSH with port fowarding...

Something like that in terminal :

ssh -L3307:localhost:3306 linux_user@ip_address

Then you should be able to use this connection string :

db=DAL('mysql://user:pwd@127.0.0.1:3307/database', ...)

Not tested...

Richard


On Thu, Feb 14, 2013 at 6:08 PM, Osman Masood oamas...@gmail.com wrote:

 Hi,
 I'm trying to connect get web2py to connect to MySQL via SSL (or SSH).
 Based on the code, seems like I need to do something like:

 db = DAL('..',
 driver_args=dict(ssl=dict(ca='/path/to/mysql-ssl-ca-cert.pem')))

 (I only need the CA cert file, the key and certificate files are not
 needed for the connection.)

 It works through my SQL client (Sequel Pro), but not through web2py.
 Anyone have any ideas? It gives me the following error message:

 type 'exceptions.RuntimeError' Failure to connect, tried 5 times:
 Traceback (most recent call last): File
 /Users/oamasood/src/web2py/gluon/dal.py, line 6853, in __init__
 self._adapter = ADAPTERS[self._dbname](**kwargs) File
 /Users/oamasood/src/web2py/gluon/dal.py, line 2402, in __init__ if
 do_connect: self.reconnect() File
 /Users/oamasood/src/web2py/gluon/dal.py, line 576, in reconnect
 self.connection = f() File /Users/oamasood/src/web2py/gluon/dal.py, line
 2400, in connector return self.driver.connect(**driver_args) File
 /Users/oamasood/src/web2py/gluon/contrib/pymysql/__init__.py, line 93, in
 Connect return Connection(*args, **kwargs) File
 /Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py, line
 575, in __init__ self._connect() File
 /Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py, line
 741, in _connect self._request_authentication() File
 /Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py, line
 796, in _request_authentication self._send_authentication() File
 /Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py, line
 822, in _send_authentication self.socket =
 ssl.wrap_self.socketet(self.socket, keyfile=self.key, AttributeError:
 'module' object has no attribute 'wrap_self'


 Thanks,
 Osman

 --

 ---
 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.




-- 

--- 
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: Setting up memcache on GAE - a basic question

2013-02-15 Thread howesc
i did some grepping of my code and found some things

 - it seems that cache.ram is automatically set to GAE memcache when you 
are using GAE.  it's part of the GAE setup web2py does for you.
 - the code above looks OK for storing sessions in memcache.  FWIW, I gave 
up using memcache for sessions because the eviction time was too short for 
my need on GAE (about 5 mins was the best i could get)

I am using memcache on GAE quite a bit, so it for sure can work.  Can you 
post the stack trace from the GAE logs (SDK or production) that you are 
seeing?

thanks,

cfh

On Thursday, February 14, 2013 2:33:37 AM UTC-8, Andy W wrote:

 I would like to store both session data and cached data in memcache when I 
 upload my app to GAE. Can anybody point me in the right direction for 
 setting this up?

 Based on the web2py scaffolding app I have tried (in models/db.py):

 if not request.env.web2py_runtime_gae:
 db = DAL('sqlite://storage.sqlite', lazy_tables=True)
 else:
 db = DAL('google:datastore', lazy_tables=True)
 from gluon.contrib.memdb import MEMDB
 from google.appengine.api.memcache import Client
 session.connect(request, response, db = MEMDB(Client()))
 cache.ram = cache.disk = cache.memcache

 My app runs OK on sqlite but, once moved to GAE I get an Internal Error 
 whenever serving a page that attempts to store cache data in memcache.

 From http://web2py.com/books/default/chapter/29/13?search=cache#MemcacheI see 
 there is a suggestion to use:

 from gluon.contrib.gae_memcache import MemcacheClient
 from gluon.contrib.memdb import MEMDB
 cache.memcache = MemcacheClient(request)

 I don't understand how this relates to the scaffolding app code - what is 
 MEMDB, what is the correct usage of gluon.contrib.gae_memcache 
 and google.appengine.api.memcache?

 Trial and error has got me nowhere, so I thought I would confess my 
 ignorance and ask the experts!

 Andy


-- 

--- 
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: Integrating iPhone device tokens into web2py auth

2013-02-15 Thread howesc
Yes, that sounds similar to what i do.

 - i created a custom auth user table, it happens to be called end_user 
(though it can be called auth_user):
auth.settings.table_user_name = 'end_user'
auth.settings.table_user = db.end_user.table
auth.define_tables()
 - My end_user table has some fun fields, the one you are interested in is:
Field('apns_tokens', 'list:string')
 - Oauth happens with the client
 - client then does a POST to our api (/api/v7/user) with the APNS token as 
the payload
 - if i don't already have the APNS token i add it to the list and register 
it with my APNS service (you may use a 3rd party service such as 
UrbanAirship or Parse, or build your own)
 - note that i keep a list of tokens because my users have multiple devices 
and so multiple tokens.
 - we are starting our android port nowso i don't have an opinion about 
that yet.

does that help?

cfh 


On Wednesday, February 13, 2013 9:52:10 PM UTC-8, chris_g wrote:

 Thanks for all the interesting responses.

 Here is Apple's description of the Push notificaiton process:
 
 http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html

 There appears to be a similar framework for Android:
 http://developer.android.com/google/gcm/index.html

 To clarify, this process uses a Device Token which is generated per 
 app/iPhone . The UDID is not shared with the notification provider (ie the 
 web2py app).
 This process is not designed as an alternative to authentication. I am 
 looking at OAuth in addition to Push notifications. Push notifications It 
 is merely to notify the user of status changes with the application.

 Fortunately my potential requirement will only involve authenticated users 
 receiving notifications. I would be guessing that the Device token would be 
 attached to the session data and/or to the auth_event table.
 Presumably, users can be simultaneously logged in on iOS and Android 
 devices and would expect to receive the correct notifications for their 
 respective devices.

 At this point I have done very little research into this, but I wanted to 
 start discussing these schemes with other developers who are encounter 
 similar needs.





-- 

--- 
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: serving php and python in shared hosting

2013-02-15 Thread José Eloy
Thanks howesc. I'll read these documents.

Regards.

-- 

--- 
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: custom auth table on separate file not in db.py

2013-02-15 Thread LightDot
I'd say that common work flow when creating new web2py applications is:

- create a new application trough admin. Name it for example init (if you 
want it to be the default, without touching the routes) or something else
- edit it, either trough admin's embedded editor or by other means
- once you're done, remove all other applications (even admin), except your 
own.

The application you create trough admin will be pre-populated with a 
scaffolding application's contents, ie. it will be the same as the 
welcome application. If you don't want this, simply create a new 
directory within the applications directory and go from there. This 
approach is much harder, but it can be done.

When you upgrade web2py, your application will not be changed in any way. 
It won't be touched at all. What ever you change / delete / add will remain 
so.

I find that many users think of the welcome application as an integral 
part of web2py. I don't see it like that at all. It's a great example and 
it's provided to let everybody start coding faster. There are many useful 
references in it, good practices, suggestions, etc. But you could be using 
web2py completely without it. Your application could be completely 
different than welcome was, down to the last css line. You don't need to 
use anything from the welcome app. Don't like Bootstrap? Don't use it. 
Don't like analytics.js? Don't use it. Etc.

I would advise against calling your application welcome or editing 
welcome directly, unless you have a valid reason to use this approach. 
I'd recommend keeping the welcome application around as a reference if 
you need it, but delete it altogether once your application is ready to go 
public. Further, I'd remove all applications you don't use, even admin. 
Perhaps keep it as a backup or simply extract it from the web2py archive 
if/when you need it - once your application is finished and goes public, of 
course. Not if you use the admin app regularly...

Hope this helps. Regards,
Ales

On Friday, February 15, 2013 5:50:13 PM UTC+1, 黄祥 wrote:

 thank you so much for your detail explaination anthony.
 i understand now, so that i'm just focus on the created the layout.html 
 and created layout_custom.html for example which is often update when the 
 new vesion is arrive.


-- 

--- 
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] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Bruno Rocha
Cool! but it does not allow the transformation.

class CUSTOM(object):you can use a function or a lambda
to validate or/and transform the field in the way you wantit is
the same as onvalidation and onsuccess form callbacksbut it
can be used per field in models or controller levelUsage:#
the validate function should return the error_message or Nonedef
begins_with_a(value):if not value.startswith('a'):
return Should start with aelse:return None
   # the transform function should return a value def
to_upper(value): return value.upper()
db.define_table(foo, Field(bar))db.foo.bar.requires =
CUSTOM(begins_with_a, to_upper) CUSTOM(begins_with_a,
to_upper)('apple')('APPLE', None) CUSTOM(begins_with_a,
to_upper)('orange')('ORANGE', 'Should start with a')def
__init__(self, validate=lambda value: None, transform=lambda value:
value):self.validate = validateself.transform =
transformdef __call__(self, value):
return(self.transform(value), self.validate(value))

-- 

--- 
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 remove items that a user owns when selecting rows from db?

2013-02-15 Thread bracquet
I have a quick question.

If we take this database setup:
https://github.com/mdipierro/web2py-appliances/blob/master/PosOnlineStore/models/db_pos.py

How does one query for all products that the current auth.user.id hasn't 
bought yet (ie, return all items excluding those in sales for this user)?

-- 

--- 
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: Setting up memcache on GAE - a basic question

2013-02-15 Thread Niphlod
on the too fast eviction issue, I remember that something was added to 
set the default expiration time, a time_expire parameter.

On Friday, February 15, 2013 7:32:42 PM UTC+1, howesc wrote:

 i did some grepping of my code and found some things

  - it seems that cache.ram is automatically set to GAE memcache when you 
 are using GAE.  it's part of the GAE setup web2py does for you.
  - the code above looks OK for storing sessions in memcache.  FWIW, I gave 
 up using memcache for sessions because the eviction time was too short for 
 my need on GAE (about 5 mins was the best i could get)

 I am using memcache on GAE quite a bit, so it for sure can work.  Can you 
 post the stack trace from the GAE logs (SDK or production) that you are 
 seeing?

 thanks,

 cfh

 On Thursday, February 14, 2013 2:33:37 AM UTC-8, Andy W wrote:

 I would like to store both session data and cached data in memcache when 
 I upload my app to GAE. Can anybody point me in the right direction for 
 setting this up?

 Based on the web2py scaffolding app I have tried (in models/db.py):

 if not request.env.web2py_runtime_gae:
 db = DAL('sqlite://storage.sqlite', lazy_tables=True)
 else:
 db = DAL('google:datastore', lazy_tables=True)
 from gluon.contrib.memdb import MEMDB
 from google.appengine.api.memcache import Client
 session.connect(request, response, db = MEMDB(Client()))
 cache.ram = cache.disk = cache.memcache

 My app runs OK on sqlite but, once moved to GAE I get an Internal Error 
 whenever serving a page that attempts to store cache data in memcache.

 From http://web2py.com/books/default/chapter/29/13?search=cache#MemcacheI 
 see there is a suggestion to use:

 from gluon.contrib.gae_memcache import MemcacheClient
 from gluon.contrib.memdb import MEMDB
 cache.memcache = MemcacheClient(request)

 I don't understand how this relates to the scaffolding app code - what is 
 MEMDB, what is the correct usage of gluon.contrib.gae_memcache 
 and google.appengine.api.memcache?

 Trial and error has got me nowhere, so I thought I would confess my 
 ignorance and ask the experts!

 Andy



-- 

--- 
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: instantpress app fails on server, ok locally

2013-02-15 Thread greaneym
 

  Thanks, Andrew Replogle.


The fix was to update the os environment on openshift so that it could see 
the modules.  The file named application was updated with the appended 
path, and then the app worked fine with no restart.

Also I tried the older version of instantpress and this worked without 
having to change anything, even though it also uses modules.

Margaret

-- 

--- 
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: instantpress app fails on server, ok locally

2013-02-15 Thread greaneym
details are on github in Andrew Replogle's area.

On Friday, February 15, 2013 2:23:37 PM UTC-6, greaneym wrote:

  

  Thanks, Andrew Replogle.


 The fix was to update the os environment on openshift so that it could see 
 the modules.  The file named application was updated with the appended 
 path, and then the app worked fine with no restart.

 Also I tried the older version of instantpress and this worked without 
 having to change anything, even though it also uses modules.

 Margaret


-- 

--- 
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] field of password type is displayed as cleartext in smartgrid form

2013-02-15 Thread wwwgong
Hi, I am using web2py v2.3.2 and see that field of password type is 
displayed as cleartext in smartgrid form (screenshot is attached).
Is this design behavior or a bug?
but password is hidden in edit view

-- 

--- 
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.


attachment: w2p-password.jpg

Re: [web2py] field of password type is displayed as cleartext in smartgrid form

2013-02-15 Thread Bruno Rocha
You should apply the CRYPT() validator when storing the password

-- 

--- 
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] Improve this code about ( sql query, dict creation for json service)

2013-02-15 Thread Christian Espinoza
Hi all!, could somebody get me a hand in order to improve this code, please?
I'm getting a array of dicts here, every device have it last event attached 
in the dict...

I'm want delete the iteration over the events table, I don't think it is 
efficient enough
maybe it could be changed doing a better query, joining the event and 
device tables in a sql view...
on this way I can get a row.as_dict directly


db.define_table('devices',
Field('serial'),
Field('brand'),
Field('location'),
format='%(serial)s'
)

db.define_table('events',
Field('device_id'),
Field('date', datetime),
Field('location'),
format='%(device_id)s'
)


@service.json
events_service():
events = {} 
devices = db(db.devices).select()
for dev in devices:
event = db(db.events.device_id == dev.id).select().last()
events[dev.id] = {
 'name':event('name'),
 'date':event('date'),
 'brand':dev.brand,
 'location':dev.location }
return events


Thanks in advance.
Christian.

-- 

--- 
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: Database connection error

2013-02-15 Thread Hector Magnanao
Will these options also work for database that is on a linux server ?

On Friday, February 15, 2013 10:44:05 AM UTC-6, Hector Magnanao wrote:

 Awesome !!! Option 2 worked.  Thanks.

 On Friday, February 15, 2013 10:00:54 AM UTC-6, Niphlod wrote:

 yep, but you have either to:
 1. copy over the databases/ folder (the .table files holds the state of 
 the tables on the db as far as web2py knows, so the 2nd one if doesn't find 
 the table files thinks it has to create them)
 2. set migrate=False for the tables on the 2nd app (so web2py will trust 
 your models and never try to create any table). Usually on the 2nd app you 
 want to do
 db = DAL('same uri as the one for the 1st app', migrate_enabled=False)
 ##optionally auth.define_table(migrate=False) 

 3. fake migrate all the tables on the 2nd app (so web2py will trust that 
 the current model is in sync with the db and recreate the .table files)
 db = DAL('same uri as the one for the 1st app', fake_migrate_all=True)
   then hit the appadmin (one time only is enough to create the files), 
 then continue with
 db = DAL('same uri as the one for the 1st app')

 I vote for 2.



-- 

--- 
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: Database connection error

2013-02-15 Thread Niphlod
web2py is multiplatform. it behaves in the same exact way in every os it 
runs into.

On Friday, February 15, 2013 11:25:10 PM UTC+1, Hector Magnanao wrote:

 Will these options also work for database that is on a linux server ?

 On Friday, February 15, 2013 10:44:05 AM UTC-6, Hector Magnanao wrote:

 Awesome !!! Option 2 worked.  Thanks.

 On Friday, February 15, 2013 10:00:54 AM UTC-6, Niphlod wrote:

 yep, but you have either to:
 1. copy over the databases/ folder (the .table files holds the state of 
 the tables on the db as far as web2py knows, so the 2nd one if doesn't find 
 the table files thinks it has to create them)
 2. set migrate=False for the tables on the 2nd app (so web2py will trust 
 your models and never try to create any table). Usually on the 2nd app you 
 want to do
 db = DAL('same uri as the one for the 1st app', migrate_enabled=False)
 ##optionally auth.define_table(migrate=False) 

 3. fake migrate all the tables on the 2nd app (so web2py will trust that 
 the current model is in sync with the db and recreate the .table files)
 db = DAL('same uri as the one for the 1st app', fake_migrate_all=True)
   then hit the appadmin (one time only is enough to create the files), 
 then continue with
 db = DAL('same uri as the one for the 1st app')

 I vote for 2.



-- 

--- 
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 select all rows in Google Appengine, to produce a SQLFORM.grid for a whole table?

2013-02-15 Thread Luca
I need to form a SQLFORM.grid in Google Appengine that will select all 
rows. 
Normally, I would use something like: 

q = (db.table.id  0)
grid = SQLFORM.grid(q, ...)

But in GAE, there are restrictions on inequality queries, so it seems silly 
to use an inequality to get all rows. 

Is there a better solution? 

Luca

-- 

--- 
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: Improve this code about ( sql query, dict creation for json service)

2013-02-15 Thread Alan Etkin
Try this. Not tested but should work:

events = db(db.events.device_id==db.devices.id).select().as_dict()

-- 

--- 
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: how to select all rows in Google Appengine, to produce a SQLFORM.grid for a whole table?

2013-02-15 Thread Luca
Found: 

q = db.table

seems to work.  Aha! --Luca

On Friday, February 15, 2013 3:03:34 PM UTC-8, Luca wrote:

 I need to form a SQLFORM.grid in Google Appengine that will select all 
 rows. 
 Normally, I would use something like: 

 q = (db.table.id  0)
 grid = SQLFORM.grid(q, ...)

 But in GAE, there are restrictions on inequality queries, so it seems 
 silly to use an inequality to get all rows. 

 Is there a better solution? 

 Luca


-- 

--- 
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: Setting up memcache on GAE - a basic question

2013-02-15 Thread howesc
sorry, i was unclear

GAE will forcibly evict data when some unpublished limits are reached.  i 
don't know if these limits are time or space, or a space-time continuum, 
but when i was storing sessions in memcache my max life was about 5 mins.

On Friday, February 15, 2013 11:41:30 AM UTC-8, Niphlod wrote:

 on the too fast eviction issue, I remember that something was added to 
 set the default expiration time, a time_expire parameter.

 On Friday, February 15, 2013 7:32:42 PM UTC+1, howesc wrote:

 i did some grepping of my code and found some things

  - it seems that cache.ram is automatically set to GAE memcache when you 
 are using GAE.  it's part of the GAE setup web2py does for you.
  - the code above looks OK for storing sessions in memcache.  FWIW, I 
 gave up using memcache for sessions because the eviction time was too short 
 for my need on GAE (about 5 mins was the best i could get)

 I am using memcache on GAE quite a bit, so it for sure can work.  Can you 
 post the stack trace from the GAE logs (SDK or production) that you are 
 seeing?

 thanks,

 cfh

 On Thursday, February 14, 2013 2:33:37 AM UTC-8, Andy W wrote:

 I would like to store both session data and cached data in memcache when 
 I upload my app to GAE. Can anybody point me in the right direction for 
 setting this up?

 Based on the web2py scaffolding app I have tried (in models/db.py):

 if not request.env.web2py_runtime_gae:
 db = DAL('sqlite://storage.sqlite', lazy_tables=True)
 else:
 db = DAL('google:datastore', lazy_tables=True)
 from gluon.contrib.memdb import MEMDB
 from google.appengine.api.memcache import Client
 session.connect(request, response, db = MEMDB(Client()))
 cache.ram = cache.disk = cache.memcache

 My app runs OK on sqlite but, once moved to GAE I get an Internal Error 
 whenever serving a page that attempts to store cache data in memcache.

 From http://web2py.com/books/default/chapter/29/13?search=cache#MemcacheI 
 see there is a suggestion to use:

 from gluon.contrib.gae_memcache import MemcacheClient
 from gluon.contrib.memdb import MEMDB
 cache.memcache = MemcacheClient(request)

 I don't understand how this relates to the scaffolding app code - what 
 is MEMDB, what is the correct usage of gluon.contrib.gae_memcache 
 and google.appengine.api.memcache?

 Trial and error has got me nowhere, so I thought I would confess my 
 ignorance and ask the experts!

 Andy



-- 

--- 
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 reading xls with xlrd

2013-02-15 Thread Brian M
I'm pretty sure that 
archivo='/home/lu/web2py/applications/pruebas/uploads/'+form.vars.pago 
doesn't actually contain the path to your file (and you should also 
probably be using os.path.join() rather than just concatenating)

Here's some old code from an app I had that was allowing upload of excel 
files.

def excel_uploader():
response.subtitle = Upload excel file with latest event list
from gluon.sqlhtml import form_factory
form=form_factory(SQLField('import_xls','upload',uploadfolder=uploads
))
if form.accepts(request.vars,session):
request.flash='Received: %s'%request.vars.import_xls
path = os.path.join(request.folder,'private',
'website_event_list2.xls')
import shutil
shutil.copyfileobj(request.vars.import_xls.file,open(path, 
'wb'))#moving 
to known location for later


redirect(URL(r=request, f='layout_selector'))


return dict(form=form)



And then the reading of the excel file happened later:

def website_html():
import xlrd
from applications.MobilePack_Events.modules.readexcel import readexcel 
as readexcel
excel_filepath = os.path.join(request.folder,'private',
'website_event_list2.xls')
xl = readexcel(excel_filepath)
sheetnames = xl.worksheets()
#for sheet in sheetnames:
#print sheet
#for row in xl.getiter('Upcoming Events'):
#print row
return dict(rows = xl.getiter('Upcoming Events'))

The readexcel code comes 
from 
http://code.activestate.com/recipes/483742-easy-cross-platform-excel-parsing-with-xlrd/
 

Good Luck,
~Brian

On Thursday, February 14, 2013 8:46:14 AM UTC-6, Omicron VT wrote:

 I have this code in controller trying to read an .xls file : 

  
 def upload(): 
  import xlrd 

  form = SQLFORM.factory(Field('pago', 'upload', 
   
 uploadfolder='/home/user/web2py/applications/pruebas/uploads')).process() 

  if form.accepts(request.vars,keepvalues=True): 
   
 archivo='/home/lu/web2py/applications/pruebas/uploads/'+form.vars.pago 
  book = xlrd.open_workbook(archivo) 
  sh = book.sheet_by_index(0) 
  columnas = sh.ncols 

  return dict(form=form, columnas=columnas) 
 ** 

 Get this error : 
 type 'exceptions.ValueError' mmap offset is greater than file size 





-- 

--- 
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: Send Email with Web2py on GAE development framework

2013-02-15 Thread howesc
the snarky/mean person  in me says If you have sendmail installed you 
can use it by using the server with --enable_sendmail

i've failed at getting sendmail setup.  i find it's much easier to add the 
switch to the GAE SDK that prints the email contents in the log (i don't 
remember that switch off the top of my head) then to try and get sendmail 
setup.

cfh

On Friday, February 15, 2013 2:58:35 AM UTC-8, José Manuel López Muñoz 
wrote:

 Hi, 
 I'm trying to send an email from GAE (mac OS), and I've config the mail 
 settings. 
 Now I'm getting this into the LOG:

 INFO 2013-02-15 10:19:36,770 mail_stub.py:138] MailService.Send

 From: x...@gmail.com

  To: x...@gmail.com

  Reply-to: u...@example.com

  Subject:Identificador 8E de su compra

  Body:

Content-type: text/plain

Data length: 8

 INFO 2013-02-15 10:19:36,771 mail_stub.py:294] You are not currently 
 sending out real email.  If you have sendmail installed you can use it by 
 using the server with --enable_sendmail

 How can I send real email from the development framework  without 
 uploading the App to GAE?.

 Thank you!


-- 

--- 
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: DAL return number of rows affected?

2013-02-15 Thread howesc
isn't that the return value?  i know it is for delete

On Thursday, February 14, 2013 5:47:36 PM UTC-8, Cliff Kachinske wrote:

 Is it possible to get the number of rows affected by an update in the DAL?

-- 

--- 
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: anyone using the Issue Tracker appliance?

2013-02-15 Thread Andrew Replogle
Jim, 

Is this in GAE or an environment that doesn't have a file backed store? I 
believe initially the tickets are created as files but you can configure it 
to be records in a db. 

Regards,
Andrew

On Friday, February 15, 2013 8:54:01 AM UTC-6, Jim S wrote:

 I can't get it to upload through the admin interface.  I just get a 
 message saying 'unable to install application ticket'.

 Jim


-- 

--- 
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: DAL return number of rows affected?

2013-02-15 Thread Massimo Di Pierro
it is. 

affected_rows = db(...).update(...)

strange. i responded to this yesterday but my post does not show.

On Friday, 15 February 2013 17:20:43 UTC-6, howesc wrote:

 isn't that the return value?  i know it is for delete

 On Thursday, February 14, 2013 5:47:36 PM UTC-8, Cliff Kachinske wrote:

 Is it possible to get the number of rows affected by an update in the DAL?



-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread 黄祥
thank you so much for your explaination, antony, i thought it was an 
illegal operation in web2py work flow or programming logic. but some times 
it's wise to decide it whether use redirect or return locals(), or is there 
any other options to do this except using redirect or return locals()?

here is the example that can not use return locals(), because when the 
condition is true, it will return an error:

def bill():
if not session.order:
session.flash=T(Order Now!!!)
redirect(URL('product'))
for k, v in session.order.items():
if v==0:
del session.order[k]
*redirect(URL('order')) # if use return locals() an error will 
occur*
import datetime
import uuid
invoice_no=str(datetime.date.today())+'-'+str(uuid.uuid4())
grand_total=sum(db.product(id).unit_price*qty for id, qty in 
session.order.items())
form=SQLFORM.factory(Field('note', 'text'))
if form.accepts(request,session):
for key, value in session.order.items():
db.sale.insert(invoice_no=invoice_no,
   product_id=key,
   quantity=value,
   unit_price=db.product(key).unit_price,
   total_price=db.product(key).unit_price*value,
   grand_total=grand_total,
   note=form.vars.note)
db(db.product.id==key).update(quantity=db.product.quantity - 
value)
session.order.clear()  
session.flash=T(Thank you for your Order)
redirect(URL('invoice', args=invoice_no))
return dict(order=session.order, form=form, grand_total=grand_total)

-- 

--- 
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: custom auth table on separate file not in db.py

2013-02-15 Thread 黄祥
thank you very much for your detail explaination, lightdot. it makes me 
clear right now. is that hard way is same like build minimalist web2py (
http://web2py.com/books/default/chapter/29/14#Building-a-minimalist-web2py) 
or it just pure build it from scratch? i'm usually create the application 
that not change the default web2py scaffolding apps as much as possible, n 
when i'm copy it into web2py applications folder it's not going to work.

for example :

hotel/
├── controllers
│   └── default.py
├── models
│   ├── db.py
│   ├── db_wizard_label.py
│   ├── db_wizard_populate.py
│   ├── db_wizard.py
│   ├── db_wizard_requires.py
│   └── menu.py
└── views
└── default
├── booking.html
├── branch.html
├── check_in.html
├── check_out.html
├── cleaning.html
├── company.html
├── guest.html
├── index.html
├── repairing.html
└── room.html

honestly, i'm a newbe and not mastering the css for layout in views so that 
i avoid to modified it as much as possible, otherwise in the book it self 
is not tell a lot about modified the views. have an idea or suggestion for 
modified the views in web2py default?

thank you so much in advance

-- 

--- 
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: suggestion for markmin qr to use google chart

2013-02-15 Thread Massimo Di Pierro
I agree. Would you be able to submit a patch.

On Friday, 15 February 2013 18:32:32 UTC-6, 黄祥 wrote:

 hi, 

 recently i know that markmin in web2py can support auto generate for qr 
 code that is redirect to kaywa, i would suggest is it possible to change 
 the default to redeirect to google chart : http://chart.apis.google.com/ ?
 because the kaywa is not free for create the other data (for example : 
 email, telp, etc)

 just want to sharing my simple apps in web2py that use google chart:
 *phone*
 {{=DIV(IMG(_src='
 http://chart.apis.google.com/chart?cht=qrchs=100x100chl=tel:%schoe=UTF-8chld=H'
  
 % row.phone, _alt='QR Code Phone', _title='QR Code Phone'))}}

 *email*
 {{=DIV(IMG(_src='
 http://chart.apis.google.com/chart?cht=qrchs=100x100chl=%schoe=UTF-8chld=H'
  
 % row.email, _alt='QR Code Email', _title='QR Code Email'))}}

 *website*
 {{=DIV(IMG(_src='
 http://chart.apis.google.com/chart?cht=qrchs=100x100chl=%schoe=UTF-8chld=H'
  
 % row.website, _alt='QR Code Website', _title='QR Code Website'))}}

 please correct and forgive me if i'm wrong


-- 

--- 
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 + exceptions(tickets) service?

2013-02-15 Thread Alec Taylor
On Fri, Feb 15, 2013 at 8:00 PM, Niphlod niph...@gmail.com wrote:


 Thanks for the answer Niphlod, but didn't understand the last part about
 being alerted(besides taking a look at the admin app).

 Cheers!


 http://web2py.com/books/default/chapter/29/13#Collecting-tickets
 and
 https://github.com/web2py/web2py/blob/master/scripts/tickets2email.py

 If you need additional features contribute back some code (or at least the
 ideas :P)

 --

 ---
 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.



^Awesome

-- 

--- 
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: suggestion for markmin qr to use google chart

2013-02-15 Thread 黄祥
how to submit a patch in web2py? i've already search in book 
http://www.web2py.com/book/default/chapter/01#Contribute but don't know 
which file that must be update.
ive already take a look in 
https://github.com/web2py/web2py/blob/master/gluon/contrib/markmin/markmin.html,
 
but can't find the qr, don't know is this the correct file or not.
is it need to create the ticket first n then submit the code in here? in my 
company, we usually create the ticket in jira before patching, update, etc, 
i don't know what is the rule in here.

thank you so much

-- 

--- 
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: How to remove items that a user owns when selecting rows from db?

2013-02-15 Thread 黄祥
what do you mean by sales? is it in the session order or is it in the table?

-- 

--- 
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] ipython is your friend!

2013-02-15 Thread wwwgong
I like IPython

On Sunday, February 10, 2013 6:20:30 AM UTC-5, Ramos wrote:

 +1 for a VIDEO of this...

 2013/2/9 JimK jke...@gmail.com javascript:

 One of the nice things about python modules that are not c-compiled is 
 the fact that you can read the source code.  The bad part is that the 
 source code is not always easy to find.  This is where ipython comes in.

 IPython is an alternative to the regular python interpreter which offers 
 a bunch of niceties.  This interpreter is supported by web2py out of the 
 box; just install ipython (pip install ipython) and start web2py at the 
 command prompt (python web2py.py -S appname -M).  This will load the 
 web2py environment for your application and it's models using the ipython 
 interpreter.  I won't go through them all, but rather just a couple that 
 really come in handy for me during web2py development.

 Let's say you want to see the doc string for SQLFORM:
 In [2]: form = SQLFORM?return
 ipython display a scrollable doc string (type 'q' to exit the doc string 
 viewer)

 Now you want to see the source code of the SQLFORM class:
 In [3]: form = SQLFORM??return
 ipython now shows the entire SQLFORM class

 Let's say you want to just see all of the methods that SQLFORM has to 
 offer:
 In [5]: SQLFORM.tab
 SQLFORM.AUTOTYPES SQLFORM.assert_status 
 SQLFORM.grid  SQLFORM.search_menu
 SQLFORM.FIELDKEY_DELETE_RECORDSQLFORM.build_query   
 SQLFORM.hidden_fields SQLFORM.sibling
 SQLFORM.FIELDNAME_REQUEST_DELETE  SQLFORM.confirm   
 SQLFORM.insertSQLFORM.siblings
 SQLFORM.ID_LABEL_SUFFIX   SQLFORM.createform   
  SQLFORM.mro   SQLFORM.smartdictform
 SQLFORM.ID_ROW_SUFFIX SQLFORM.dictform 
  SQLFORM.process   SQLFORM.smartgrid
 SQLFORM.REDIRECT_JS   SQLFORM.element   
 SQLFORM.regex_attrSQLFORM.tag
 SQLFORM.accepts   SQLFORM.elements 
  SQLFORM.regex_class   SQLFORM.update
 SQLFORM.add_buttonSQLFORM.factory   
 SQLFORM.regex_id  SQLFORM.validate
 SQLFORM.add_class SQLFORM.flatten   
 SQLFORM.regex_tag SQLFORM.widgets
 SQLFORM.appendSQLFORM.formstyles   
  SQLFORM.remove_class  SQLFORM.xml

 Finally, if you want to dig into any of those methods, like smartgrid:
 In [6]: SQLFORM.smartgrid?return
 or
 In [7]: SQLFORM.smartgrid??return
  
 and since the SQLFORM code is well documented and the argument names are 
 descriptive, you should be able to figure out more problems on your own.

 This is just a taste of what you can do with ipython.  It can also 
 display more detailed traceback messages, run os-level commands without 
 exiting the interpreter, debug code, etc.

 I hope this helps a bit!


 Jim


  -- 
  
 --- 
 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.
  
  




-- 

--- 
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: suggestion for markmin qr to use google chart

2013-02-15 Thread Massimo Di Pierro
The file is

gluon/contrib/markmin/markmin2html.py

You can simply email me the changed file.

On Friday, 15 February 2013 20:30:52 UTC-6, 黄祥 wrote:

 how to submit a patch in web2py? i've already search in book 
 http://www.web2py.com/book/default/chapter/01#Contribute but don't know 
 which file that must be update.
 ive already take a look in 
 https://github.com/web2py/web2py/blob/master/gluon/contrib/markmin/markmin.html,
  
 but can't find the qr, don't know is this the correct file or not.
 is it need to create the ticket first n then submit the code in here? in 
 my company, we usually create the ticket in jira before patching, update, 
 etc, i don't know what is the rule in here.

 thank you so much


-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread Anthony
What error occurs if you return locals()? If the view is expecting a 
particular variable to be returned but that variable is not in locals(), 
that would cause an error -- is that the issue?

Anthony

On Friday, February 15, 2013 7:39:17 PM UTC-5, 黄祥 wrote:

 thank you so much for your explaination, antony, i thought it was an 
 illegal operation in web2py work flow or programming logic. but some times 
 it's wise to decide it whether use redirect or return locals(), or is there 
 any other options to do this except using redirect or return locals()?

 here is the example that can not use return locals(), because when the 
 condition is true, it will return an error:

 def bill():
 if not session.order:
 session.flash=T(Order Now!!!)
 redirect(URL('product'))
 for k, v in session.order.items():
 if v==0:
 del session.order[k]
 *redirect(URL('order')) # if use return locals() an error 
 will occur*
 import datetime
 import uuid
 invoice_no=str(datetime.date.today())+'-'+str(uuid.uuid4())
 grand_total=sum(db.product(id).unit_price*qty for id, qty in 
 session.order.items())
 form=SQLFORM.factory(Field('note', 'text'))
 if form.accepts(request,session):
 for key, value in session.order.items():
 db.sale.insert(invoice_no=invoice_no,
product_id=key,
quantity=value,
unit_price=db.product(key).unit_price,
total_price=db.product(key).unit_price*value,
grand_total=grand_total,
note=form.vars.note)
 db(db.product.id==key).update(quantity=db.product.quantity - 
 value)
 session.order.clear()  
 session.flash=T(Thank you for your Order)
 redirect(URL('invoice', args=invoice_no))
 return dict(order=session.order, form=form, grand_total=grand_total)


-- 

--- 
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] SmartGrid and New button 1 to many

2013-02-15 Thread Dan Kozlowski
Does anyone know if I  smartgrid to can create another button next to 
 View, Edit, Delete that will allow it to open a new search screen ? I have 
a customer ( 1 to many notes) and would like a  Notes button  that takes 
you to another search screen to allow you to view 1 to many Notes a 
customer can have ?

-- 

--- 
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: anyone using the Issue Tracker appliance?

2013-02-15 Thread Jim Steil
I didn't specify anything, just tried importing it into my environment
through the admin interface and it failed.


On Fri, Feb 15, 2013 at 5:22 PM, Andrew Replogle
andrew.replo...@gmail.comwrote:

 Jim,

 Is this in GAE or an environment that doesn't have a file backed store? I
 believe initially the tickets are created as files but you can configure it
 to be records in a db.

 Regards,
 Andrew

 On Friday, February 15, 2013 8:54:01 AM UTC-6, Jim S wrote:

 I can't get it to upload through the admin interface.  I just get a
 message saying 'unable to install application ticket'.

 Jim

  --

 ---
 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.




-- 

--- 
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: SmartGrid and New button 1 to many

2013-02-15 Thread Jim S
This should be the default behavior if you have your tables and relations 
defined properly.  If it isn't then you can provide other links using the 
'links' parameter that you can pass to SQLFORM.smartgrid.  If that doesn't 
make sense, post the code, table defs and call to SQLFORM.smartgrid and we 
can see what the problem might be.

-Jim

On Friday, February 15, 2013 10:29:46 PM UTC-6, Dan Kozlowski wrote:

 Does anyone know if I  smartgrid to can create another button next to 
  View, Edit, Delete that will allow it to open a new search screen ? I have 
 a customer ( 1 to many notes) and would like a  Notes button  that takes 
 you to another search screen to allow you to view 1 to many Notes a 
 customer can have ?

-- 

--- 
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: delete session strange behaviour

2013-02-15 Thread 黄祥
hi anthony,

sorry, i'm not sure what do you mean 'the view is expecting a particular 
variable to be returned but that variable is not in locals()'

here is the code that return an error:

for k, v in session.order.items():
if v==0:
del session.order[k]
*redirect(URL('order')) # if use return locals() an error will 
occur*

the logic is : it just checked if somebody made an order value is 0 (zero), 
they won't get into the bill page. when i use redirect to the order page, 
it's work fine, what i've expected, but when i try to learn to use return 
locals() an error rise. 

-- 

--- 
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.