Hi Ramos, I can see here Lotus Notes roots :-)  
But defnitely some auth based functions would be nice as part of web2py as 
they are generaly usefull. They could be even part of auth object. Someting 
like  auth.my_groups(), auth.my_roles(), auth.emails_for_group(group_name), 
auth.find_by_email(email) etc ...


David

Dne pátek, 11. ledna 2013 13:16:21 UTC+1 Ramos napsal(a):
>
> Web2py has html helpers for some reason rigth?
> Its the same principle.
>
> I know its not a priority. 99,99% dont need it but could be added to that 
> document that compares web2py to others, showing less code in web2py.
>
> I just dont link my keyboard!!
> Thank you
>
> 2013/1/11 Niphlod <[email protected] <javascript:>>
>
>> It's hardly a "feature" when you can do it in less than 10 lines of code. 
>> You want to send it in a "to" list, another one could want to do a "cc", 
>> another one a "cc" with a "ccn" of the 1 user registered and so on......
>>
>> Let's try to not blow web2py up with those shortcuts.
>>
>> def send_to_groupname(groupname, **kwargs):
>>     """
>>     send mail to all peoples in a group
>>     """
>>     rtn = db(
>>         (db.auth_group.role == groupname) &
>>         (db.auth_membership.group_id == db.auth_group.id) &
>>         (db.auth_user.id == db.auth_membership.user_id)
>>         ).select(db.auth_user.email, distinct=True)
>>     tolist = []
>>     for row in rtn:
>>         tolist.append(row.email)
>>     return mail.send(to=tolist, **kwargs)
>>
>> so, you can do
>>
>> send_to_group_name('administrator')
>>
>>
>>
>> On Friday, January 11, 2013 12:30:13 PM UTC+1, Ramos wrote:
>>
>>> But it would be nice to do it like
>>>
>>> mail.send('[administrators]','****Message subject','Plain text body of 
>>> the message')
>>>
>>> It would be much simpler for people developing apps that sends a lot of 
>>> email between users and groups
>>> like workflow apps.
>>>
>>>
>>> Can you put it in the wish list?
>>>
>>>
>>>
>>> 2013/1/11 Niphlod <[email protected]>
>>>
>>> no, you need to pass a list of email addresses. It's not difficult to 
>>>> retrieve that info given the name of the group, you must only do a query 
>>>> to 
>>>> do that.
>>>>
>>>>
>>>> On Friday, January 11, 2013 12:15:14 PM UTC+1, Ramos wrote:
>>>>>
>>>>> Hello,can i send an email to a group 
>>>>> like
>>>>>
>>>>> mail.send('[administrators]','****Message subject','Plain text body 
>>>>> of the message')
>>>>>
>>>>> Thank you
>>>>>
>>>>>  -- 
>>>>  
>>>>  
>>>>  
>>>>
>>>
>>>  -- 
>>  
>>  
>>  
>>
>
>

-- 



Reply via email to