[web2py] Re: Social network plug-in

2017-03-30 Thread Anthony
db(query) returns a Set object. The Set class has a __call__ method 
.
 
In Python, when a class has a __call__ method, instances of the class are 
*callable*, meaning they can be treated like functions and you can call 
them (with arguments). If you look at the code of the __call__ method 
linked above, you can see when you call a Set object, it takes a query, and 
the result is a new Set object that joins the original query with the new 
query via &. So, to clarify, we have:

myset = db(original_query)  # This is a callable object.
mynewset = myset(additional_query) # We now call the original set with an 
additional query.

Of course, the above can be done all in one line, as you see in the 
original example:

db(original_query)(additional_query)

which yields the same final Set as:

db(original_query & additional_query)

Note, this extends to as many queries as you want:

db(query1)(query2)(query3)(query4)

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: Social network plug-in

2017-03-29 Thread Nico de Groot
It's pythonic, an expression list see 
https://docs.python.org/2/reference/expressions.html for the basics. I didn't 
check but the web2py source code juste handles it like there is an & present.

Nico de Groot 

-- 
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: Social network plug-in

2017-03-29 Thread subtilis
I know that the topic is very old but I am bumping my head for hours now.

Why is the '&' missing?

I am trying to implement something similar to one of my projects but cannot 
seem to find the logic behind this syntax (...I could use it like this but 
I need to understand how it works!)

Can somebody please elaborate on this? Is it web2py "magic", pydal "magic" 
or something pythonic I am missing?

Many thanks 

On Sunday, July 3, 2011 at 6:18:29 PM UTC+3, Luther Goh Lu Feng wrote:
>
> Looking through the source code, 
>
> I deduce that 
>
> db(db.connection.source==auth.user_id) 
> (db.connection.target==request.args(1)).delete() 
>
> is the same as 
>
> db((db.connection.source==auth.user_id)) & 
> (db.connection.target==request.args(1))).delete() 
>
>
> Is this new syntax? I did not recall reading it in the book. Pls point 
> me to the section in the book if it is already there. Tks! 
>
> On Jun 12, 12:09 am, Massimo Di Pierro  
> wrote: 
> > Here is the source of the facebook clone 
> > 
> >  web2py.app.friends.w2p 
> > 1002KViewDownload

-- 
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: Social network plug-in

2011-07-03 Thread Luther Goh Lu Feng
Looking through the source code,

I deduce that

db(db.connection.source==auth.user_id)
(db.connection.target==request.args(1)).delete()

is the same as

db((db.connection.source==auth.user_id)) &
(db.connection.target==request.args(1))).delete()


Is this new syntax? I did not recall reading it in the book. Pls point
me to the section in the book if it is already there. Tks!

On Jun 12, 12:09 am, Massimo Di Pierro 
wrote:
> Here is the source of the facebook clone
>
>  web2py.app.friends.w2p
> 1002KViewDownload


[web2py] Re: Social network plug-in

2011-06-21 Thread stefaan
> 'friendship' is an Ajax callback defined later on.

[OFF TOPIC] Finally a concise definition of friendship that I can hope
to understand at some point in the future ;)


[web2py] Re: Social network plug-in

2011-06-19 Thread peter
I tried the facebook clone app, and when I logged in using my google
id I got and internal error.

friends/85.211.34.104.2011-06-19.21-09-18.b6e21f1b-1439-46c0-b2f9-
a2d40bee1b20



On Jun 19, 7:41 am, niknok  wrote:
> Can someone post this somewhere where resume download is supported? I
> got a crappy connection right now...
>
> On Jun 12, 12:09 am, Massimo Di Pierro 
> wrote:
>
>
>
> > Here is the source of the facebook clone
>
> >  web2py.app.friends.w2p
> > 1002KViewDownload- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: Social network plug-in

2011-06-18 Thread niknok
Can someone post this somewhere where resume download is supported? I
got a crappy connection right now...

On Jun 12, 12:09 am, Massimo Di Pierro 
wrote:
> Here is the source of the facebook clone
>
>  web2py.app.friends.w2p
> 1002KViewDownload


[web2py] Re: Social network plug-in

2011-06-18 Thread François
Thank you Massimo !

François

On 11 juin, 18:09, Massimo Di Pierro 
wrote:
> Here is the source of the facebook clone
>
>  web2py.app.friends.w2p
> 1002KAfficherTélécharger


Re: [web2py] Re: Social network plug-in

2011-06-11 Thread Stifan Kristi
thank you so much for your shared, massimo.


Re: [web2py] Re: Social network plug-in

2011-06-11 Thread Tito Garrido
+1

On Sat, Jun 11, 2011 at 12:47 AM, Luis Goncalves wrote:

> Ciao Massimo!
>
> Is it now available somewhere for download?   It will be very useful!!!
>
> Thanks,
> Luis.
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: Social network plug-in

2011-06-10 Thread Luis Goncalves
Ciao Massimo!

Is it now available somewhere for download?   It will be very useful!!!

Thanks,
Luis.


[web2py] Re: Social network plug-in

2011-06-03 Thread François
I can answer 4). 'friendship' is an Ajax callback defined later on.

The only problem with this otherwise excellent video is that sometimes
we cannot see the ends of the lines. For example around 9:50 (at the
end of the URL).

François


On 3 juin, 02:02, François  wrote:
> I have a few questions on the code.
>
> 1) The "myfriends" table is defined as :
>
>   myfriends = db(Link.source==me)(Link.accepted==True)
>
> But if someone asks for my friendship and I accept, then he won't be
> in "myfriends" until I ask myself for his friendship (and he accepts).
> Am I right ?
> Maybe we could do two queries and unite them with "lambda a,b:a&b" ?
>
> 2) There are many functions which end with :
>
>   return locals()
>
> Does it return all the local variables defined in the function ?
>
> 3) Although I know what the result is, I don't understand the logic of
> this query :
>
>   # list all friendship requests we received
>   friends = db(User.id==Link.source)
> (Link.target==me).select(orderby=alphabetical)
>
> What I don't understand is that the query deals with two different
> tables.
>
> 4) Then all that ajax is Chinese for me ;)
>
>  onclick="ajax('{{=URL('friendship',args=('request',user.id))}}',
> [,null);$(this).parent().html('pending')">request friendship
>
> Where was the 'friendship' of the URL defined ?
>
> Thanks to anybody who answers part of these questions,
> François
>
> On 2 juin, 23:03, Massimo Di Pierro 
> wrote:
>
>
>
> > I have it somewhere. I will post it on web2py appliances asap.
>
> > On Jun 2, 3:06 pm, François  wrote:
>
> > > Thank you, this is nice and impressive !
>
> > > Is there a place where I can download the code ?
>
> > > François
>
> > > On 2 juin, 17:57, Massimo Di Pierro 
> > > wrote:
>
> > > > Something like this?http://vimeo.com/21364178
>
> > > > On Jun 2, 10:09 am, François  wrote:
>
> > > > > Hello everybody,
>
> > > > > Is there a social network plug-in for Web2py, which for example allows
> > > > > users to send messages to each other ?
>
> > > > > Thank you very much,
> > > > > François- Masquer le texte des messages précédents -
>
> > > > - Afficher le texte des messages précédents -- Masquer le texte des 
> > > > messages précédents -
>
> > - Afficher le texte des messages précédents -- Masquer le texte des 
> > messages précédents -
>
> - Afficher le texte des messages précédents -


[web2py] Re: Social network plug-in

2011-06-02 Thread François
I have a few questions on the code.

1) The "myfriends" table is defined as :

  myfriends = db(Link.source==me)(Link.accepted==True)

But if someone asks for my friendship and I accept, then he won't be
in "myfriends" until I ask myself for his friendship (and he accepts).
Am I right ?
Maybe we could do two queries and unite them with "lambda a,b:a&b" ?

2) There are many functions which end with :

  return locals()

Does it return all the local variables defined in the function ?

3) Although I know what the result is, I don't understand the logic of
this query :

  # list all friendship requests we received
  friends = db(User.id==Link.source)
(Link.target==me).select(orderby=alphabetical)

What I don't understand is that the query deals with two different
tables.

4) Then all that ajax is Chinese for me ;)

request friendship

Where was the 'friendship' of the URL defined ?

Thanks to anybody who answers part of these questions,
François


On 2 juin, 23:03, Massimo Di Pierro 
wrote:
> I have it somewhere. I will post it on web2py appliances asap.
>
> On Jun 2, 3:06 pm, François  wrote:
>
>
>
> > Thank you, this is nice and impressive !
>
> > Is there a place where I can download the code ?
>
> > François
>
> > On 2 juin, 17:57, Massimo Di Pierro 
> > wrote:
>
> > > Something like this?http://vimeo.com/21364178
>
> > > On Jun 2, 10:09 am, François  wrote:
>
> > > > Hello everybody,
>
> > > > Is there a social network plug-in for Web2py, which for example allows
> > > > users to send messages to each other ?
>
> > > > Thank you very much,
> > > > François- Masquer le texte des messages précédents -
>
> > > - Afficher le texte des messages précédents -- Masquer le texte des 
> > > messages précédents -
>
> - Afficher le texte des messages précédents -


[web2py] Re: Social network plug-in

2011-06-02 Thread mart
LOL :) its been about 6 weeks and I'm still listening to the video and
typing (then correcting my bad spelling :) )  - my daughter is keen on
"adding color" and using it at school -because daddy (me) won't let
her near the the official FaceBook ;) Although at the rate i seem to
get things done lately, it may wait for the next school year ;) ).

Also, there could be good and fun use for your great clone @ work as
well :)

thanks for that! :)

Mart

On Jun 2, 5:03 pm, Massimo Di Pierro 
wrote:
> I have it somewhere. I will post it on web2py appliances asap.
>
> On Jun 2, 3:06 pm, François  wrote:
>
>
>
>
>
>
>
> > Thank you, this is nice and impressive !
>
> > Is there a place where I can download the code ?
>
> > François
>
> > On 2 juin, 17:57, Massimo Di Pierro 
> > wrote:
>
> > > Something like this?http://vimeo.com/21364178
>
> > > On Jun 2, 10:09 am, François  wrote:
>
> > > > Hello everybody,
>
> > > > Is there a social network plug-in for Web2py, which for example allows
> > > > users to send messages to each other ?
>
> > > > Thank you very much,
> > > > François- Masquer le texte des messages précédents -
>
> > > - Afficher le texte des messages précédents -


Re: [web2py] Re: Social network plug-in

2011-06-02 Thread Stifan Kristi
very cool, massimo, hope you can share it, so that we can learn from it,
thank you so much.

On Fri, Jun 3, 2011 at 4:03 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I have it somewhere. I will post it on web2py appliances asap.
>
> On Jun 2, 3:06 pm, François  wrote:
> > Thank you, this is nice and impressive !
> >
> > Is there a place where I can download the code ?
> >
> > François
> >
> > On 2 juin, 17:57, Massimo Di Pierro 
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Something like this?http://vimeo.com/21364178
> >
> > > On Jun 2, 10:09 am, François  wrote:
> >
> > > > Hello everybody,
> >
> > > > Is there a social network plug-in for Web2py, which for example
> allows
> > > > users to send messages to each other ?
> >
> > > > Thank you very much,
> > > > François- Masquer le texte des messages précédents -
> >
> > > - Afficher le texte des messages précédents -
>


[web2py] Re: Social network plug-in

2011-06-02 Thread Massimo Di Pierro
I have it somewhere. I will post it on web2py appliances asap.

On Jun 2, 3:06 pm, François  wrote:
> Thank you, this is nice and impressive !
>
> Is there a place where I can download the code ?
>
> François
>
> On 2 juin, 17:57, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Something like this?http://vimeo.com/21364178
>
> > On Jun 2, 10:09 am, François  wrote:
>
> > > Hello everybody,
>
> > > Is there a social network plug-in for Web2py, which for example allows
> > > users to send messages to each other ?
>
> > > Thank you very much,
> > > François- Masquer le texte des messages précédents -
>
> > - Afficher le texte des messages précédents -


[web2py] Re: Social network plug-in

2011-06-02 Thread François
Thank you, this is nice and impressive !

Is there a place where I can download the code ?

François


On 2 juin, 17:57, Massimo Di Pierro 
wrote:
> Something like this?http://vimeo.com/21364178
>
> On Jun 2, 10:09 am, François  wrote:
>
>
>
> > Hello everybody,
>
> > Is there a social network plug-in for Web2py, which for example allows
> > users to send messages to each other ?
>
> > Thank you very much,
> > François- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -


[web2py] Re: Social network plug-in

2011-06-02 Thread Massimo Di Pierro
Something like this?
http://vimeo.com/21364178

On Jun 2, 10:09 am, François  wrote:
> Hello everybody,
>
> Is there a social network plug-in for Web2py, which for example allows
> users to send messages to each other ?
>
> Thank you very much,
> François