[web2py] Re: Change in application request.vars when switching from Rocket to Lighttpd+FastCGI

2015-03-01 Thread Niphlod
yep, but we do it "for the users" in all the "important" places, like 
this, we use request.env.get('THE_PROPER_KEY')

On Saturday, February 28, 2015 at 9:27:20 PM UTC+1, Massimo Di Pierro wrote:
>
> They are upper case in wsgi but we are supposed to make them all lower 
> case here:
>
> https://github.com/web2py/web2py/blob/master/gluon/rewrite.py#L1073
>
> On Saturday, 28 February 2015 10:44:35 UTC-6, Niphlod wrote:
>>
>>
>>
>> On Saturday, February 28, 2015 at 5:08:38 PM UTC+1, Massimo Di Pierro 
>> wrote:
>>>
>>> it is supposed to be request.env.query_string 
>>> or request.env.get('query_string'). It is supposed to be lower case and not 
>>> upper case. If nginx has it upper case than there is a bug.
>>>
>>> In retrospect it was a mistake to convert all the env vars to lower case 
>>> and replace the dashed with underscore but that is what web2py does anyway.
>>>


>> uhm. the problem was on lighttpd. 
>> Anyway, I think env vars are all uppercase: we just normalize them to 
>> have an underscore and be lowercase, but it's certainly not the issue at 
>> hand...web2py's code picks it up from the right place.
>>
>

-- 
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: Please help us test the 2.9.12 binaries

2015-03-01 Thread pang
In my app I also have several errors importing Table and Row from DAL in 
modules. They sure can be fixed, but there is no hint at the changelog, and 
web2py used to advertise as "has never broken backwards compatibility". I 
kindly suggest indicating the required changes in the changelog, instead of 
"Modular DAL, thanks Giovanni", which doesn't look like it requires action 
(and provides no hint about the solution).

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


Re: [web2py][Javascript] Massimo here searching for some javascript devs ready to port web2py in JS

2015-03-01 Thread lucas
you know ya'll, none of that is funny at all.  and april is soon to be on 
us again.

-- 
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 hide app name and how to prevent name "leakage" if hosting multiple apps on one server?

2015-03-01 Thread Dragan Matic
Let's say that I have application named app1 and I am hosting it on 
www.app1.com domain. I would like application name not to be shown. If for 
instance I have two controllers, ctr1 and ctr2, URL helper will always 
generate addresses like www.app1.com/*app1*/ctr1/some_function and www.app1/
*app1*/ctr2/some_function and I would like to have something like 
www.app1.com/ctr/some_function - URL without application name. 

Second question is if I have two applications hosted on the same server 
(app1 and app2, registered on www.app1.com and www.app2.com domains) I know 
that if I setup routes.py something like domains = {'www.app1.com' : 
'app1', 'www.app2.com' : 'app2'} then app1 will be shown on www.app1.com 
and app2 will be shown on www.app2.com. However, that doesn't prevent the 
user to type something like www.*app1*.com/*app2*/default/index and app2 
will we shown on www.app1.com domain. Is there a way to prevent this or 
each application must be hosted on separate server?

-- 
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: Highlighting text in a text area component on web2py

2015-03-01 Thread Massimo Di Pierro
Does thi help?
http://www.sitepoint.com/10-jquery-text-highlighter-plugins/

On Saturday, 28 February 2015 10:02:31 UTC-6, Kelvin Nyota wrote:
>
> I need a code for highlighting text with a different color on web2py, text 
> area component and to show a drop down list before the bad words are 
> replaced.
>

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


Re: [web2py][Javascript] Massimo here searching for some javascript devs ready to port web2py in JS

2015-03-01 Thread Massimo Di Pierro
What can I say. What was a good April's fool in 2014 may actually be a good 
idea on 2015. ;-)

http://www.rapydscript.com/

Massimo

On Sunday, 1 March 2015 05:27:58 UTC-6, lucas wrote:
>
> you know ya'll, none of that is funny at all.  and april is soon to be on 
> us again.
>

-- 
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 hide app name and how to prevent name "leakage" if hosting multiple apps on one server?

2015-03-01 Thread Niphlod


On Sunday, March 1, 2015 at 1:33:09 PM UTC+1, Dragan Matic wrote:
>
> Let's say that I have application named app1 and I am hosting it on 
> www.app1.com domain. I would like application name not to be shown. If 
> for instance I have two controllers, ctr1 and ctr2, URL helper will always 
> generate addresses like www.app1.com/*app1*/ctr1/some_function and 
> www.app1/*app1*/ctr2/some_function and I would like to have something 
> like www.app1.com/ctr/some_function - URL without application name. 
>

read the relevant section on the book about routes. 
 

>
> Second question is if I have two applications hosted on the same server 
> (app1 and app2, registered on www.app1.com and www.app2.com domains) I 
> know that if I setup routes.py something like domains = {'www.app1.com' : 
> 'app1', 'www.app2.com' : 'app2'} then app1 will be shown on www.app1.com 
> and app2 will be shown on www.app2.com. However, that doesn't prevent the 
> user to type something like www.*app1*.com/*app2*/default/index and app2 
> will we shown on www.app1.com domain. Is there a way to prevent this or 
> each application must be hosted on separate server?
>

even if you can't figure out a routes.py system out of it, you can run 2 
different instances of web2py, each one with a single app hosted, on the 
same server.
 

-- 
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: avatar like feature as in instant press

2015-03-01 Thread Abhijit Chatterjee
I put the "auth.settings.extra_fields..." in my model db.by and the rest in 
my controller default.py.

How do I now implement them. Any thoughts?

On Thursday, February 26, 2015 at 8:04:27 PM UTC-5, Leonel Câmara wrote:
>
> It's not very hard, here's a possibility that requires you to have pillow 
>  installed.
>
>
> auth.settings.extra_fields['auth_user'] = [
> Field('photo', 'upload', label=T('Photo'), uploadseparate=True, 
> requires=[IS_EMPTY_OR(IS_IMAGE(error_message=T('This is not an image.'))), 
> IS_LENGTH(maxsize=1048576)]),
> Field('avatar','upload', uploadseparate=True, readable=False, writable
> =False, autodelete=True, compute=lambda row: SMARTHUMB('auth_user', row.
> photo, (32, 32), name='avatar')),
> ]
>
>
>
> def upload_fullpath(tablename, filename, makedirs=False):
> """
> Given a tablename and a filename return the full path
> TODO: For now it assumes uploadseparate=True in the field definition,
>   could be more versatile.
> """
> import os
> from gluon import current
> fieldname, img_uid = filename.split('.')[1:3]
> path = os.path.join(current.request.folder, 'uploads', tablename + '.' 
> + fieldname, img_uid[:2], filename)
> if makedirs:
> try:
> os.makedirs(os.path.dirname(path))
> except OSError:
> print "Skipping creation of %s because it exists already." % 
> os.path.dirname(path)
> return path
>
>
> def SMARTHUMB(tablename, image, box, fit=True, name="thumbnail"):
> """
> Downsample the image.
> 
> http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box
>
> Modified to respect uploadseparate=True differences
>
>  @param img: Image -  an Image-object
>  @param box: tuple(x, y) - the bounding box of the result image
>  @param fit: boolean - crop the image to fill the box
> """
> if image:
> from PIL import Image
> import os
> from gluon.tools import current, web2py_uuid
> request = current.request
> img = Image.open(upload_fullpath(tablename, image))
> #preresize image with factor 2, 4, 8 and fast algorithm
> factor = 1
> while img.size[0] / factor > 2 * box[0] and img.size[1] * 2 / 
> factor > 2 * box[1]:
> factor *= 2
> if factor > 1:
> img.thumbnail((img.size[0] / factor, img.size[1] / factor), 
> Image.ANTIALIAS)
>  
> #calculate the cropping box and get the cropped part
> if fit:
> x1 = y1 = 0
> x2, y2 = img.size
> wRatio = 1.0 * x2 / box[0]
> hRatio = 1.0 * y2 / box[1]
> if hRatio > wRatio:
> y1 = int(y2 / 2 - box[1] * wRatio / 2)
> y2 = int(y2 / 2 + box[1] * wRatio / 2)
> else:
> x1 = int(x2 / 2 - box[0] * hRatio / 2)
> x2 = int(x2 / 2 + box[0] * hRatio / 2)
> img = img.crop((x1, y1, x2, y2))
>  
> #Resize the image with best quality algorithm ANTI-ALIAS
> img = img.resize(box, Image.ANTIALIAS)
>  
> root, ext = os.path.splitext(image)
> thumbname = '%s.%s.%s.%s%s' % (tablename, name, web2py_uuid().
> replace('-', '')[-16:], web2py_uuid().replace('-', '')[-16:], ext)
> img.save(upload_fullpath(tablename, thumbname, makedirs=True))   
>  
> ...

-- 
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 get host and scheme from a scheduled task?

2015-03-01 Thread Lisandro
>From the book (scheduler documentation) [1]: 
"Tasks differ from a controller action because they are not associated with 
an HTTP request and therefore there is no request.env"

I have several method fields that generate urls using URL() function with 
args scheme=True and host=True, but when those methods are called from a 
scheduled task, the "host" in the final url is 127.0.0.1, and I need it to 
be the main domain. 

So, is it possible to get host and scheme from a scheduled task given that 
there is no http request? Thanks in advance.

[1] - 
http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler

-- 
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: avatar like feature as in instant press

2015-03-01 Thread Abhijit Chatterjee
Leonel, also, if you want to do some consulting, please let m know...
-Ron


On Sunday, March 1, 2015 at 1:14:41 PM UTC-5, Abhijit Chatterjee wrote:
>
> I put the "auth.settings.extra_fields..." in my model db.by and the rest 
> in my controller default.py.
>
> How do I now implement them. Any thoughts?
>
> On Thursday, February 26, 2015 at 8:04:27 PM UTC-5, Leonel Câmara wrote:
>>
>> It's not very hard, here's a possibility that requires you to have pillow 
>>  installed.
>>
>>
>> auth.settings.extra_fields['auth_user'] = [
>> Field('photo', 'upload', label=T('Photo'), uploadseparate=True, 
>> requires=[IS_EMPTY_OR(IS_IMAGE(error_message=T('This is not an image.'
>> ))), IS_LENGTH(maxsize=1048576)]),
>> Field('avatar','upload', uploadseparate=True, readable=False, 
>> writable=False, autodelete=True, compute=lambda row: SMARTHUMB(
>> 'auth_user', row.photo, (32, 32), name='avatar')),
>> ]
>>
>>
>>
>> def upload_fullpath(tablename, filename, makedirs=False):
>> """
>> Given a tablename and a filename return the full path
>> TODO: For now it assumes uploadseparate=True in the field definition,
>>   could be more versatile.
>> """
>> import os
>> from gluon import current
>> fieldname, img_uid = filename.split('.')[1:3]
>> path = os.path.join(current.request.folder, 'uploads', tablename + 
>> '.' + fieldname, img_uid[:2], filename)
>> if makedirs:
>> try:
>> os.makedirs(os.path.dirname(path))
>> except OSError:
>> print "Skipping creation of %s because it exists already." % 
>> os.path.dirname(path)
>> return path
>>
>>
>> def SMARTHUMB(tablename, image, box, fit=True, name="thumbnail"):
>> """
>> Downsample the image.
>> 
>> http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box
>>
>> Modified to respect uploadseparate=True differences
>>
>>  @param img: Image -  an Image-object
>>  @param box: tuple(x, y) - the bounding box of the result image
>>  @param fit: boolean - crop the image to fill the box
>> """
>> if image:
>> from PIL import Image
>> import os
>> from gluon.tools import current, web2py_uuid
>> request = current.request
>> img = Image.open(upload_fullpath(tablename, image))
>> #preresize image with factor 2, 4, 8 and fast algorithm
>> factor = 1
>> while img.size[0] / factor > 2 * box[0] and img.size[1] * 2 / 
>> factor > 2 * box[1]:
>> factor *= 2
>> if factor > 1:
>> img.thumbnail((img.size[0] / factor, img.size[1] / factor), 
>> Image.ANTIALIAS)
>>  
>> #calculate the cropping box and get the cropped part
>> if fit:
>> x1 = y1 = 0
>> x2, y2 = img.size
>> wRatio = 1.0 * x2 / box[0]
>> hRatio = 1.0 * y2 / box[1]
>> if hRatio > wRatio:
>> y1 = int(y2 / 2 - box[1] * wRatio / 2)
>> y2 = int(y2 / 2 + box[1] * wRatio / 2)
>> else:
>> x1 = int(x2 / 2 - box[0] * hRatio / 2)
>> x2 = int(x2 / 2 + box[0] * hRatio / 2)
>> img = img.crop((x1, y1, x2, y2))
>>  
>> #Resize the image with best quality algorithm ANTI-ALIAS
>> img = img.resize(box, Image.ANTIALIAS)
>>  
>> root, ext = os.path.splitext(image)
>> thumbname = '%s.%s.%s.%s%s' % (tablename, name, web2py_uuid().
>> replace('-', '')[-16:], web2py_uuid().replace('-', '')[-16:], ext)
>> img.save(upload_fullpath(tablename, thumbname, makedirs=True))   
>>  
>> ...
>
>

-- 
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] Anyone interested in web2py consulting?

2015-03-01 Thread Abhijit Chatterjee
Hello,

I am learning web2py framework and I am new in web design. So, I would like 
to work with someone on few projects and hopefully learn a lot. Anyone 
interested in consulting/tutoring? I am open for ideas/prices...any 
thoughts?

Ron

-- 
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 get host and scheme from a scheduled task?

2015-03-01 Thread Niphlod
uhm... the host is different from the hostname and from the "domain". 
Usually, the pretty thing about the request environment is that there is a 
"Host" header sent by client that indicates which "domain" it has been 
accessed. This makes your application unaware that is running on a 
particular domain, whilst keep it working without issues.
Since the scheduler can run on any hostname (also in ones that don't 
usually have a webserver), we can't known what hostname may have been 
requested, and that host header is never coming in to signal what is the 
proper hostname to use.

tl;dr:  use URL(..., host='www.domain.com') instead of URL(, 
host=True)

 

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


Re: [web2py] Re: How to get host and scheme from a scheduled task?

2015-03-01 Thread Lisandro Rostagno
I understand. thank you very much for the answer.
I guess I will add a global variable to set the main domain and use it in
those cases.

2015-03-01 16:37 GMT-03:00 Niphlod :

> uhm... the host is different from the hostname and from the "domain".
> Usually, the pretty thing about the request environment is that there is a
> "Host" header sent by client that indicates which "domain" it has been
> accessed. This makes your application unaware that is running on a
> particular domain, whilst keep it working without issues.
> Since the scheduler can run on any hostname (also in ones that don't
> usually have a webserver), we can't known what hostname may have been
> requested, and that host header is never coming in to signal what is the
> proper hostname to use.
>
> tl;dr:  use URL(..., host='www.domain.com') instead of URL(,
> host=True)
>
>
>
>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/G34QiEhOi0s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: show_if is not working with SQLFORM.factory multitable

2015-03-01 Thread Ramkrishan Bhatt
Ya why don't you try your self with SQLFORM and SQLFORM.factory with multiple 
tables. Than use show_if than you will get it what I want.

-- 
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] "belongs" statement for grid

2015-03-01 Thread Alex Glaros
get this error

Query Not Supported: no such column: BlockedConnection.blockingPerson

when trying to exclude "blocked" people in social network app

doNotDisplayThisPersonQuery = ((db.auth_user.id == db.BlockedConnection.
blockingPerson) & (db.BlockedConnection.blockedPerson == auth.user_id))

query = ~db.auth_user.id.belongs([doNotDisplayThisPersonQuery])

grid = SQLFORM.grid(query, fields=[db.BlockedConnection.blockingPerson, db.
BlockedConnection.blockedPerson, db.auth_user.first_name, db.auth_user.
last_name, db.auth_user.personMiddleName, db.auth_user.currentPosition, db.
auth_user.summarySelfDescription, db.auth_user.keyWords])

any ideas on how to fix or write smarter function?

thanks

Alex Glaros





-- 
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: show_if is not working with SQLFORM.factory multitable

2015-03-01 Thread Leonel Câmara
Turns out you're right, here's a possible workaround:

def register():
db.purchase.coupon_code.show_if = (db.purchase.have_coupon == 
'Individual')

form=SQLFORM.factory(db.client,db.address,db.purchase)
form.element(_id='no_table_coupon_code')['_data-show-trigger'] = 
'no_table_have_coupon'
if form.accepts(request.vars):
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)

-- 
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: avatar like feature as in instant press

2015-03-01 Thread Leonel Câmara
I'm up to doing some consulting.

You can put all that code in the models before the line where you do 
auth.define_tables() or you can put upload_fullpath and SMARTHUMB in a 
module and then you import SMARTHUMB in your models before 
auth.settings.extra_fields.

This solution uses a computed field to make the avatar from the photo 
field, so you really don't need any controllers, see:

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Computed-fields

To show the avatar of the logged in user for example you could just do:


PS:. You may need to logout and log back in to see the avatar if you do it 
this way.

-- 
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: "belongs" statement for grid

2015-03-01 Thread Niphlod
there's a bit of short-circuit in this.

small recap:
- SQLFORM.grid() takes a query, i.e. db(set), i.e. just what you'd like to 
display without the .select() part
- belongs() is a method to build up a condition, that takes either a list 
of values, or a subselect, i.e. a full db(set).select(thevalueyouneed)
- if you put a select() on the "thing" you pass to the grid, you should get 
the results you want

so, let's go step-by-step

1. your CamelCased DontDisplayThisPersonQuery needs to be "augmented"... it 
needs to return a list of ids that you want to exclude... you should have 
it in this form: db(someconditions)._select(db.auth_user.id) <-- mind the 
_select() part that makes it a subselect elegible to be passed as a 
belongs() argument
2. try final the query first with .select(), such as db(~
db.auth_user.id.belongs(theaugmented)).select()
3. once confirmed that 2. returns what you want, strip the select() part 
and pass it to the grid, such as SQLFORM.grid(db(~
db.auth_user.id.belongs(theaugmented)))


On Sunday, March 1, 2015 at 10:50:53 PM UTC+1, Alex Glaros wrote:
>
> get this error
>
> Query Not Supported: no such column: BlockedConnection.blockingPerson
>
> when trying to exclude "blocked" people in social network app
>
> doNotDisplayThisPersonQuery = ((db.auth_user.id == db.BlockedConnection.
> blockingPerson) & (db.BlockedConnection.blockedPerson == auth.user_id))
>
> query = ~db.auth_user.id.belongs([doNotDisplayThisPersonQuery])
>
> grid = SQLFORM.grid(query, fields=[db.BlockedConnection.blockingPerson, db
> .BlockedConnection.blockedPerson, db.auth_user.first_name, db.auth_user.
> last_name, db.auth_user.personMiddleName, db.auth_user.currentPosition, db
> .auth_user.summarySelfDescription, db.auth_user.keyWords])
>
> any ideas on how to fix or write smarter function?
>
> thanks
>
> Alex Glaros
>
>
>
>
>
>

-- 
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] Problems after upgrading to 2.9.12

2015-03-01 Thread naveed
I was running a version 2.8.x without any trouble except that the forgot 
email feature was not working. I upgraded to 2.9.12 and my index page is 
being rendered as text (the source is being displayed on the browser). The 
content-type is showing up as json instead of html. I made NO changes to 
the application in months. After manually setting 

response.headers['Content-Type'] = 'text/html'

in the index controller, the page renders correctly as HTML. But an ajax 
response that was returning JSON is failing on both Chrome and Firefox. 
Firefox shows a this error message:

SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the 
JSON data

Upon further investigation, it appears that the return is now actually JSON 
and it wasn't earlier, the content-type is JSON now. Something's changed 
with the content-type and is breaking previously working applications.

-- 
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] ImportError: No module named duplicity.tarfile

2015-03-01 Thread Ramkrishan Bhatt
HIi Everyone,
After deploying in the server i got this issue. 

-- 
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: avatar like feature as in instant press

2015-03-01 Thread Ron Chatterjee
Leonel, Whats be your email address? Mine is achatterjee...@gmail.com

I am not a web developer but I started to learn web2py and want to get good 
at it. Since my background is different, I need some help. Right now, I am 
coming up with task to myself and trying to learn web2py by working these 
tasks. But I have questions and need help. May be what we can do is, send 
you a w2p file with a power point presentation. And I ask you the question 
explaining where I am stuck, what I am trying to do and what help I 
need,... and you without doing the job, may be you can send me some 
screenshots and links and I pay you hourly? There is a web site call 
peopleperhour. We can go through that or if you have another way to do 
things, I am open for ideas.

I have few plans, may be over time it may become something more but to be 
honest, for now, it just small jobs here and there and tutoring thats all I 
need. That may change in the long run but I am not sure.

Ron
 

On Sunday, March 1, 2015 at 5:08:19 PM UTC-5, Leonel Câmara wrote:
>
> I'm up to doing some consulting.
>
> You can put all that code in the models before the line where you do 
> auth.define_tables() or you can put upload_fullpath and SMARTHUMB in a 
> module and then you import SMARTHUMB in your models before 
> auth.settings.extra_fields.
>
> This solution uses a computed field to make the avatar from the photo 
> field, so you really don't need any controllers, see:
>
>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Computed-fields
>
> To show the avatar of the logged in user for example you could just do:
> 
>
> PS:. You may need to logout and log back in to see the avatar if you do it 
> this way.
>

-- 
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: ImportError: No module named duplicity.tarfile

2015-03-01 Thread Leonel Câmara
Could you have installed duplicity in another python version on the same 
system instead of the one that's running 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: "belongs" statement for grid

2015-03-01 Thread Alex Glaros
works perfect Niphlod,

1. is underscore var name preferable to camel case in w2py?

2. is there any difference between .select and ._select? (in my data, works 
the same)

working code example:

doNotDisplayThisPersonQuery = db(( db.auth_user.id == db.BlockedConnection.
blockingPerson) & (db.BlockedConnection.blockedPerson == auth.user_id)).
select(db.auth_user.id)

grid = SQLFORM.grid(~db.auth_user.id.belongs(doNotDisplayThisPersonQuery
).

the "._select(db.auth_user.id)" filled a big gap in my understanding

much appreciated!

Alex







-- 
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: When not HTTPS i receive TypeError: 'NoneType' object is not callable

2015-03-01 Thread UG
with some testing I managed to find a cause to it, though i am not sure why.

To summarize.

i had not changed Apache configuration since install. (Debian stable)

The application was running without a problem. I then did some updates to 
the application on my local machine and pushed them up to the server via 
the admin interface. 
The updates where just new pages. Nothing much different from what was 
already being used and working in the application.

With your mention the error maybe in Apace config. I checked my 
configuration against the one in the Web2py book , my only difference was 
that i had the ServerName and Alias set as my domain name.

i removed these and it functioned. So that was the problem. I am not sure 
why it would work for so long if it was incorrect or what in the upgrade i 
did that would call this configuration to suddenly cause a problem.

Thanks for the help guys. This was a tricky one for me.








On Thursday, February 26, 2015 at 4:39:31 AM UTC-8, Leonel Câmara wrote:
>
> I think this is probably a webserver (probably apache) configuration 
> issue. Have you made any changes to the configuration recently?
>

-- 
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] future of markmin

2015-03-01 Thread Massimo Di Pierro
I believe the future of Markmin is client-side. So I made this:

http://experts4solutions.com/markmin2

Can you help me test it? Suggestions for improvement? I think will make it 
easier to build wikis in web2py and not in 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: Weird Error Message From Web2py - OSError: [Errno 24] Too many open files ???????

2015-03-01 Thread Yusuf Kaka
I've got the same error, was there any resolution?

On Monday, February 22, 2010 at 2:28:17 AM UTC+2, Pascal wrote:
>
> Thanks for the note... I'm usually running Web2py through Wing IDE
> since it is easy for debugging...
> Please let me know if you have any questions regarding this issue
>
> Yannick P.
>
> On Feb 21, 4:02 pm, Massimo Di Pierro  wrote:
> > This is interesting I will take a look asap.
> >
> > Meanwhile, if you are not using cron, run web2py with -N.
> >
> > Massimo
> >
> > On Feb 21, 2010, at 1:28 PM, Yannick wrote:
> >
> > > Hello mate,
> > > I'm using the latest version of Web2py and Mac OS and since few web2py
> > > release I have been having this problem and I don't know what is the
> > > cause of this...
> > > When it happens I can't access my application anymore I got a this
> > > message from the browser: "Internal error
> > > Ticket issued: unrecoverable "
> > > So basicallly I just have to reboot the server to get my appl working
> > > again...
> >
> > > Here is the exceptions I got from Web2py:
> >
> > > ###
> > > Exception in thread Thread-106:
> > > Traceback (most recent call last):
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/threading.py", line 486, in __bootstrap_inner
> > >self.run()
> > >  File "/Users/OnemeWs/App Server/web2py/gluon/contrib/cron.py", line
> > > 229, in run
> > >shell=self.shell)
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/subprocess.py", line 587, in __init__
> > >errread, errwrite) = self._get_handles(stdin, stdout, stderr)
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/subprocess.py", line 953, in _get_handles
> > >errread, errwrite = os.pipe()
> > > OSError: [Errno 24] Too many open files
> > > 
> > > Exception in thread Thread-107:
> > > Traceback (most recent call last):
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/threading.py", line 486, in __bootstrap_inner
> > >self.run()
> > >  File "/Users/OnemeWs/App Server/web2py/gluon/contrib/cron.py", line
> > > 229, in run
> > >shell=self.shell)
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/subprocess.py", line 587, in __init__
> > >errread, errwrite) = self._get_handles(stdin, stdout, stderr)
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/subprocess.py", line 933, in _get_handles
> > >p2cread, p2cwrite = os.pipe()
> > > OSError: [Errno 24] Too many open files
> > > #
> > > Exception in thread Thread-1:
> > > Traceback (most recent call last):
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/threading.py", line 486, in __bootstrap_inner
> > >self.run()
> > >  File "/Users/OnemeWs/App Server/web2py/gluon/contrib/cron.py", line
> > > 55, in run
> > >s.run()
> > >  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> > > python2.5/sched.py", line 114, in run
> > >  File "/Users/OnemeWs/App Server/web2py/gluon/contrib/cron.py", line
> > > 47, in launch
> > >crondance(self.path, 'hard', startup = self.startup)
> > >  File "/Users/OnemeWs/App Server/web2py/gluon/contrib/cron.py", line
> > > 261, in crondance
> > >f = open(crontab, 'rt')
> > > IOError: [Errno 24] Too many open files:
> > > ##
> >
> > > Please any idea ?
>
>

-- 
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] Ajax call issues.

2015-03-01 Thread John Costantino
Hey so I have a mail script written in python which works fine when I run 
it from a linux terminal. My issue is I need to make an ajax call passing 
in parameters from a custom form I created. In the Javascript it calls the 
script but the mail never sends. I am stumped I have been trying to get the 
ajax to work for days now with no luck. I am currently running the web2py 
application on localhost:8000. Below I will post the code in question.

*HTML Code*
   Contact Us
   
   
   
   
   
   
   
   
   

*JS Code (This is fired via a call to onclick of the (#send-contact) button 
above)*
   function sendContactEmail()
{
var name = $('#name').val();
var email = $('#email').val();
var message = $('#message').val();
//Variables are not currently used but will be passed once the cgi works 
properly...

$.ajax({
type: "POST",
url: "../static/python/the_mailer.py"
});
}

*Python Code (This works if using the linux terminal (Comman: python 
the_mailer.py) but not via ajax)*
import smtplib, socket, sys, getpass

def main():
print

try:
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo()
print 'Connection to Gmail Succesfully'
print 'Connected to Gmail \n' 
try:
gmail_user = "myem...@gmail.com"
gmail_pwd = "my pasword"
smtpserver.login(gmail_user,gmail_pwd)
except smtplib.SMTPException:
print 'Authentication failed \n'
smtpserver.close()
getpass.getpass('Press ENTER to continue...')
sys.exit(1)

except (socket.gaierror, socket.error, socket.herror, 
smtplib.SMTPException), e:
print 
print 'Connection to Gmail failed'
print e
getpass.getpass('Press ENTER to continue...')
sys.exit(1)
while True:
to = "myem...@gmail.com"
if to != '': break
else: print 'this field is required'

sub = "Testing The Email Feature"
bodymsg = "This is an automated test from Application"
print 
header = 'To:'+to+'\n'+'From:'+gmail_user+'\n'+'Subject:'+sub+'\n'
print header
msg = header+'\n'+bodymsg+'\n\n' 

try:
smtpserver.sendmail(gmail_user,to,msg)
except smtplib.SMTPException:
print 'Email could not be sent \n'
smtpserver.close()
getpass.getpass('Press ENTER to continue...')
sys.exit(1)

print 'Email Sent Sucessfully! \n'
smtpserver.close()
sys.exit(1)

print '\n'
# raw_input('pause program')

main()


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