[web2py] Re: Help with custom widget for list:reference field

2015-12-02 Thread Anthony
It would be helpful if you could distill the problem down to a smaller bit 
of code so we don't have to digest your entire plugin (i.e., just provide a 
simple table definition and basic controller code that generates the 
error). Anyway, I don't see where you are calling the get_media_field 
method.

Anthony 

On Wednesday, December 2, 2015 at 9:14:00 AM UTC-5, Carlos Cesar Caballero 
wrote:
>
> Hi, I am working in a plugin (based in the Tim Richardson ckeditor4 
> plugin galley) for creating a global media galley for web2py 
> applications (some functionality like the wordpress and other cms 
> galleys), it is in https://github.com/daxslab/web2py-media-galley. 
>
> If you look at the functions get_media_field() and widget() from 
> modules/plugin_daxs_media_galley.py you can see that I create a field, 
> and a custom widget for that field. 
>
> Right now I am using a very ugly approach storing comma-separated images 
> ids in a string field, because if I use a list:reference field it always 
> throws: 
>
> Exception: Validation error, field:media  object at 0x7f6158557250> 
>
> So, someone can help me with this? why this error? and how avoid it? 
>
> Cheears. 
>
> -- 
> Este mensaje le ha llegado mediante el servicio de correo electronico que 
> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
> Nacional de Salud. La persona que envia este correo asume el compromiso de 
> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>
> Infomed: http://www.sld.cu/ 
>
>

-- 
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: Create Class that extends a model of the dal

2015-12-02 Thread Alessio Varalta
Thanks, Is the work for my project :) I see now in the guide the part of 
DatabaseLayer- Virtual Field

On Wednesday, 2 December 2015 17:13:48 UTC+1, Anthony wrote:
>
> Not sure if this is what you're looking for, but check out 
> https://groups.google.com/forum/#!msg/web2py/ceqq4JwkWi4/csn0kZfyPuwJ 
> (not documented in the book).
>
> Anthony
>
> On Wednesday, December 2, 2015 at 10:59:39 AM UTC-5, Alessio Varalta wrote:
>>
>> Hi, I want to assign specific function to a Model of the Dal for example 
>> I have the table layer_scheda and I want to add the method change_pos..For 
>> example in Java o Ruby we have a package with the model class where you can 
>> put the function inside the class in these case with Web2py?
>>
>

-- 
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] Role of users

2015-12-02 Thread Fabiano Almeida
Hi!

I'm trying to create a list of roles for each user:

for x in db(db.auth_user.id>0).select(db.auth_user.id):
groups = []
for g in db(db.auth_membership.id > 0).select(db.auth_group.role,
join=[db.auth_group.on(db.auth_group.id==db.auth_membership.group_id),
db.auth_user.on(db.auth_user.id==db.auth_membership.user_id)]):
groups.append(g.role)

and the error:

TypeError: reduce() of empty sequence with no initial value

How to do this list?

thanks,

Fabiano

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


[web2py] Re: Create Class that extends a model of the dal

2015-12-02 Thread Anthony
Not sure if this is what you're looking for, but check out 
https://groups.google.com/forum/#!msg/web2py/ceqq4JwkWi4/csn0kZfyPuwJ (not 
documented in the book).

Anthony

On Wednesday, December 2, 2015 at 10:59:39 AM UTC-5, Alessio Varalta wrote:
>
> Hi, I want to assign specific function to a Model of the Dal for example I 
> have the table layer_scheda and I want to add the method change_pos..For 
> example in Java o Ruby we have a package with the model class where you can 
> put the function inside the class in these case with Web2py?
>

-- 
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] Create Class that extends a model of the dal

2015-12-02 Thread Alessio Varalta
Hi, I want to assign specific function to a Model of the Dal for example I 
have the table layer_scheda and I want to add the method change_pos..For 
example in Java o Ruby we have a package with the model class where you can 
put the function inside the class in these case with Web2py?

-- 
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: Create Class that extends a model of the dal

2015-12-02 Thread Alessio Varalta
For example there is the possibility to define the class model like 
Java/Ruby I see this document http://weppy.org/docs/0.1/dal

-- 
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: How to use fancytree?

2015-12-02 Thread Henk huisman

>
> It does work! Mille Grazie!
>>>
>> Thanks DenesL and Anthony.
 

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


[web2py] Re: Scheduler erroring when threading and trying to do database update.

2015-12-02 Thread Benson Myrtil
Was able to get this working. When I created the task, I originally had the 
application named something else. After renaming the application I forgot 
to update the application_name on the scheduler_task table. Once I did that 
it started working.

On Monday, November 23, 2015 at 4:33:34 PM UTC-5, Niphlod wrote:
>
> without the complete code is hard to see where the exception may raise, 
> but a serious question arises: why should you manage threads inside a 
> scheduler-executed task ? 
> At that level of abstraction, if you NEED to fine-tune code execution at 
> that level, just use a normal web2py shell.
>
> Did you try to start that machinery in web2py's shell just to avoid having 
> another layer of complexity brought by the scheduler ?
> BTW, for everybody: if you can code a function that works fine when used 
> in the web2py shell, the same will probably work when queued in the 
> Scheduler. If it doesn't in web2py's shell, start debugging from there 
> instead of inside the scheduler
>
> On Monday, November 23, 2015 at 9:54:14 PM UTC+1, Benson Myrtil wrote:
>>
>> I am getting the following error when running a scheduler task with 
>> threading:
>>
>> Traceback (most recent call last):   File 
>> "C:\Users\devteam\Desktop\web_apps\launchpad\production\web2py\gluon\scheduler.py",
>>  
>> line 298, in executor functions = current._scheduler.tasks 
>> AttributeError: 'thread._local' object has no attribute '_scheduler' 
>>
>> # THREAD FUNCTION TO SET ACCOUNT
>> def set_account( kwargs ):
>>while not q.empty( ):
>>   entry = q.get( )
>>   kwargs[ 'db_con' ].db.account.update_or_insert( kwargs[ 'db_con' 
>> ].db.account.ad_object_guid == entry[ 'ad_object_guid' ], **entry )
>>
>> # CREATE SET AMOUNT OF THREADS
>> for i in range( num_of_threads ):
>>key = 'Thread_{0}'.format( i )
>>db_con[ key ] = Launchpad_DB( fake_migration = True, lazy_tables = True, 
>> is_worker = True )
>>db_con[ key ].define_account( )
>>threads[ key ] = LaunchpadThread( i, key, set_account, db_con = db_con[ 
>> key ] )
>>threads[ key ].start( )
>> # WAIT FOR ALL THREADS TO FINISH
>> for key in threads:
>>threads[ key ].join( )
>>
>>
>> I am assuming the error is happening somewhere in there. I create a queue 
>> that holds all the accounts that are ready to be updated. I create a new 
>> DAL connection for each thread and pass that in.
>>
>> Any idea why I would be getting the error that I am?
>>
>

-- 
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: Role of users

2015-12-02 Thread Fabiano Almeida
Hi Anthony!

The auth.user_groups.value() is only for logged user or I can define user 
id to get for all users?

Thanks!

Fabiano

Em quarta-feira, 2 de dezembro de 2015 14:47:50 UTC-2, Anthony escreveu:
>
> The roles for a user are stored as a dictionary in auth.user_groups, with 
> the keys being the group IDs and the values being the roles, so for just a 
> list of the roles:
>
> auth.user_groups.values()
>
> Anthony
>
> On Wednesday, December 2, 2015 at 11:31:14 AM UTC-5, Fabiano Almeida wrote:
>>
>> Hi!
>>
>> I'm trying to create a list of roles for each user:
>>
>> for x in db(db.auth_user.id>0).select(db.auth_user.id):
>> groups = []
>> for g in db(db.auth_membership.id > 0).select(db.auth_group.role, 
>> join=[db.auth_group.on(db.auth_group.id==db.auth_membership.group_id), 
>> db.auth_user.on(db.auth_user.id==db.auth_membership.user_id)]):
>> groups.append(g.role)
>>
>> and the error:
>>
>> TypeError: reduce() of empty sequence with no initial value
>>
>> How to do this list?
>>
>> thanks,
>>
>> Fabiano
>>
>

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


[web2py] Re: Role of users

2015-12-02 Thread Anthony
Sorry, yes, that's just for the logged in user. Maybe have a look at this 
code: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L3779

Anthony

On Wednesday, December 2, 2015 at 11:52:26 AM UTC-5, Fabiano Almeida wrote:
>
> Hi Anthony!
>
> The auth.user_groups.value() is only for logged user or I can define user 
> id to get for all users?
>
> Thanks!
>
> Fabiano
>
> Em quarta-feira, 2 de dezembro de 2015 14:47:50 UTC-2, Anthony escreveu:
>>
>> The roles for a user are stored as a dictionary in auth.user_groups, with 
>> the keys being the group IDs and the values being the roles, so for just a 
>> list of the roles:
>>
>> auth.user_groups.values()
>>
>> Anthony
>>
>> On Wednesday, December 2, 2015 at 11:31:14 AM UTC-5, Fabiano Almeida 
>> wrote:
>>>
>>> Hi!
>>>
>>> I'm trying to create a list of roles for each user:
>>>
>>> for x in db(db.auth_user.id>0).select(db.auth_user.id):
>>> groups = []
>>> for g in db(db.auth_membership.id > 0).select(db.auth_group.role, 
>>> join=[db.auth_group.on(db.auth_group.id==db.auth_membership.group_id), 
>>> db.auth_user.on(db.auth_user.id==db.auth_membership.user_id)]):
>>> groups.append(g.role)
>>>
>>> and the error:
>>>
>>> TypeError: reduce() of empty sequence with no initial value
>>>
>>> How to do this list?
>>>
>>> thanks,
>>>
>>> Fabiano
>>>
>>

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


[web2py] Re: Role of users

2015-12-02 Thread Anthony
The roles for a user are stored as a dictionary in auth.user_groups, with 
the keys being the group IDs and the values being the roles, so for just a 
list of the roles:

auth.user_groups.values()

Anthony

On Wednesday, December 2, 2015 at 11:31:14 AM UTC-5, Fabiano Almeida wrote:
>
> Hi!
>
> I'm trying to create a list of roles for each user:
>
> for x in db(db.auth_user.id>0).select(db.auth_user.id):
> groups = []
> for g in db(db.auth_membership.id > 0).select(db.auth_group.role, 
> join=[db.auth_group.on(db.auth_group.id==db.auth_membership.group_id), 
> db.auth_user.on(db.auth_user.id==db.auth_membership.user_id)]):
> groups.append(g.role)
>
> and the error:
>
> TypeError: reduce() of empty sequence with no initial value
>
> How to do this list?
>
> thanks,
>
> Fabiano
>

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


[web2py] Re: Role of users

2015-12-02 Thread Fabiano Almeida
It works using the example many to many of the book:

for x in db(db.auth_user.id>0).select(db.auth_user.id):
groups = []
users_and_groups = db((db.auth_user.id==x.id)& 
(db.auth_user.id==db.auth_membership.user_id) & 
(db.auth_group.id==db.auth_membership.group_id))
for g in users_and_groups.select(db.auth_group.role, 
orderby=db.auth_membership.group_id):
groups.append(g.role)
# [...]


Em quarta-feira, 2 de dezembro de 2015 14:31:14 UTC-2, Fabiano Almeida 
escreveu:
>
> Hi!
>
> I'm trying to create a list of roles for each user:
>
> for x in db(db.auth_user.id>0).select(db.auth_user.id):
> groups = []
> for g in db(db.auth_membership.id > 0).select(db.auth_group.role, 
> join=[db.auth_group.on(db.auth_group.id==db.auth_membership.group_id), 
> db.auth_user.on(db.auth_user.id==db.auth_membership.user_id)]):
> groups.append(g.role)
>
> and the error:
>
> TypeError: reduce() of empty sequence with no initial value
>
> How to do this list?
>
> thanks,
>
> Fabiano
>

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


[web2py] Changing Bootstrap Navbar to light background colour

2015-12-02 Thread Chris Guest
I recently needed to modify the stock Bootstrap CSS so that the Navbar had 
a light colour,  #fafafb .

I added the following to  static/css/web2py-bootstrap3.css . I just thought 
that I would share it here in case is useful for others.


.navbar-default{
background-color:#fafafb;
border-color:#fafafb;
}

.navbar-inner {
background-color:#fafafb; 
border-color:#fafafb;
background-repeat: no-repeat;
filter: none;
}

.navbar .nav > li > a {
color: #3e3f3a;
}
.navbar .nav > li > a:active, .navbar .nav > li > a:hover {
color: #808285; 
}

-- 
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: Changing Bootstrap Navbar to light background colour

2015-12-02 Thread Leonel Câmara
Did you remove the navbar-inverse class? That's what makes it black.

-- 
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: Changing Bootstrap Navbar to light background colour

2015-12-02 Thread Chris Guest
I didn't remove any classes from  static/css/bootstrap.min.css 
or static/css/bootstrap-theme.min.css .
I only added code to static/css/web2py-bootstrap3.css .
If there's a simpler way to do this, please let me know.


On Thursday, December 3, 2015 at 11:33:11 AM UTC+11, Leonel Câmara wrote:
>
> Did you remove the navbar-inverse class? That's what makes it black.
>

-- 
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] Fancytree lazyload

2015-12-02 Thread Henk huisman
I am trying to use the javascript library Fancytree to generate a tree of 
an organization hierarchy.
I manage to load the data in the tree to the first level of the 
organization with a JSON result dictionary. So I have a tree already.

The rest of the children nodes I only want to load if someone clicks a node 
(lazy loading with AJAX call)


 var treeData = [
 {{=result}}
 ];


 $(function(){
 $("#tree1").fancytree({
 checkbox: true,
 selectMode: 1,
 source: treeData2 ,
 lazyload: function(e, data){
 var node = data.node;
 data.result = {url: "ajaxtree", data: {mode: "children", parent: node.key}, 
cache: false };
 }
 }); });


I wrote a controller function ajaxtree that  returns the children as a 
result in JSON format.

I have tried a lot of different ways to accomplish this, but nothing seems 
to work. 
This is the error I get: 

Load error! (SyntaxError: Unexpected token t)

the unexpected token seems to be the first letter of the JSON string with 
the children [{title: "child something" etc.

Anybody an idea or experience with this function? 


-- 
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] FEATURE REQUEST: Case Insensitive Field types

2015-12-02 Thread Encompass solutions
I am not sure this exists yet, but it would be nice to take a string field 
(or anything string like) and make it case insensitive.  That way I don't 
have to worry the j...@example.com is the same as j...@example.com
What do you guys think?

-- 
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: FEATURE REQUEST: Case Insensitive Field types

2015-12-02 Thread Niphlod
There's no such thing in several backends.
That being said, I don't see the issue using requires=IS_UPPER() or 
requires=IS_LOWER()

On Wednesday, December 2, 2015 at 8:59:49 AM UTC+1, Encompass solutions 
wrote:
>
> I am not sure this exists yet, but it would be nice to take a string field 
> (or anything string like) and make it case insensitive.  That way I don't 
> have to worry the j...@example.com  is the same as 
> j...@example.com
> What do you guys think?
>

-- 
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: How to use fancytree?

2015-12-02 Thread 'DenesL' via web2py-users

Hi, assuming that the paths to the js & css files are correct you are 
missing the closing of $(function(){ in your script.
Just duplicate the last line at the very end, i.e. add });

Denes

On Tuesday, December 1, 2015 at 12:03:01 AM UTC-5, Henk huisman wrote:
>
> Fancytree looks to me as a nice javascript library to generate trees (
> https://github.com/mar10/fancytree/wiki).
> Unfortunatily I don't get it to work in Web2py.
>
> I just installed the libraries etc and copied some code from the examples 
> websites, but the function fancytree doesnothing.
>
> This is the code I tried:
>
> 
> 
> 
> Fancytree - Example: Select
>  "{{=URL('static','fancytree/dist/skin-lion/ui.fancytree.min.css')}}"/>
>  "text/javascript">
>  "text/javascript">
>  "{{=URL('static','fancytree/dist/jquery.fancytree-all.min.js')}}"
> >
>
>
> 
>   var treeData = [
> {title: "item1 with key and tooltip", tooltip: "Look, a tool tip!" },
> {title: "item2: selected on init", selected: true },
> {title: "Folder", folder: true, key: "id3",
>   children: [
> {title: "Sub-item 3.1",
>   children: [
> {title: "Sub-item 3.1.1", key: "id3.1.1" },
> {title: "Sub-item 3.1.2", key: "id3.1.2" }
>   ]
> },
> {title: "Sub-item 3.2",
>   children: [
> {title: "Sub-item 3.2.1", key: "id3.2.1" },
> {title: "Sub-item 3.2.2", key: "id3.2.2" }
>   ]
> }
>   ]
> },
> {title: "Document with some children (expanded on init)", key: "id4", 
> expanded: true,
>   children: [
> {title: "Sub-item 4.1 (active on init)", active: true,
>   children: [
> {title: "Sub-item 4.1.1", key: "id4.1.1" },
> {title: "Sub-item 4.1.2", key: "id4.1.2" }
>   ]
> },
> {title: "Sub-item 4.2 (selected on init)", selected: true,
>   children: [
> {title: "Sub-item 4.2.1", key: "id4.2.1" },
> {title: "Sub-item 4.2.2", key: "id4.2.2" }
>   ]
> },
> {title: "Sub-item 4.3 (hideCheckbox)", hideCheckbox: true },
> {title: "Sub-item 4.4 (unselectable)", unselectable: true }
>   ]
> },
> {title: "Lazy folder", folder: true, lazy: true }
>   ];
>   $(function(){
> $("#tree1").fancytree({
>   checkbox: true,
>   selectMode: 1,
>   source: treeData,
>   activate: function(event, data) {
> $("#echoActive1").text(data.node.title);
>   },
>   select: function(event, data) {
> // Display list of selected nodes
> var s = data.tree.getSelectedNodes().join(", ");
> $("#echoSelection1").text(s);
>   },
>   dblclick: function(event, data) {
> data.node.toggleSelected();
>   },
>   keydown: function(event, data) {
> if( event.which === 32 ) {
>   data.node.toggleSelected();
>   return false;
> }
>   }
> });
> 
> 
>
>
> 
>   Example: Selection and checkbox
>
>
>   
>
>   Active node: -
>   Selection: -
>
>
> 
>
>
> 
>
> The controller is  just same name as the view and returns a dict which is 
> not used anyway in the view.
>
> The view loads and what you see is:
>
> Example: Selection and checkbox
>
> Active node: -
> Selection: -
>
> What am I missing?
>
>

-- 
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] Utilizzo di un template CSS adattato

2015-12-02 Thread Alessandro Leonetti
Buongiorno,
ho trovato questa guida per adattare i template CSS del sito web proposto a 
web2py, però non sono riuscito a far funzionare il tutto, credo di aver 
sbagliato a sostituire le righe di codice del passo 5 nel file layout.html.
Potreste aiutarmi? 

Il link della guida è 
questo 
http://www.web2pyslices.com/slice/show/1516/adapt-a-css-template-to-web2py-layouthtml
 e questi sono i passi indicati:

Download a CSS template from http://www.freecsstemplates.org

   1. Create a subfolder of static (example "css_template")
   2. Move template files to static/css_template
   3. Move static/css_template/index.html to views/layout.html
   4. Edit views/layout.html to fix *href* and *src* to static files using 
   {{=URL('static','css_template/style.css')}}
   5. add these to views/layout.html where you want them to appear


   - {{include}}
   - {{include 'web2py_ajax.html'}}
   - {{=MENU(response.menu)}}
   - {{=auth.navbar}}
   - {{=response.flash or ''}}

Saluti e grazie per l'assistenza,
Alessandro

-- 
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 add à link with arguments in SQLFORM.grid

2015-12-02 Thread Adrien
Hi everyone,

I'm working on web2py for the first time and i have to make a grid with 
multiple tables. That works but i want to have a link with the id of one 
table and i don't know how to send this id.
I made the following code : 

fields = (db.generalfix.IdGeneralFix, db.gene.NameGene, 
db.generalfix.PlasmidNameGeneralFix, db.generalfix.CloneIdGeneralFix, 
db.boxes.NameBoxes, db.vector.NameVector, db.status.NameStatus)
gridPlasmid = SQLFORM.grid((db.generalfix.IdGene == db.gene.IdGene)&
(db.generalfix.IdBoxes == db.boxes.IdBoxes)&
(db.generalfix.IdVector == db.vector.IdVector)&
(db.generalfix.IdStatus == db.status.IdStatus), 
fields, paginate = 100, links = [dict(header='', body=lambda row : 
A(db.generalfix.IdGene, _class='btn', _href=URL(c='show', f='show', vars = 
dict(id=db.generalfix.IdGene], user_signature = True, details = True)
return dict(var = prenom, gridPlasmid = gridPlasmid)

I use an helper to create a link but when i click on the link, instead of 
getting the value of "db.generalfix.IdGene", i get 
show/show/id=generalfix.IdGene. 
Do someone knows how to fix this problem ? I hope i'm clear, i'm not 
english.

Thx guys ! 

-- 
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] Impostare un gruppo d'appartenenza di DEFAULT per la registrazione

2015-12-02 Thread Alessandro Leonetti

Buongiorno Massimo, 

intanto comincio col ringraziarti per aver costruito Web2Py, mi stai dando 
una grossa mano per completare il mio stage universitario che prevede lo 
sviluppo di una piattaforma web.

Dunque ho un paio di domande da farti:

1) La prima è come faccio ad assegnare ad i nuovi utenti che si registrano 
alla piattaforma un Gruppo di default? 
Personalmente ho impostato a False la riga per la creazione di nuovi gruppi 
ad ogni nuova registrazione, ma non so come continuare.

2) La seconda domanda invece è se posso adattare in qualche modo i template 
di altri siti web a web2py, (ad esempio quelli di questo 
sito http://templated.co/),
oppure se ce ne sono già altri nuovi da qualche altra parte. Per ora ho 
visto solo quelli predefiniti alla pagina http://web2py.com/layouts

Ringrazio te e chiunque risponderà a questo post per l'attenzione,

Saluti,
Alessandro

-- 
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] Select Input is not preselected with existing value when updating a record.

2015-12-02 Thread Abhishek Ram
I am updating a record with a List field, but I see that the select widget 
correspoding to this field is not populated with the existing value in the 
record.

-- 
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: How to use fancytree?

2015-12-02 Thread Anthony
Always check the browser Javascript console to see if there are JS errors.

On Wednesday, December 2, 2015 at 6:52:36 AM UTC-5, DenesL wrote:
>
>
> Hi, assuming that the paths to the js & css files are correct you are 
> missing the closing of $(function(){ in your script.
> Just duplicate the last line at the very end, i.e. add });
>
> Denes
>
> On Tuesday, December 1, 2015 at 12:03:01 AM UTC-5, Henk huisman wrote:
>>
>> Fancytree looks to me as a nice javascript library to generate trees (
>> https://github.com/mar10/fancytree/wiki).
>> Unfortunatily I don't get it to work in Web2py.
>>
>> I just installed the libraries etc and copied some code from the examples 
>> websites, but the function fancytree doesnothing.
>>
>> This is the code I tried:
>>
>> 
>> 
>> 
>> Fancytree - Example: Select
>> > "{{=URL('static','fancytree/dist/skin-lion/ui.fancytree.min.css')}}"/>
>> > "text/javascript">
>> > "text/javascript">
>> > "{{=URL('static','fancytree/dist/jquery.fancytree-all.min.js')}}"
>> >
>>
>>
>> 
>>   var treeData = [
>> {title: "item1 with key and tooltip", tooltip: "Look, a tool tip!" },
>> {title: "item2: selected on init", selected: true },
>> {title: "Folder", folder: true, key: "id3",
>>   children: [
>> {title: "Sub-item 3.1",
>>   children: [
>> {title: "Sub-item 3.1.1", key: "id3.1.1" },
>> {title: "Sub-item 3.1.2", key: "id3.1.2" }
>>   ]
>> },
>> {title: "Sub-item 3.2",
>>   children: [
>> {title: "Sub-item 3.2.1", key: "id3.2.1" },
>> {title: "Sub-item 3.2.2", key: "id3.2.2" }
>>   ]
>> }
>>   ]
>> },
>> {title: "Document with some children (expanded on init)", key: "id4", 
>> expanded: true,
>>   children: [
>> {title: "Sub-item 4.1 (active on init)", active: true,
>>   children: [
>> {title: "Sub-item 4.1.1", key: "id4.1.1" },
>> {title: "Sub-item 4.1.2", key: "id4.1.2" }
>>   ]
>> },
>> {title: "Sub-item 4.2 (selected on init)", selected: true,
>>   children: [
>> {title: "Sub-item 4.2.1", key: "id4.2.1" },
>> {title: "Sub-item 4.2.2", key: "id4.2.2" }
>>   ]
>> },
>> {title: "Sub-item 4.3 (hideCheckbox)", hideCheckbox: true },
>> {title: "Sub-item 4.4 (unselectable)", unselectable: true }
>>   ]
>> },
>> {title: "Lazy folder", folder: true, lazy: true }
>>   ];
>>   $(function(){
>> $("#tree1").fancytree({
>>   checkbox: true,
>>   selectMode: 1,
>>   source: treeData,
>>   activate: function(event, data) {
>> $("#echoActive1").text(data.node.title);
>>   },
>>   select: function(event, data) {
>> // Display list of selected nodes
>> var s = data.tree.getSelectedNodes().join(", ");
>> $("#echoSelection1").text(s);
>>   },
>>   dblclick: function(event, data) {
>> data.node.toggleSelected();
>>   },
>>   keydown: function(event, data) {
>> if( event.which === 32 ) {
>>   data.node.toggleSelected();
>>   return false;
>> }
>>   }
>> });
>> 
>> 
>>
>>
>> 
>>   Example: Selection and checkbox
>>
>>
>>   
>>
>>   Active node: -
>>   Selection: -
>>
>>
>> 
>>
>>
>> 
>>
>> The controller is  just same name as the view and returns a dict which is 
>> not used anyway in the view.
>>
>> The view loads and what you see is:
>>
>> Example: Selection and checkbox
>>
>> Active node: -
>> Selection: -
>>
>> What am I missing?
>>
>>

-- 
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: FEATURE REQUEST: Case Insensitive Field types

2015-12-02 Thread Anthony
And if you're specifically interested in a case-insensitive email field in 
auth_user, you can do:

auth.email_case_sensitive = False

Anthony

On Wednesday, December 2, 2015 at 3:05:12 AM UTC-5, Niphlod wrote:
>
> There's no such thing in several backends.
> That being said, I don't see the issue using requires=IS_UPPER() or 
> requires=IS_LOWER()
>
> On Wednesday, December 2, 2015 at 8:59:49 AM UTC+1, Encompass solutions 
> wrote:
>>
>> I am not sure this exists yet, but it would be nice to take a string 
>> field (or anything string like) and make it case insensitive.  That way I 
>> don't have to worry the j...@example.com is the same as j...@example.com
>> What do you guys think?
>>
>

-- 
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: How to add à link with arguments in SQLFORM.grid

2015-12-02 Thread Anthony
On Wednesday, December 2, 2015 at 6:55:22 AM UTC-5, Adrien wrote:
>
> links = [dict(header='', body=lambda row : A(db.generalfix.IdGene, 
> _class='btn', _href=URL(c='show', f='show', vars = 
> dict(id=db.generalfix.IdGene]
>

Note, your lambda has a "row" argument, so that is what you use to access 
the field values of each record passed to the lambda:

A(row.generalfix.IdGene, _class='btn',
  _href=URL(c='show', f='show', vars = dict(id=row.generalfix.IdGene

db.generalfix.IdGene is the Field object used to define the database table 
-- it does not represent an actual value from a specific record.

Anthony

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


[web2py] Re: Select Input is not preselected with existing value when updating a record.

2015-12-02 Thread Anthony
Please show your code.

On Wednesday, December 2, 2015 at 6:55:22 AM UTC-5, Abhishek Ram wrote:
>
> I am updating a record with a List field, but I see that the select widget 
> correspoding to this field is not populated with the existing value in the 
> record.
>
>

-- 
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: How to add à link with arguments in SQLFORM.grid

2015-12-02 Thread Adrien
Okay, it works !
 I understand now, thx Anthony !

Le mercredi 2 décembre 2015 14:46:26 UTC+1, Anthony a écrit :
>
> On Wednesday, December 2, 2015 at 6:55:22 AM UTC-5, Adrien wrote:
>>
>> links = [dict(header='', body=lambda row : A(db.generalfix.IdGene, 
>> _class='btn', _href=URL(c='show', f='show', vars = 
>> dict(id=db.generalfix.IdGene]
>>
>
> Note, your lambda has a "row" argument, so that is what you use to access 
> the field values of each record passed to the lambda:
>
> A(row.generalfix.IdGene, _class='btn',
>   _href=URL(c='show', f='show', vars = dict(id=row.generalfix.IdGene
>
> db.generalfix.IdGene is the Field object used to define the database table 
> -- it does not represent an actual value from a specific record.
>
> Anthony
>
>

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


[web2py] Help with custom widget for list:reference field

2015-12-02 Thread Carlos Cesar Caballero Díaz
Hi, I am working in a plugin (based in the Tim Richardson ckeditor4 
plugin galley) for creating a global media galley for web2py 
applications (some functionality like the wordpress and other cms 
galleys), it is in https://github.com/daxslab/web2py-media-galley.


If you look at the functions get_media_field() and widget() from 
modules/plugin_daxs_media_galley.py you can see that I create a field, 
and a custom widget for that field.


Right now I am using a very ugly approach storing comma-separated images 
ids in a string field, because if I use a list:reference field it always 
throws:


Exception: Validation error, field:media object at 0x7f6158557250>


So, someone can help me with this? why this error? and how avoid it?

Cheears.

--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

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