[web2py] Re: How to create object of 'Storage' In class I created?

2014-07-11 Thread Omri Levy
Thanks , It works :)

On Thursday, July 10, 2014 1:00:30 PM UTC+3, Niphlod wrote:

 from gluon.storage import Storage


 mydict = dict(a=1,b=1)
 print mydict['a']
 print mydict.a -- exception
 mydict = Storage(mydict)
 print mydict['a']
 print mydict.a -- no exception




 On Thursday, July 10, 2014 4:23:41 AM UTC+2, Omri Levy wrote:

 Hi ,

 I have created a class (that i put in models folder), and all it methods 
 returns complicated dictionaries.
 When I try to access these variables like Storage (foo.bar) I get the 
 following exception: 'dict' object has no attribute
  I thought that all dictionaries are being converted automatically into 
 Storage, but i guess they don't.
 I've tried to wrap the return value with Storage constructor but then I 
 get an exception saying that there is no such thing as Storage.

 Can someone please enlighten me?

 Thanks ,

 Omri.



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


[web2py] How to create object of 'Storage' In class I created?

2014-07-10 Thread Omri Levy
Hi ,

I have created a class (that i put in models folder), and all it methods 
returns complicated dictionaries.
When I try to access these variables like Storage (foo.bar) I get the 
following exception: 'dict' object has no attribute
 I thought that all dictionaries are being converted automatically into 
Storage, but i guess they don't.
I've tried to wrap the return value with Storage constructor but then I get 
an exception saying that there is no such thing as Storage.

Can someone please enlighten me?

Thanks ,

Omri.

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


[web2py] Debug Web2py with Wing IDE

2014-06-26 Thread Omri Levy
Hi ,

I asked Wing support the following question:

 I am using Web2py framework. I saw a video that says the Wing can
 debug a running python code no matter if it launched it itself. When
 reading this: http://wingware.com/doc/howtos/web2py
 I see that I can only debug Web2py in a way that I need to rerun the
 server from Wing for each time I hit 'Debug'. Is there any better way to
 do it?


*They replied:*
*This is our recommended approach because of the difficulties reloading 
code in Python.  Does web2py have code reloading?  It's been some time 
since I worked with it.  Or does it have a master process that spawns a new 
sub process when things change?  django and some other frameworks work this 
way.*

Do someone know what is the answer to these two questions?

Thanks!

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


[web2py] Re: A way to trigger method on update?

2014-06-26 Thread Omri Levy
Thank you! :)

On Thursday, June 26, 2014 12:25:00 AM UTC+3, 黄祥 wrote:

 afaik, compute didn't work on update. for onupdate, is execute on form 
 level not on dal, please take a look at book chapter about that.

 ref:
 http://web2py.com/books/default/chapter/29/07/forms-and-validators

 best regards,
 stifan


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


[web2py] Re: A way to trigger method on update?

2014-06-25 Thread Omri Levy
Yes. I have read ALL the DAL section from the manual and I think you are 
right.
I just wonder if I could use the 'compute' or 'filter in' function as well.

I never heard of form 'on update'. Is it web2py feature?

Thanks! :)

On Wednesday, June 25, 2014 9:58:41 AM UTC+3, 黄祥 wrote:

 i think you can achieve it using before and after update callback (handle 
 in dal), another way is using onupdate (handle in form)

 best regards,
 stifan


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


[web2py] A way to trigger method on update?

2014-06-24 Thread Omri Levy
Hi,

Is there a way to call a method when certain field is updated?
The intention is *not* to change the value of the field/represent it 
otherwise, but it has general purpose.

Thanks!

Omri.

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


[web2py] Re: Ticket in Appadmin when viewing a table

2014-06-21 Thread Omri Levy
Hi Massimo ,

Thank you very much!
Error still happens. I think it's corrupt data in DB, because when removing 
the DB and repeating the same actions it's OK.

Thanks , 

On Friday, June 20, 2014 6:04:34 AM UTC+3, Massimo Di Pierro wrote:

 Download this:

 https://github.com/web2py/web2py/archive/master.zip

 Unzip it and copy web2py over the old one.

 On Thursday, 19 June 2014 17:28:41 UTC-5, Omri Levy wrote:

 Hi Massimo,

 Thanks , I experience this bug a lot, I think it's when I update list of 
 references to the same table in the db.
 Can you please explain how to update? (do I need Git?) / Manually fix it?

 Thanks again ,

 Omri.

 On Friday, June 20, 2014 1:17:08 AM UTC+3, Massimo Di Pierro wrote:

 think it is a bug. pushing a new version that should fix that. Check 
 trunk in 5 minutes.

 On Monday, 16 June 2014 09:17:01 UTC-5, Omri Levy wrote:


 type 'exceptions.TypeError' sequence item 0: expected string, long 
 foundVersionweb2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
 PythonPython 2.7.6: C:\Python27\python.exe (prefix: C:\Python27)
 Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File G:\Dropbox\Coding Projects\web2py\gluon\restricted.py, line 220, 
 in restricted
 exec ccode in environment
   File G:/Dropbox/Coding 
 Projects/web2py/applications/goals/views/appadmin.html 
 http://192.168.1.14:8000/admin/default/edit/goals/views/appadmin.html, 
 line 183, in module
 h4{{=T(DISK)}}/h4
   File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 3049, in 
 __init__
 r = represent(field, r or [], record)
   File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 59, in 
 represent
 return f(value)
   File G:\Dropbox\Coding Projects\web2py\gluon\dal.py, line 7252, in 
 list_ref_repr
 return (refs and ', '.join(f(r,x.id) for x in refs) or '')
 TypeError: sequence item 0: expected string, long found



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


[web2py] Re: Trying to use the LOAD helper, if a button is clicked

2014-06-19 Thread Omri Levy
Thank you Anthony! This works :)

Thank you too Carlos

On Monday, June 16, 2014 4:33:05 PM UTC+3, Anthony wrote:

 If you want to dynamically add a component in the browser, you cannot use 
 the LOAD helper, which is a Python helper that is serialized on the server. 
 Instead, use the $.web2py.component() Javascript function. Something like:

 input type=button value=Edit onclick=$.web2py.component('{{=URL('
 default', 'edit_page.load')}}', 'edit-form');

 div id=edit-form/div

 Anthony

 On Friday, June 13, 2014 7:47:34 PM UTC-4, Omri Levy wrote:

 Hi ,

 So I have a ticket system, and I want to allow user to edit the ticket 
 without leaving the page.
 I don't want to LOAD the edit_page and hide it, but only load it once 
 user is clicking on the ticket body.
 Another thing is, when user edits the ticket, he should again see changes 
 on the same page.

 Is this possible? I'm a bit confused, because LOAD works fine, but not 
 when using conditions with JS.

 Thanks.



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


[web2py] Ticket in Appadmin when viewing a table

2014-06-19 Thread Omri Levy

type 'exceptions.TypeError' sequence item 0: expected string, long found
Versionweb2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39PythonPython 
2.7.6: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Traceback (most recent call last):
  File G:\Dropbox\Coding Projects\web2py\gluon\restricted.py, line 220, in 
restricted
exec ccode in environment
  File G:/Dropbox/Coding 
Projects/web2py/applications/goals/views/appadmin.html 
http://192.168.1.14:8000/admin/default/edit/goals/views/appadmin.html, line 
183, in module
h4{{=T(DISK)}}/h4
  File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 3049, in 
__init__
r = represent(field, r or [], record)
  File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 59, in 
represent
return f(value)
  File G:\Dropbox\Coding Projects\web2py\gluon\dal.py, line 7252, in 
list_ref_repr
return (refs and ', '.join(f(r,x.id) for x in refs) or '')
TypeError: sequence item 0: expected string, long found

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


[web2py] Re: Ticket in Appadmin when viewing a table

2014-06-19 Thread Omri Levy
Hi Massimo,

Thanks , I experience this bug a lot, I think it's when I update list of 
references to the same table in the db.
Can you please explain how to update? (do I need Git?) / Manually fix it?

Thanks again ,

Omri.

On Friday, June 20, 2014 1:17:08 AM UTC+3, Massimo Di Pierro wrote:

 think it is a bug. pushing a new version that should fix that. Check trunk 
 in 5 minutes.

 On Monday, 16 June 2014 09:17:01 UTC-5, Omri Levy wrote:


 type 'exceptions.TypeError' sequence item 0: expected string, long found
 Versionweb2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39PythonPython 
 2.7.6: C:\Python27\python.exe (prefix: C:\Python27)Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File G:\Dropbox\Coding Projects\web2py\gluon\restricted.py, line 220, in 
 restricted
 exec ccode in environment
   File G:/Dropbox/Coding 
 Projects/web2py/applications/goals/views/appadmin.html 
 http://192.168.1.14:8000/admin/default/edit/goals/views/appadmin.html, 
 line 183, in module
 h4{{=T(DISK)}}/h4
   File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 3049, in 
 __init__
 r = represent(field, r or [], record)
   File G:\Dropbox\Coding Projects\web2py\gluon\sqlhtml.py, line 59, in 
 represent
 return f(value)
   File G:\Dropbox\Coding Projects\web2py\gluon\dal.py, line 7252, in 
 list_ref_repr
 return (refs and ', '.join(f(r,x.id) for x in refs) or '')
 TypeError: sequence item 0: expected string, long found



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


[web2py] Trying to use the LOAD helper, if a button is clicked

2014-06-14 Thread Omri Levy
Hi ,

So I have a ticket system, and I want to allow user to edit the ticket 
without leaving the page.
I don't want to LOAD the edit_page and hide it, but only load it once user 
is clicking on the ticket body.
Another thing is, when user edits the ticket, he should again see changes 
on the same page.

Is this possible? I'm a bit confused, because LOAD works fine, but not when 
using conditions with JS.

Thanks.

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


[web2py] Adding information to certain input before added to db?

2014-06-06 Thread Omri Levy
When using SQLFORM, is it possible to check for certain input and change it 
before it is being stored in db?

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


[web2py] Can I change a value from a form before it is processed?

2014-06-06 Thread Omri Levy
Hi ,

So the situation is this:

I have table for posts - Only the user posted a message may see it
and then table for shared_posts - The user created a post may enter 
user_ids here, and those users may also see the post

I don't want to add record for each share, so shared posts is defined 
like this:

db.define_table('shared_goals',
Field('goal','reference 
posts',readable=False,writable=False,requires=IS_NOT_EMPTY()),
Field('user_id','list:reference auth_user'),
auth.signature)

Notice that user_id is a list.

When I produce a form (with given id, so it is actually an edit form), it 
shows user_id as a list of all the people registered. I don't want this. 
people should not see who else is registered.
So, In the view I wrote this:

{{=shared_goals_form.custom.begin}}
{{=INPUT(_name=user_id,_id=shared_goals_user_id)}}
{{=shared_goals_form.custom.submit}}
{{=shared_goals_form.custom.end}}

And then, after being processed, the list in DB only contains one user_id 
(latest).

The question is: Can I change the value of user_id input after submission 
and before the process, so that it will include previous user_ids?

Thanks!

Omri.

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