[web2py] Jessica McKellar talking about windows and the future of Python

2013-09-12 Thread Bruno Rocha
Hi,

I found this talk interesting
http://www.youtube.com/watch?v=d1a4Jbjc-vU&feature=share

Jessica McKeller talks about how "windows OS" is important to the future of
Python, and how it is complicated to use Python on windows nowadays.

And I think that *web2py is the only framework that does a good job working
on windows*, any other framework has too many problems to run on windows.

So web2py is helping to build the future of Python!


-- 

*Bruno Rocha - @rochacbruno*
http://github.com/rochacbruno
http://rochacbruno.com.br
http://pythonhub.com

-- 
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/groups/opt_out.


[web2py] Re: [web2py-dev] Re: Spammers on web2pyslices.com

2013-06-15 Thread Bruno Rocha
Implemented only for user registration, but spammers are registering, so I
guess they have captcha breaking system or there is a hole in the website
security?
 (needs investigation)

The captcha, honeypot, confirm by email or something would be really nice
if implemented in "create a slice" form.

I hope to get some help on this.

Thanks.


On Sat, Jun 15, 2013 at 5:11 AM, Paolo valleri wrote:

> Personally I don't like captcha image, before delving into the
> implementation of whatever like that it is worth to try the honeypot
> mechanism namely a 'hidden field'. A field that if filled out allow you to
> distinguish between user and robots requests. The field it is hidden by css
> properties real users aren't able to fill it.
> More here: http://en.wikipedia.org/wiki/Honeypot_%28computing%29
> Actually, I have never tested if that really works!
> we could think about implementing it as an option for web2py, it would be
> very welcome.
> Finally, it seems that web2pyslices.com registration has got a captcha,
> have you already implemented it?
>
> Paolo
>
>
> On Saturday, June 15, 2013 6:40:50 AM UTC+2, rochacbruno wrote:
>>
>> Hi,
>>
>> recently we are having too many spams posted on web2pyslices.com
>>
>> I am deleting one by one, but started to be difficult to track this.
>>
>> We need to implement a captcha system or any other kind of spam blocking.
>>
>> is there any volunter? to do this for user registration form and also for
>> article post form?
>>
>> I am in a rush between work and medical treatments, I tried but I really
>> have no time now to develop this.
>>
>> If anybody can take this, please email me ans I give you access to the
>> development version of the code on pythonanywhere.
>>
>> Thanks.
>>
>> []'s
>>
>> ---
>>
>> Bruno Rocha
>> http://github.com/rochacbruno
>> http://rochacbruno.com.br
>> http://terraqueos.org
>>
>  --
> -- mail from:GoogleGroups "web2py-developers" mailing list
> make speech: web2py-develop...@googlegroups.com
> unsubscribe: web2py-developers+unsubscr...@googlegroups.com
> details : http://groups.google.com/group/web2py-developers
> the project: http://code.google.com/p/web2py/
> official : http://www.web2py.com/
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py-developers+unsubscr...@googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




[web2py] Spammers on web2pyslices.com

2013-06-14 Thread Bruno Rocha
Hi,

recently we are having too many spams posted on web2pyslices.com

I am deleting one by one, but started to be difficult to track this.

We need to implement a captcha system or any other kind of spam blocking.

is there any volunter? to do this for user registration form and also for
article post form?

I am in a rush between work and medical treatments, I tried but I really
have no time now to develop this.

If anybody can take this, please email me ans I give you access to the
development version of the code on pythonanywhere.

Thanks.

[]'s

---

Bruno Rocha
http://github.com/rochacbruno
http://rochacbruno.com.br
http://terraqueos.org

-- 

--- 
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/groups/opt_out.




Re: [web2py] how to start Celery worker in web2py

2013-03-06 Thread Bruno Rocha
I also would like to see Celery, Solr, Elastic Search and other fantastic
tools working with web2py!

I think this is an important issue and I am sure it is completely easy and
possible to make it.

I personally do not like to use the built-in scheduler, so I am using
python-rq (Redis Queue) for some production sites and it works very well
and offer almost all celery functionalities.

Maybe someone can follow my python-rq[1] example and create a wen2py-celery
tutorial

[1]http://rochacbruno.com.br/web2py-and-redis-queue/

I dont think web2py needs to always reinvent the wheel so I would like to
see more integrations.

wish list:

Whoosh (WIP)
Solr (maybe a haystack clone for web2py)
ElasticSearch
Celery
Thumbor
Neo4J


On Wed, Mar 6, 2013 at 10:47 PM, Eric S  wrote:

>
> I would like to use Celery in my web2py application, but I'm having
> trouble with how to start a Celery worker (I know there is a web2py
> scheduler but I would like to use Celery).
>
> To start a custom scheduler in web2py I would use:
> python web2py.py -S appName -M -R worker.py
>
> Celery workers, however, are launched from the command line such as with
> the following command, which won't easily substitute into 'worker.py' above:
> celery -A tasks worker --loglevel=info
>
> Has anyone had success integrating web2py and Celery? How do you
> (robustly) get around this problem?
>
> Thanks,
> Eric
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: Web2py without fancy wizzard

2013-02-27 Thread Bruno Rocha
Hello world from scratch

download web2py and unzip it.

create a new app folder  web2py/applications/*hello*

create a model file web2py/applications/hello/*models/model.py
*
# coding: utf-8

from gluon.tools import Auth

db = DAL("sqlite://hello.db")
auth = Auth(db)
auth.define_tables()

db.define_table("hello", Field("world"))

create a controller file in web2py/applications/hello/*
controllers/whatever.py*

#coding: utf-8

def action():
form = SQLFORM(db.hello).process()
return dict(form=form)

create a view file in web2py/applications/hello/*views/whatever/action.html*




  {{=form}}



Now start web2py

python web2py.py

and access your app

http://localhost:8000/hello/whatever/action

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: custom function decorators

2013-02-27 Thread Bruno Rocha
Your decorator is wrong

this

def check_mod_set_active(callee):
if session.active_mod == None:
session.flash = 'No active module selected.'
redirect(URL('mod', 'index'))
else:
return callee

shoud be

def check_mod_set_active(callee):
def wrapper():
if session.active_mod == None:
session.flash = 'No active module selected.'
redirect(URL('mod', 'index'))
else:
return callee()
return wrapper

-- 

--- 
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/groups/opt_out.




Re: [web2py] Performance issues while opening webpage with more than 1 lakh records.....

2013-02-21 Thread Bruno Rocha
what is your database engine?

we need to see if the bottleneck is in database side.

Place a {{=response.toolbar()}} in your view and paste here the generated
SQL and timings.

Are you using pagination? how many per page? even with 100.000 records, the
grid should use an offset to limit the loaded data.



On Fri, Feb 22, 2013 at 2:56 AM, newbie  wrote:

> Hi ,
> i am a newbie in Web2pyI have more than 1 lakh records in database
> table1  and i am displaying that table through an SQLFORM.grid.The problem
> is the corresponding WebPage for this table1 is taking more than 15 seconds
> to open.Is there a way we can solve this performance issue??.Kindly
> help..
>
> Default.py
>
> def WebPage():
> grid=SQLFORM.grid(db.table1)
> return locals()
>
> WebPage.html
>
> {{=grid}}
>
> and table1 has more than 1 lakh records.
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: command line question

2013-02-21 Thread Bruno Rocha
after you untar it do a:

chown -R user:group web2py/applications

-- 

--- 
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/groups/opt_out.




Re: [web2py] Removing HTML TAGS

2013-02-18 Thread Bruno Rocha
http://stackoverflow.com/questions/9662346/python-code-to-remove-html-tags-from-a-string

-- 

--- 
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/groups/opt_out.




Re: [web2py] User Management Backoffice

2013-02-18 Thread Bruno Rocha
You can customize the web2admin


https://github.com/rif/web2admin

-- 

--- 
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/groups/opt_out.




Re: [web2py] field of password type is displayed as cleartext in smartgrid form

2013-02-15 Thread Bruno Rocha
You should apply the CRYPT() validator when storing the password

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Bruno Rocha
Cool! but it does not allow the transformation.

class CUSTOM(object):"""you can use a function or a lambda
to validate or/and transform the field in the way you wantit is
the same as "onvalidation" and "onsuccess" form callbacksbut it
can be used per field in models or controller levelUsage:#
the validate function should return the error_message or Nonedef
begins_with_a(value):if not value.startswith('a'):
return "Should start with a"else:return None
   # the transform function should return a value def
to_upper(value): return value.upper()
db.define_table("foo", Field("bar"))db.foo.bar.requires =
CUSTOM(begins_with_a, to_upper)>>> CUSTOM(begins_with_a,
to_upper)('apple')('APPLE', None)>>> CUSTOM(begins_with_a,
to_upper)('orange')('ORANGE', 'Should start with a')"""def
__init__(self, validate=lambda value: None, transform=lambda value:
value):self.validate = validateself.transform =
transformdef __call__(self, value):
return(self.transform(value), self.validate(value))

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-15 Thread Bruno Rocha
Great idea Anthony, CUSTOM can be used in many ways when a builtin
validator does not match the requirements.

I documented this here:
http://rochacbruno.com.br/more-web2py-custom-validators/


@Massimo

Can we include at least the CUSTOM in gluon.validators ?

-- 

--- 
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/groups/opt_out.




Re: [web2py] Date null display

2013-02-14 Thread Bruno Rocha
A(value.strftime("%d/%m/%Y"))
Em 15/02/2013 05:01, "Simon Ashley"  escreveu:

> Traditionally in other field types you could display a null value with an
> expression similar to the following:
>
> db.table.datefield.represent = lambda value, row: A(value) if value else
> 'unknown'
>
> Occasional we have a requirement to display null values as alternatively
> i.e. None, Unknown, Not recorded, Not applicable etc 
> While it can be done with the above, as it stands, A(value) reverts any
> display formatting back to the default i.e. '%Y-%m-%d' rather than any
> other format that's been set as the default.
>
> Are there any alternatives to this to retain default formatting i.e.
> '%d/%m/%y'?
>
>
>
>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-14 Thread Bruno Rocha
It gives me the idea of a CUSTOM validator


class CUSTOM(object):
def __init__(self, function):
self.function = function

def __call__(self, value):
# the function should return the error_message or None
return(value, self.function(value))


So the use should be:

def my_validator_function(value):
 # do anything
 return "error message" or None

db.table.field.requires = CUSTOM(my_validator_function)

So, it works the same as onvalidation but can be applied in models.

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-14 Thread Bruno Rocha
Finally, I just testes on the shell


*modules/anyvalidator.py*

class ANY(object):
def __init__(self, validators):
self.validators = validators

def __call__(self, value):
# validates the value against each validator
results = [validator(value)[1] for validator in self.validators]
# check if all validations are invalid
if all(results):
# invalid, so return the first error message
return (value, [result for result in results if result][0])
else:
# all valid
return (value, None)


*models/db.py*

db.table.field.requires = ANY([IS_IN_SET(['a','b']), IS_EMAIL()])

*shell*

In [3]: from anyvalidator import ANY

In [4]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('m...@test.com')
Out[4]: ('m...@test.com', None)

In [5]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('me')
Out[5]: ('me', 'value not allowed')

In [6]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('a')
Out[6]: ('a', None)

In [7]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('b')
Out[7]: ('b', None)

In [8]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('foo')
Out[8]: ('foo', 'value not allowed')

In [9]: ANY([IS_IN_SET(['a','b']), IS_EMAIL()])('f...@bar.com')
Out[9]: ('f...@bar.com', None)

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-14 Thread Bruno Rocha
I guess the first one is wrong.. to amtch your criteria I think you need
this


class ANY(object):
def __init__(self, validators):
self.validators = validators

def __call__(self, value):
# validates the value against each validator
results = [validator(value)[1] for validator in self.validators]
# check if there is
if not all(results):
# invalid, so return the first error message
return (value, [result for result in results if result])
else:
# all valid
return (value, None)

db.table.somefield.requires = ANY([IS_EMAIL(), IS_MATCH(), IS_NOT_EMPTY()])

-- 

--- 
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/groups/opt_out.




Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?

2013-02-14 Thread Bruno Rocha
class ANY(object):
def __init__(self, validators):
self.validators = validators

def __call__(self, value):
# validates the value against each validator
results = [validator(value) for validator in self.validators]
# Check if there is an invalid result
for result in results:
if result[1]:
# if invalid value found returns it.
return result
#else returns the value and None, which means "valid"
return (value, None)


db.table.somefield.requires = ANY([IS_EMAIL(), IS_MATCH(), IS_NOT_EMPTY()])

it is a great idea to include ANY and ALL metavalidators to
gluon.validators.


On Thu, Feb 14, 2013 at 11:55 PM, Alec Taylor wrote:

> I am writing in a signup form for users of my site.
>
> To signup, they can either use their email address `IS_EMAIL()`; or an
> outside uid (covered by an `IS_MATCH()`).
>
> (it's a 1 field form)
>
> One solution to validating the form is to just check the vars in the
> controller, and have two Fields in the Table; one for email, the other
> for this outside uid.
>
> Is there another solution; utilising multiple validators in the
> requires, much like `IS_NONE_OR()` validator?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: Converting Field of a SQLFORM.grid to local timezone of a user.....

2013-02-11 Thread Bruno Rocha
I am on mobile now and I cant ellaborate a good code example, but I can
give you a hint.

db.table.datefield.represent = lambda value, row :
value.strftime("%Y/%m/%d")

grid = SQLFORM.grid(db.table)

so grid will use the represent callback to display the data.

following this example you can do

def set_timezone(value, row):
 return value. #do the calculation

db.table.field.represent = set_timezone
Em 12/02/2013 04:44, "newbie"  escreveu:

>
> On Tuesday, 12 February 2013 11:06:00 UTC+5:30, newbie wrote:
>>
>> Hi,
>> I have a table x, with fields name,place,timezone_offset.And another
>> table y ,having  field 'servertime',which **stores the current time of
>> the server its fetching the values from.
>>
>>  db.define_table('x',Field('**name'),Field('place'),Field('**
>> timezone_offset'))
>> db.define_table('y',Field('**name'),Field('ser**vertime'))
>>
>
> User will set the timezone offset in table x, for a particular name. There
> is one thread continuously running in background in the server which will
> save the servertime as local time using datetime.datetime.now() in table y
> for the name.
>
> And finally this data displayed by using SQLFORM.grid on the UI.
>
> Problem facing:
> We have to convert the local time saved for the name field as per saved
> timezone_offset in x table and display on the grid without modifying
> anything on database level.
> It means suppose for name ='Alex'  timezone_offset was being saved as -5
> in x table and suppose server running on different timezone lets say on
> +5.30 so for name Alex server will save the servertime in +5.30 format as
> it is the local time for the server but when it will be displayed on the
> grid servertime should first get converted to Alex timezone_offset which is
> set as -5 and then display on the grid.
>
> Can anyone please suggest me how can I achieved in web2py? Is there any
> way to achieve it using SQLFORM.grid()?
>
> Thanks.
>
>
>
>
>>
>>
>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: How to have a single user application

2013-02-10 Thread Bruno Rocha
models/db.py

db = DAL(.)
from gluon.tools import Auth
auth = Auth(db).define_tables()

# if forst time running create the new user
if db(db.auth_user).isempty():
password = CRYPT()("12345")[0]
db.auth_user.valdiate_and_insert(first_name="default",
last_name="default",
email="s...@email.com",
password=password)

# automatically login the user
user = auth.login_bare("s...@email.com", "12345")

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?

2013-02-09 Thread Bruno Rocha
If your contrib needs to have its own models and controllers, then you
should create it as a plugin. Or you can create a module and define an API
for it, take a dummy example.


/modules/myawesomemodule.py

class MyAwesomeClass(object):
"""
it creates the Awesome object which is a login_method
to use include in your models
db = DAL()
from myawesomemodule import MyAwesomeClass
something = MyAwesomeClass(db)
something.define_tables()
auth.settings.login_methods = something
"""

def __init__(db, *args, **kwargs):
self.db = db

def define_tables(self, migrate=True):
self.table1 = self.db.define_table("table1",
Field("a_field"),
migrate=migrate
)

self.table2 = self.db.define_table("table2",
Field("a_field"),
migrate=migrate
)

def do_something(self):
self.data = self.db(.).select()
# do domething
return data

Then in following your documentation developers should use you module api
as:

models/db.py

db = DAL(.)

from myawesomemodule import MyAwesomeClass

something = MyAwesomeClass(db)
something.define_tables()

auth.settings.login_methods = something


On Sat, Feb 9, 2013 at 5:34 AM, Alec Taylor  wrote:

> But I am creating a contrib for:
> https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods
>
> (OAuth2; my work-in-progress is on Github)
>
> But because of the design of the standard I require 3 additional
> tables + a user table.
>
> So how do you propose I manage this scenario?
>
> On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha  wrote:
> > Usually you create a "script" file in /models/db.py then you define your
> > tables there, so when starting in shell mode you pass -M
> >
> > python web2py.py -S yourapp -M
> >
> > -M run the models/* files and defines your table as "object" for you to
> > access.
> >
> > Every framework works in this way.
> >
> > Optionally, you can use db.executesql("PUT YOUR SQL HERE") and do it by
> your
> > own...
> >
> >
> > On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor 
> wrote:
> >>
> >> Hold up; you mean to tell me I need to redefine the schema each time a
> new
> >> db (DAL object) needs to access it?
> >>
> >> That sounds silly.
> >>
> >> Isn't there a way around this?
> >>
> >>
> >> On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote:
> >>>
> >>> let say you have table1 and table2 in database,
> >>>
> >>> you shoud define your tables
> >>>
> >>> db.define_table('table1',
> >>> ..)
> >>>
> >>> and only after that you will have access to db.table1
> >>>
> >>> you can;t access db.table2 if it is not defined even if it exists in
> the
> >>> database
> >>
> >> --
> >>
> >> ---
> >> 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/groups/opt_out.
> >>
> >>
> >
> >
> > --
> >
> > ---
> > 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/groups/opt_out.
> >
> >
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?

2013-02-08 Thread Bruno Rocha
Usually you create a "script" file in /models/db.py then you define your
tables there, so when starting in shell mode you pass -M

python web2py.py -S yourapp -M

-M run the models/* files and defines your table as "object" for you to
access.

Every framework works in this way.

Optionally, you can use db.executesql("PUT YOUR SQL HERE") and do it by
your own...

On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor  wrote:

> Hold up; you mean to tell me I need to redefine the schema each time a new
> db (DAL object) needs to access it?
>
> That sounds silly.
>
> Isn't there a way around this?
>
>
> On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote:
>>
>> let say you have table1 and table2 in database,
>>
>> you shoud define your tables
>>
>> db.define_table('table1',
>> ..)
>>
>> and only after that you will have access to db.table1
>>
>> you can;t access db.table2 if it is not defined even if it exists in the
>> database
>>
>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Star Rating

2013-02-08 Thread Bruno Rocha
https://github.com/mdipierro/web2py-recipes-source/blob/master/apps/04_advanced_forms/web2py.app.star_rating.w2p?raw=true

On Fri, Feb 8, 2013 at 8:52 PM, Michael Gheith  wrote:

> Hello web2py community :)
>
> I'm trying to implement a simple star rating for my site.  I followed the
> steps in the web2py Application Development Cookbook, but it is not working
> unfortunately; I select 2 stars for example, but it's not being saved to
> the database.
>
> I have taken a look at the star rating widget in plugin_wiki, and could
> not get that to work either!
>
> Can any of you provide me with a .w2p of something that works?
>
>
> Hope to hear from any of you soon, thanks in advance!
> Michael Joseph Gheith
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] web2py admin2 is DEAD?

2013-02-08 Thread Bruno Rocha
It needs more tests and contributions...

OPen an issue on github and I am sure we can solve this..

On Fri, Feb 8, 2013 at 5:38 PM, Derek  wrote:

> It shouldn't be the default because it doesn't work for everyone (at
> least, it doesn't work for me)
>
>  ('42000', "[42000] [Microsoft][ODBC SQL
> Server Driver][SQL Server]Introducing FOREIGN KEY constraint
> 'plugin_web2admin_history_modified_by__constraint' on table
> 'plugin_web2admin_history' may cause cycles or multiple cascade paths.
> Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN
> KEY constraints. (1785) (SQLExecDirectW); [42000] [Microsoft][ODBC SQL
> Server Driver][SQL Server]Could not create constraint. See previous errors.
> (1750)")
>
>
> On Friday, February 8, 2013 12:05:50 PM UTC-7, rochacbruno wrote:
>>
>> I already suggested in a ticket => https://code.google.com/p/**
>> web2py/issues/detail?id=1103
>>
>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] web2py admin2 is DEAD?

2013-02-08 Thread Bruno Rocha
I already suggested in a ticket =>
https://code.google.com/p/web2py/issues/detail?id=1103

-- 

--- 
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/groups/opt_out.




Re: [web2py] web2py admin2 is DEAD?

2013-02-08 Thread Bruno Rocha
Use this one => https://github.com/rif/web2admin

-- 

--- 
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/groups/opt_out.




Re: [web2py] mosql

2013-02-05 Thread Bruno Rocha
Looks awesome..

I already used the Mongo Data Wrapper (
https://github.com/citusdata/mongo_fdw) to replicate my Postgres data to
Mongo, I will take a closer look on this.


Thanks for sharing.

-- 

--- 
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/groups/opt_out.




[web2py] Real Python for Web Development, featuring web2py

2013-02-05 Thread Bruno Rocha
Take a look:
http://www.kickstarter.com/projects/1369857650/real-python-for-web-development-featuring-web2py

Why Web2py?

web2py is an open-source web framework for rapid development. You can get
up in running in less than 10 minutes and build a full-featured application
in under an hour. Much like the Python language itself, web2py is designed
for beginners to quickly get up to speed as well as advanced users.

-- 

--- 
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/groups/opt_out.




Re: [web2py] requires _ verification = True , no Flash?

2013-02-04 Thread Bruno Rocha
def flash(user): response.flash = "Please check your inbox"

auth.settings.register_onaccept = flash

On Mon, Feb 4, 2013 at 12:12 PM, António Ramos  wrote:

> How can i have a flash message telling the user to check and validate the
> link sent to the user email?
>  without a flash message the users registering for the first time does not
> know that an email was sent to his mailbox.
>
>
> Thank you
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: Pattern to run async proccess

2013-02-02 Thread Bruno Rocha
You can also use Redis Queue
http://rochacbruno.com.br/web2py-and-redis-queue/

-- 

--- 
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/groups/opt_out.




Re: [web2py] web2py IDEs; maintain a wiki with plugins?

2013-02-01 Thread Bruno Rocha
WingIDE is the only one that I used and worked out of the box without the
need of hacks or plugins.

On Fri, Feb 1, 2013 at 2:37 PM, Alec Taylor  wrote:

> Can we bring up a community wiki page for this?
>
> For editing web2py apps, I have personally used: Eclipse, Geany,
> Sublime Text 2, nano and the online editor.
>
> Currently my editor of choice is Sublime Text 2.
>
> In the quoted message below this repo was mentioned;
> https://github.com/cassiobotaro/my_sublime
>
> However when attempting to install I get this:
>
> D:\Projects\my_sublime>python setup.py
> Traceback (most recent call last):
>   File "setup.py", line 6, in 
> USER = os.getlogin()
> AttributeError: 'module' object has no attribute 'getlogin'
>
> How do I fix this?
>
> Also, what's a good 'lightweight' IDE for use with web2py; which supports:
> - Code completion
> - Syntax highlighting (preferably for web2py functions+libraries+objects
> also)
> - Goto definition (where this function was defined or object was initiated)
> - Open folder as project (preferably from command-line; currently do
> this with >sublime_text 
> - Linux and Windows
>
> Thanks for all suggestions,
>
> Alec Taylor
>
> On Sat, Feb 2, 2013 at 3:13 AM, select  wrote:
> > On Thursday, January 31, 2013 1:26:45 PM UTC+1, Johann Spies wrote:
> >> On 31 January 2013 13:03, Jason Brower  wrote:
> >>>
> >>> Interesting that we have coding tools built into our framework.
> >>> http://www.webdesignerdepot.com/2013/01/web-ides-the-future-of-coding/
> >>>
> >>
> >> When webeditors become as good as emacs, vim, bluefish, I will consider
> >> it.  For now I did not find any editor that can compete with them.
> >
> > http://ace.ajax.org/build/kitchen-sink.html (c9 editor)
> > is already quite impressive IMHO, with the vim commands enabled it feels
> > quite natural to work with,
> > then again i have ST2 which makes me super happy
> > Here are the plugins I use, in case you use ST2 for web2py too
> > AdvancedNewFile
> > AutoPep8
> > BracketHighliter (with some color customization)
> > CssComb
> > DocBlockr
> > Emmet (Zen Coding)
> > LiveReload
> > SublimeCodeIndel
> > SublimeLinter
> > (
> https://github.com/cassiobotaro/my_sublime/blob/master/SublimeLinter.sublime-settings
> > for web2py)
> > SideBar
> >>
> >>
> >> Regards.
> >> Johann
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.




Re: [web2py] DAL and MySQL indexing

2013-01-31 Thread Bruno Rocha
Since you have the indexes created on DB backend, The DAL will use this for
any query on that table, because the output of .select() is in fact a pure
SQL statement.

-- 

--- 
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/groups/opt_out.




Re: [web2py] sending mail to multiple clients

2013-01-30 Thread Bruno Rocha
I would use sendgrid.com and its awesome newsletter API, alsoi sendgrid
takes care of spamming protection.

I wrote an module to interact with send grid through the API
https://github.com/rochacbruno/pysendgrid

But if you really want to use your own structure you should have a table
with "email", "recipient", "status"

Select 500 of your users which message has not been sent yet, send the
messages, time.sleep(1 hour) and do it again.
for every email sent you go to status table and check the "status" to "sent"

-- 

--- 
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/groups/opt_out.




Re: [web2py] Interesting about JSON license...

2013-01-29 Thread Bruno Rocha
“The Software shall be used for Good, not Evil.”

I like it! we should adopt it in web2py. The problem is to difference what
is "good" from what is "Evil" so I think this license has no meaning.

-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: Open generated file from action function

2013-01-29 Thread Bruno Rocha
I think the problem may be the session preventing the duplicate submission
of the same form data.

-- 

--- 
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/groups/opt_out.




Re: [web2py] embed image from variable

2013-01-29 Thread Bruno Rocha
I guess you can try


> {{=IMG(_src=plotimg)}}


or



-- 

--- 
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/groups/opt_out.




Re: [web2py] Re: web2py world conference 2013

2013-01-28 Thread Bruno Rocha
I think it is ok to have different dates on each places.

Each country/place can do in preferred data since it is in the same week.

Lets say:

 - May 16 (Thu)
 - May 17 (Fri)
Chicago - May 18 (Sat)
Brasil - May 19 (Sun)

Of course we can have more than one place at the same day, no problem but
we can schedule the days from 16 to 19 May.

My proposal on how it can work:

Each organizer needs a physical room, local advertisement,  Internet
connection, recording equipment.

*Vanue and registration*
The event has to "exist" in a Physical place, people needs to register and
submit proposals on the conference website.

*Funding*
The organizers can sell "sponsorship" or call for funding in order to pay
for event bills (as recording, coffee and lunch) - But this is
responsibility of reach organizer, but all the sponsorship will advertising
on the main website and mailing or other promotion material.

*Proposals*
The proposals will be voted online, people from any place can vote and this
will be used to choose which presentations will be recorded to be included
on the website track.

*The event*
Its a normal local meetup, people goes there, have coffee break and
networking, attend to presentations etc... The only difference is that all
the presentation and activities needs to be recorded in a good audio/video
quality. (optionally transmitted via hangout on air if the place has good
Internet connection)

*The videos:*
Video need to be in a good quality, uploaded to YouTube conference account.
If not presented in English, the video will need to be subtitled to English
using the YouTube (Amara) tools, for this we count on local volunteers.

*The Conference*
Ok, in this case "the conference" will be just a set of videos, organized
in tracks and for each track/video we can have a "forum" like place for
people to interact about that content. So anybody can watch the videos from
other places.


Thats it! 3 or 4 days of local meetups, recorded and putted together on a
"conference" website for everyone to see and interact, also optionally each
meetup can have their local event transmitted alive.


I cannot think on another format.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: How do I import `gluon.dal` from Python shell?

2013-01-28 Thread Bruno Rocha
Is there the option to put the "gluon" folder on your site-packages or
"dist-packages" folder

Or maybe, start web2py in shell mode?

-- 





Re: [web2py] Re: writing build scripts for web2py

2013-01-26 Thread Bruno Rocha
Go to admin interface and click in "Pack All: it generates a .w2p package.

Or just go to your shell and $tar -cvf myapp.tar.gz /path/to/my/app

If you want some more specific package system maybe it is better to put
your app in github and use Fabric, Puppet, Cheff, BUildout or other tools
like this to create a installation recipe.

-- 





Re: [web2py] Many to Many relation

2013-01-26 Thread Bruno Rocha
the grid has onvalidation argument.


SQLFORM.grid(..., onvalidation=check_unique)

-- 





Re: [web2py] Many to Many relation

2013-01-26 Thread Bruno Rocha
I can think on two options.

*1. Unique Key*

db.define_table("table",
Field("table_a", "reference table_a"),
Field("table_b", "reference table_b"),
Field("unikey", unique=True, notnull=True, compute=lambda row:
"%(table_a)s-%(table_b)s" % row)
)


*2. Form validator*

def check_unique(form):
if db((db.table.table_a == form.vars.table_a) & (db.table.table_b ==
form.vars.table_b)).count():
form.errors.table_a = "You cannot insert or edit a duplicate
combination"

form = SQLFORM(db.table).process(onvalidation=check_unique)

Mybe it can be implemented as a Field Validator, have to try.

-- 





Re: [web2py] Re: looking for volunteers to help proof-read book 5th ed.

2013-01-26 Thread Bruno Rocha
I think both are bad! specially by the fact that the largest web2py
audience is not native English speaker, this kind of sentence should be
more explicit.

"web2py takes care of main security issues, so developers have little..."

-- 





Re: [web2py] Required Field Error.

2013-01-26 Thread Bruno Rocha
is it SQLite? did you changed required from True to False?

SQLite does not have ALTER for column type and constraints.
Em 26/01/2013 10:04, "__pyslan__ - Ayslan Jenken" 
escreveu:

> My models:
>
> LogrType = db.define_table('logr_type',
> Field('name', notnull=False, label=T("Name")),
> format='%(name)s'
> )
>
> Venture = db.define_table('venture',
> Field('venture_type', 'reference venture_type', notnull=True,
> label=T("Type")),
> Field('venture_situation', 'reference venture_situation',
> notnull=True, default=1, label=T("Situation")),
> Field('name', notnull=True, label=T("Name")),
> Field('logr_type', 'reference logr_type', notnull=False, label=T('Logr
> Type')),
> Field('logr', notnull=False, label=T('Logradouro')),
> Field('logr_number', notnull=False, label=T('Number')),
> Field('logr_compl', notnull=False, label=T('Complement')),
> Field('logr_neigh', notnull=False, label=T('Neighborhood')),
> Field('logr_city', notnull=False, label=T('City')),
> Field('logr_state', notnull=False, label=T('State')),
> Field('logr_zip_code', notnull=False, label=T('Zip Code'), default=""),
> format='%(name)s'
> )
>
>
> When I add, or edit a venture, the logr_type is required...and should not
> be..
>
>
> Thanks...
>
> __pyslan__
>
>  --
>
>
>
>

-- 





Re: [web2py] update easy_install

2013-01-24 Thread Bruno Rocha
On Thu, Jan 24, 2013 at 9:34 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> How?
>


http://peak.telecommunity.com/DevCenter/setuptools#automatic-script-creation

-- 





Re: [web2py] update easy_install

2013-01-24 Thread Bruno Rocha
The web2py on PyPi should be a meta-package, in setup.py it should download
the latest version from website and include on users site-package.

-- 





Re: [web2py] Re: automatic email when registration_requires_approval =True

2013-01-24 Thread Bruno Rocha
auth.settings.verify_email_onaccept = lambda USER:
mail.send(to='antonio.ra...@cires.pt',subject='Conta pendente de
Aprovação. Portal Empreiteiros',message=repr(USER))

-- 





Re: [web2py] Re: automatic email when registration_requires_approval =True

2013-01-24 Thread Bruno Rocha
auth.settings.verify_email_onaccept = lambda user:
mail.send(to='antonio.ra...@cires.pt',subject='Conta pendente de
Aprovação. Portal Empreiteiros',message=repr(user))

-- 





Re: [web2py] get new user's email and data

2013-01-24 Thread Bruno Rocha
auth.setting.register_onaccept = lambda form: mail.send(to=['x...@xxx.net'],
  subject='web2py registration',
  # If reply_to is omitted, then mail.settings.sender is used
  reply_to='u...@example.com',
  message= u'A new user has been created on database %s and has to
be confirmed - User name: %s, email: %s' % (database, form.vars.first_name
+ " _" + form.vars.last_name, form.vars.email))

-- 





Re: [web2py] get new user's email and data

2013-01-24 Thread Bruno Rocha
def myfunc(form):
# here you get form.vars

auth.settings.register_onaccept = myfunc
Em 24/01/2013 06:24, "Yebach"  escreveu:

> Hello
>
> After a new user registers, I would like to send his data to my email
> (user email and database where it was created)
> I have user requires confirmation set to true and I have a couple of
> databases so that is a must, also to check on user I need to get his e-mail
> to inform him his registration was confirmed
>
> thank you
>
> best regards
>
> --
>
>
>
>

-- 





Re: [web2py] How to put both login and register forms on one page...

2013-01-23 Thread Bruno Rocha
return dict(register=auth.register() , login=auth.login())

{{=register}}

{{=login}}
Em 23/01/2013 20:39, "sasogeek"  escreveu:

> how do I put the login and register forms on one page... so that a user is
> logged in if they click the login button (if they've entered correct email
> and password) and are signed up if they click the register button with form
> data for a new account?
>
> --
>
>
>
>

-- 





Re: [web2py] Help Query speed

2013-01-22 Thread Bruno Rocha
maybe the virtual fields?

-- 





Re: [web2py] Re: Help on Unit Tests

2013-01-22 Thread Bruno Rocha
Issues page on google code: https://code.google.com/p/web2py (issues menu)

Develpers list: web2py-developers on google group

-- 





Re: [web2py] Re: web2py best practices/patterns

2013-01-22 Thread Bruno Rocha
On Tue, Jan 22, 2013 at 3:09 PM, Richard Vézina  wrote:

> Does Model Less approach still relevent with the new lazy table feature??


No need to use this module based approach (unless you want), now with
lazy_tables it is better to use the standard ways to avoid extra loads.

-- 





Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
for this I thinnk you sould use extra render.


{{text = "`` here is my code ``:pre_with_code"}}
{{=MARKMIN(text, extra={"pre_with_code": lambda text:
"{0}".format(text)})}}

Tested on shell

In [4]: text = "`` here is my code ``:pre_with_code"

In [5]: print MARKMIN(text, extra={"pre_with_code": lambda text:
"{0}".format(text)})
 here is my code 

-- 





Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
``
Your code here
``

for testing: http://web2py.com/markmin

-- 





Re: [web2py] How I can use tag with Markmin?

2013-01-21 Thread Bruno Rocha
``
Hello World
``:code_html


``
print "hello world"
``:code_python

On Tue, Jan 22, 2013 at 1:50 AM, Ignacio Ocampo  wrote:

> How I can use  tag with Markmin? Thank you.
>
> --
>
>
>
>

-- 





Re: [web2py] Help on Unit Tests

2013-01-21 Thread Bruno Rocha
There is no official approach, testing is being an issue for a long time,
there was a project called web2py test runner, but the maintainer abandoned
the project.

If you can contribute with something on this subject, your contribution
will be very welcome.

The main problem of testing is the fact that web2py runs its own
environment, for some things this environment depends on "request",
"response" "session" and other state objects which exists only when the
application is running on a webserver.

I think a good test approach would be creating mocks for that objects and
so having a "fake" environment to run the tests on shell.

$ python web2py.py -S appname -M -R /path/tests.py

The above command will open web2py in a shell mode and runs the tests.py
script since the environment is ready, but on this environment we do not
have full "request", "session" and "response" objects, so we need some
mocking for this.

-- 





Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Bruno Rocha
SQLFORM expects a field named "fences_customer" the pattern is
tablename_fieldname

-- 





Re: [web2py] Form with fields collected from javascript

2013-01-21 Thread Bruno Rocha
include hidden fields



the use Javascript to populate

$('#customer').val("something")

-- 





Re: [web2py] Re: is bug? sqlform.factory

2013-01-21 Thread Bruno Rocha
I think the "max" is the first because you can ommit the second.

IS_LENGTH(10) will allow max 10. No need to inform the second.

But I agree this is odd.

-- 





Re: [web2py] is bug? sqlform.factory

2013-01-21 Thread Bruno Rocha
IS it SQLITE?

Sqlite dos not implements ALTER TABLE for column properties, if you created
the model with n length and so changed it later, sqlite does not respect
this.

It is a sqlite problem.


*if another database, so can be a dal problem

On Mon, Jan 21, 2013 at 11:43 AM, www.diazluis.com
wrote:

> when implemented the following code, I notice that the system does not
> respect
> the length of the field in the database.
>
> if the user enters a name of more than one (1) character the system stores
> ..
>
> wonder: is this a bug?
>
> to the following model:
>
> auth_user_id = (auth.user and auth.user.id) or None
>
> db.define_table('table_x',
> Field('name', 'string', length=1, requires= IS_UPPER()),
> Field('auth_user', db.auth_user, default=auth_user_id,
> writable=False, Readable=False),
> )
>
> using the controller:
>
> def index ():
> form = SQLFORM.factory(
> Field('name', 'string', length=3, requires=IS_UPPER()),
> )
>
>  if form.accepts (request.vars):
>  db(db.table_x.auth_user==auth_user_id).update(name=
> request.vars.name)
>
>  return dict (form = form)
>
> --
>
>
>
>

-- 





Re: [web2py] How to automatically send emails to users if they perform an action like sign up...

2013-01-21 Thread Bruno Rocha
in your models.

mail = auth.settings.mailer
mail.settings.server = "your_smtp_server_and:port"
mail.settings.sender = "y...@you.com"
mail.settings.login = "y...@you.com:password"

# sends an verification e-mail upon registration
auth.settings.registration_requires_verification = True


def send_email(user, subject):
message = """ Multi line string for %(first_name)s.."
message = open("somefile.html", "r").read()
# you also have the option to include everyone in bcc=[...]
mail.send(to=user.email,
   subject=subject,
   message=message % user)


Now in any place like controllers or scripts

users = db(db.auth_user).select()
for user in users:
send_email(user, "some subject")


Dont forget to keep track of sent emails, use try: except... try to not use
gmail for more than 500 recipients.




If you want an email to be send everytime a user login in your page

auth.settings.login_onaccept = lambda form: mail.send(to=form.vars.email,
subject="%(first_name)s logged in" % form.vars, message="User logged in %s"
% str(form.vars))

-- 





Re: [web2py] Re: PowerFormWizard 0.1.4 - Bug Fixes and auto_validation (+ a new plugin for grids)

2013-01-20 Thread Bruno Rocha
Ok, problem fixed

Updated here: https://bitbucket.org/rochacbruno/powerformwizard/downloads

Live example here: http://www.web2pyslices.com/formwizard

-- 





Re: [web2py] Re: PowerFormWizard 0.1.4 - Bug Fixes and auto_validation (+ a new plugin for grids)

2013-01-19 Thread Bruno Rocha
it is only on https://bitbucket.org/rochacbruno/powerformwizard/src

but not updated yet.. on my todo-list to work on this.

On Sat, Jan 19, 2013 at 10:43 PM, Bill Thayer  wrote:

> Hi Bruno,
>
> Forgive me if I missed your updates. The link below does not work today.
> Where can I find the latest information.
>
> Regards,
> Bill
>
>
>>> *# Whats next?
>>> *working on a new plugin for the 'Power' family, it is a JSON based
>>> tableless grid (which is much more than a grid)
>>> hope to release with examples, by the end of the week, preview ->
>>> http://labs.blouweb.com/**PowerGrid <http://labs.blouweb.com/PowerGrid>
>>>
>>> Need help, contribution, test..
>>> []'s
>>> --
>>> Bruno Rocha
>>> [ About me: http://zerp.ly/rochacbruno** ]
>>
>>
>>   --
>
>
>
>

-- 





Re: [web2py] unable to drop table

2013-01-19 Thread Bruno Rocha
Is it the web shell? (if yes, its buggy)

-- 





Re: [web2py] Storing Python code in db?

2013-01-19 Thread Bruno Rocha
http://docs.python.org/2/library/pickle.html


http://python.about.com/od/pythonstandardlibrary/a/pickle_intro.htm

-- 





Re: [web2py] HOSTING FOR web2py ?

2013-01-18 Thread Bruno Rocha
BTW:

PythonAnywhere is fantastic! the consoles, the way it integrates with
Dropbox etc... the support also is very helpful.

Have you tried to contact them?

https://www.pythonanywhere.com/ (click on the send feedback link)

maybe the guys can give you an option instead of paypal.



On Sat, Jan 19, 2013 at 12:11 AM, samuel bonilla wrote:

> I'm doing testing for my application in pythonanywhere.com, but I had
> some problems with paypal and I could not buy a domain.
>
> someone can recommend another hosting web2py to not only accept paypal ?
>
> thank you very much.
>
> --
>
>
>
>

-- 





Re: [web2py] HOSTING FOR web2py ?

2013-01-18 Thread Bruno Rocha
webfaction
openshift
linode

-- 





Re: [web2py] displaying and editing joined tables

2013-01-18 Thread Bruno Rocha
There is this Slice:

https://www.web2pyslices.com/slice/show/1427/single-form-for-linked-tables

-- 





Re: [web2py] If I upload a file manually does it check the validators?

2013-01-18 Thread Bruno Rocha
db.files.validate_and_insert(file_upload=db.files.file_upload.store(fileApp,
filename))

it should fire the validator   (I guess)

-- 





Re: [web2py] Specify my own controller for @auth.requires_login()

2013-01-18 Thread Bruno Rocha
auth = Auth(db, controller="foo", function="bar")

-- 





Re: [web2py] editing database entry

2013-01-17 Thread Bruno Rocha
controllers/article.py

#http://./article/add
def add():
form = SQLFORM(db.article).process()
return dict(form=form)

#http:///article/edit/1
def edit():
article_id = request.args(0) or redirect(URL('index'))
form = SQLFORM(db.article, article_id).process()
return dict(form=form)

#http:///article/show/1
def show():
article_id = request.args(0) or redirect(URL('index'))
article = db.article[article_id]
return dict(article=article)

def index():
   articles = db(db.article).select()
   return dict(articles=articles)



On Thu, Jan 17, 2013 at 12:49 PM, BlueShadow  wrote:

> Hi,
> I got a table for articles me and other people write(authors) I want all
> the authors to be able to edit those articles. I currently got no clue
> where I'm going to start this project. Any help is greatly appreciated.
>
> --
>
>
>
>

-- 





Re: [web2py] how to create a counter button...

2013-01-17 Thread Bruno Rocha
Did you read the book?  I recommend chapters 3, 4 and 6

Plus the Ajax one: http://web2py.com/books/default/chapter/29/11

-- 





Re: [web2py] Trying to do a new database as a field in web2py,

2013-01-17 Thread Bruno Rocha
Wow, Now I see my example completely wrong..

should be


db.define_table('post',
  # more fields here
 Field('thoughts', "reference Thoughts")

)

db.define_table('Thoughts',
 Field('Editedby', db.auth_user, default=None, readable=True,
writable=True),
Field('TitleOfPost',requires=IS_NOT_EMPTY()),
Field('ContentOfPost','text',requires=IS_NOT_EMPTY()),
Field('DatePosted','date'),
Field('DP_Large', 'upload', uploadfield='picture_file'),
Field('picture_file', 'blob'),
)

-- 





Re: [web2py] Trying to do a new database as a field in web2py,

2013-01-17 Thread Bruno Rocha
On Thu, Jan 17, 2013 at 5:39 AM, damien rompapas  wrote:

> I am sorry if the question is not clear enough.


Yes it is not clear :)

are you trying to create a table inside a table? it is not permitted on
relational dbms. (are you using NOSQL)?

I think you want to create separate tables and create relations?


*BTW: you dont need the trailing ; in Python


db.define_table('post',
 # fields here!
)

db.define_table('Thoughts',
 Field('Editedby', db.auth_user, default=None, readable=True,
writable=True),
Field('TitleOfPost',requires=IS_NOT_EMPTY()),
Field('ContentOfPost','text',requires=IS_NOT_EMPTY()),
Field('DatePosted','date'),
Field('DP_Large', 'upload', uploadfield='picture_file'),
Field('picture_file', 'blob'),
Field('comments', "reference post")
)

try to use all lowercase names for table and fields.

-- 





Re: [web2py] why is my "\n" not working

2013-01-16 Thread Bruno Rocha
printing where?

on the console it should work!

ON web response you need to use HTML or CSS to break

{{=variable_returned_by_controller}} 

or

def action():
string = (
   "Line 1 "
   "Line 2 "
)
return string


or even better if you define in a template and use ,  and etc..

-- 





Re: [web2py] how to create a counter button...

2013-01-16 Thread Bruno Rocha
models/foo.py

# the thing table
db.define_table("thing", Field("name"))

# you may want to store likes on another table so you never allow a user to
like the same thing twice
db.define_table("thing_likes",
Field("user", "reference auth_user", notnull=True),
Field("thing", "reference thing", notnull=True),
Field("unikey", unique=True, notnull=True)
)

# this ensure that user cannot like a thing twice
db.thing_likes.unikey.compute = lambda row: "%(user)s-%(thing)s" % row


controllers/default.py

def show_thing():
 thing_id = request.args(0)
 thing = db.thing[thing_id]
 thing_likes = db(db.thing_likes.id == thing.id).count()
 return dict(thing=thing. thing_likes=thing_likes)

def like_thing():
thing_id = request.args(0)
user_id = auth.user_id
try:
db.thing_likes.validate_and_insert(
thing=int(thing_id),
user=int(user_id)
)
redirect(URL('show_thing', args=thing_id))
except:
return "thing cannot be liked twice"


views/default/show_thing.html

{{=thing.name}}
 Like this thing 




To a better implementation you should use an ajax callback to the "like"
button, and also you should check if user already likes to show a different
button, maybe unlike.

-- 





Re: [web2py] output goes to wrong place

2013-01-15 Thread Bruno Rocha
You need to write to response

{{=crud.select(db.HumanLanguage, fields=['languageName'],
headers={'HumanLanguage.languageName': 'Language Name'})}}

or

{{response.write(crud.select(db.HumanLanguage, fields=['languageName'],
headers={'HumanLanguage.languageName': 'Language Name'}))}}

-- 





Re: [web2py] Set up of db.py takes too long time

2013-01-15 Thread Bruno Rocha
It will run only when called!

But if he is testing a form, the problem maybe there.

There are some imports?

-- 





Re: [web2py] Set up of db.py takes too long time

2013-01-15 Thread Bruno Rocha
On Tue, Jan 15, 2013 at 6:20 AM, Daniel Gonzalez  wrote:

> IS_NOT_IN_DB(db, '%s.email' % (web2py_user_table))


If you too many records on user table, the above code will take a long
time, because on every request it will "select email from auth_user"

-- 





Re: [web2py] help with ckeditor?

2013-01-14 Thread Bruno Rocha
web2pyslices source code:

https://github.com/rochacbruno/Movuca

Ckeditor module
https://github.com/rochacbruno/Movuca/blob/master/modules/plugin_ckeditor.py

Ckeditor static files
https://github.com/rochacbruno/Movuca/tree/master/static/plugin_ckeditor

The plugin
https://github.com/rochacbruno/Movuca/tree/master/static/plugin_ckeditor/plugins/insertcode


On Sun, Jan 13, 2013 at 7:21 PM, samuel bonilla wrote:

> hi all,
>
> I am using the ckeditor plugin (
> https://bitbucket.org/PhreeStyle/web2py_ckeditor/wiki/Home).
>
> I want add the tag code in ckeditor, to insert code how it works in
> www.web2pyslices.com, any ideas or suggestions. How can i do it?
>
> thanks..
>
> --
>
>
>
>

-- 





Re: [web2py] how to give forms a class

2013-01-11 Thread Bruno Rocha
form['_class'] = 'foo'

it should work

or even

form.elements('form')[0]['_class'] = 'foo'

-- 





Re: [web2py] Hierarchical Database Selection

2013-01-11 Thread Bruno Rocha
On Fri, Jan 11, 2013 at 9:05 PM, Dave Cenker  wrote:

> However, this returns a list of company IDs instead of names and when I
> try to do something like this:
>
> db(train.company.id == id) it doesn't work.
>

should be

db(db.train.company == is)

>
> What I'd really like to do is get a list of the names of the companies
> that a user has seen and then make a database selection based upon those
> names in a manner like this:
>
> db(currUserQuery & (db.train.company.name == companyNameText)).select()
>

should be

& (db.company.name == comanyNameText)

-- 





Re: [web2py] Chicago Job

2013-01-11 Thread Bruno Rocha
Maybe a developer who read 1/2 of the web2py book :) LOL

-- 





Re: [web2py] Chicago Job

2013-01-11 Thread Bruno Rocha
I understood as 1 or 2 devs...

or it is a half time developer?

-- 





Re: [web2py] External css

2013-01-11 Thread Bruno Rocha
put in

web2py/applications/YOURAPP/static/css/yourcssfile.css

refer with



-- 





Re: [web2py] Re: Add a WHERE clause to every request

2013-01-11 Thread Bruno Rocha
little fix.

On Fri, Jan 11, 2013 at 3:21 PM, Bruno Rocha  wrote:

> for table in db.tables:
> db[table]._common_filter = lambda query: db[table].is_active == True
>

-- 





Re: [web2py] Re: Add a WHERE clause to every request

2013-01-11 Thread Bruno Rocha
for table in db.tables:
db[table]_common_filter = lambda query: db[table]is_active == True

-- 





Re: [web2py] Running some code at the end of the request

2013-01-11 Thread Bruno Rocha
I think that for doing this you should modify response.render to a
specialized function.



def my_response_render(*args, **kwargs):
 # here you have to implement what you need
 # and then do the normal response.render


in models/db.py


response.render = my_response_render


In that way you can intercept things before the response get rendered.


** maybe it can be included as a signal in response.render itself.

-- 





Re: [web2py] How to call a function from a web page

2013-01-10 Thread Bruno Rocha
Please read the chapter 3 and 4 (overview and the core) those things will
be very clear after you read few lines.

http://web2py.com/books/default/chapter/29/03#Overview


On Thu, Jan 10, 2013 at 10:50 PM, Alex Glaros  wrote:

> The index.html page doesn't have much in it...so web2py just automatically
> goes to all of these default .py files and runs them?
>
> If yes, when people write a large app, do they avoid using default files
> and implicitly specify where to go instead?
>
> thanks,
>
> Alex
>
> On Thursday, January 10, 2013 4:33:15 PM UTC-8, rochacbruno wrote:
>
>>
>> On Thu, Jan 10, 2013 at 10:30 PM, Alex Glaros  wrote:
>>
>>> *views/default/mytable_manage.html*
>>
>>
>>
>> look in controllers/default.py inside this file there is a function
>> called mytable_manage
>>
>>  --
>
>
>
>

-- 





Re: [web2py] How to call a function from a web page

2013-01-10 Thread Bruno Rocha
On Thu, Jan 10, 2013 at 10:30 PM, Alex Glaros  wrote:

> *views/default/mytable_manage.html*



look in controllers/default.py inside this file there is a function called
mytable_manage

-- 





Re: [web2py] Report bug to app admin

2013-01-10 Thread Bruno Rocha
Are you suggesting have a form for end users submit tickets for app
developer

or

inside /admin have a form for app developer submit a ticket to web2py
developers

?

-- 





Re: [web2py] SQLFORM question

2013-01-09 Thread Bruno Rocha
On Thu, Jan 10, 2013 at 3:09 AM, b00m_chef  wrote:

> requires=IS_IN_DB(*db(db.owner.user == auth.user.id)*, 'owner.id',
> '%(name)s')
>

-- 





Re: [web2py] About web2py videos and stuff

2013-01-09 Thread Bruno Rocha
I create some videos!

(currently I have 308 web2py videos on my VIMEO account)

But, it is all in Portuguese and major part of them are exclusively for my
students.

+1 for a video contest!


Example of my on line web2py classes.

A complete introduction to web development, Python WSGI and web2py + web2py
debugger
- http://vimeo.com/57032236 (Portuguese) 


- Integrating web2py and Paypal API
http://vimeo.com/55493745 (English)
* but listen, my english is terrible, I made this for a client and I guess
nobody can understand what I said.

- websockerts
http://vimeo.com/38972256 (Portuguese)

- PowerTable and WingIDE
- http://vimeo.com/18447603

=


On Wed, Jan 9, 2013 at 12:39 PM, António Ramos  wrote:

> Hello
> i noticed that almost all of the video tutorials about web2py come from
> the master itself, Maximo
> Maximo needs time to make web2py better. and web2py is not a baby anymore!
>
> If web2py is used as a teaching tool and a lot of students use it, would
> it not be more productive to have the students help creating video
> tutorials for others to learn?
> leaving maximo more time to make web2py even more incredible?
>
> Why not a challenge with a simbolic ( or not) price for the best web2py
> video tutorial?
>
> Also a lot of video tutorials have no subtitles or comments from the
> author. This is not good!
>
> A lot of bad stuff out there have good videos.
> Why dont we have them also?
>
> For newbies, videos are very important.
>
>
>
>
>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Resizing a user uploaded image

2013-01-08 Thread Bruno Rocha
are you running on Google App Engine?

-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
Ok, but just read this

# User-made changes in this file will be silently lost, as it is silently
# rewrited with upgrade of uwsgi package.
#
# If you want to change default options of uWSGI daemon, then:
# * copy this file somewhere
# * add/remove/change options in copied file
# * edit /etc/default/uwsgi and change location of inherited configuration
#   file to path to copied file

-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
and youi delete or comment that file?

-- 





Re: [web2py] Re: problem with multiple processes with uwsgi and web2py

2013-01-08 Thread Bruno Rocha
I have a single server, ubuntu 12.04 running 3 web2py instances + 2 php
wordpress websites

Php runs with fcgi - web2py runs with uwsgi, because of that I have 12
nginx workers running

I am not an expert on this, but this solution is working well for me.


That is what I have in top


*TOP*
top - 22:54:55 up 78 days,  4:24,  1 user,  load average: 0.05, 0.13, 0.13
Tasks: 111 total,   1 running, 110 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.2%sy,  0.0%ni, 98.2%id,  1.5%wa,  0.0%hi,  0.1%si,
0.0%st
Mem:   1012860k total,   934292k used,78568k free,27148k buffers
Swap:   524284k total,   343908k used,   180376k free,   258680k cached

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+
COMMAND
 1123 www-data  20   0  396m  41m  14m S0  4.2   7:40.82
php5-fpm
 3738 www-data  20   0  160m 1512 1472 S0  0.1   5:00.87
uwsgi-core
 3901 www-data  20   0  160m 1512 1472 S0  0.1   5:04.47
uwsgi-core
 4730 www-data  20   0  397m  43m  15m S0  4.4   9:45.87
php5-fpm
 4731 www-data  20   0  397m  42m  15m S0  4.3   9:41.48
php5-fpm
 4732 www-data  20   0  392m  37m  14m S0  3.8   9:32.35
php5-fpm
 4734 www-data  20   0  393m  38m  15m S0  3.9   9:58.31
php5-fpm
 5113 www-data  20   0  208m  36m 3824 S0  3.7   0:56.18
uwsgi
 8993 www-data  20   0  240m  94m 4504 S0  9.5   0:20.76
uwsgi
 9409 www-data  20   0  217m 2188 2184 S0  0.2   1:34.40
uwsgi-core
 9410 www-data  20   0  217m 4388 2180 S0  0.4   0:51.60
uwsgi-core
 9457 www-data  20   0  214m  65m 4840 S0  6.7   0:08.62
uwsgi
15463 www-data  20   0 79460 3356 1664 S0  0.3   5:56.76
nginx
15464 www-data  20   0 79108 3476 1712 S0  0.3   5:56.79
nginx
15465 www-data  20   0 79632 3480 1656 S0  0.3   5:59.49
nginx
15466 www-data  20   0 79468 3392 1652 S0  0.3   5:54.69
nginx
15467 www-data  20   0 79184 3244 1660 S0  0.3   5:49.36
nginx
15468 www-data  20   0 79460 3380 1668 S0  0.3   5:39.78
nginx
15469 www-data  20   0 79604 3860 1672 S0  0.4   5:46.62
nginx
15470 www-data  20   0 79488 3368 1680 S0  0.3   5:55.42
nginx
15471 www-data  20   0 79604 3280 1656 S0  0.3   5:52.24
nginx
15472 www-data  20   0 79444 3468 1688 S0  0.3   5:59.96
nginx
15473 www-data  20   0 79440 3452 1684 S0  0.3   5:54.13
nginx
15474 www-data  20   0 79476 3516 1692 S0  0.3   5:49.28
nginx
16040 www-data  20   0  193m  47m 3884 S0  4.8   2:49.74
uwsgi
22482 www-data  20   0  153m 2384 2144 S0  0.2   2:41.56
uwsgi
22651 www-data  20   0  160m 4864 2208 S0  0.5   2:42.54
uwsgi
22818 www-data  20   0  160m 5532 2220 S0  0.5   3:01.67
uwsgi
28847 www-data  20   0  192m  46m 3588 S0  4.7   2:18.97
uwsgi
29885 www-data  20   0  208m  37m 4052 S0  3.8   0:34.50
uwsgi
29914 www-data  20   0  222m 2192 2188 S0  0.2   0:11.24
uwsgi-core
30403 www-data  20   0  205m 2208 2176 S0  0.2   0:05.77
uwsgi-core


*uwsgitop*

uwsgi-1.0.3-debian - Tue Jan  8 23:01:58 2013 - req: 1110940 - lq: 0 - tx:
22786619414
node: li284-252 - cwd: /home/www-data/web2py - uid: 33 - gid: 33 -
masterpid: 22818
 WID%   PID REQ EXC SIG STATUS  AVG RSS
VSZ TX  RunT
 1  71.03   10199   789111  0   0   idle162ms   76M
222M15494M  3912m
 2  28.97   10171   321829  0   0   idle246ms   60M
205M6236M   1776m



*UWSGI FILE* ( Ihave the same file for other 2 apps, but other apps have no
 tag )


python
/run/uwsgi/app/web2py/web2py.socket
/home/www-data/web2py/

wsgihandler


4
60
8
1
/tmp/stats.socket
2000
512
256
192





*NGINX FILE*

server {
server_name x.com.br;

rewrite ^/(.*) http://www.xx.com.br/$1 permanent;
   }


server {
client_max_body_size 10M;
listen  80;
server_name wwwcom.br;


if ( $http_referer ~*
(babes|forsale|girl|jewelry|love|nudit|poker|porn|sex|teen) )
{
 # return 404;
 return 403;
}

if ($request_method !~ ^(GET|HEAD|POST)$ ) {
 return 444;
}

location ~ \.(aspx|php|jsp|asp|cgi)$ {
   return 410;
}

if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}

if ($http_user_agent ~*
msnbot|scrapbot|WebCopier|AhrefsBot|Baidu|Yandex|baiduspider|yandexspider )
{
return 403;
}

location ~* /(\w+)/static/ {
   root /home/www-data/web2py/applications/;
}

   location ~ ^/download/(.*)$ {
   alias /home/www-data/web2py/applications/init/uploads/$1;
   }

location / {
uwsgi_pass  unix:///run/uwsgi/app/web2py/web2py.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;
}
}

serv

Re: [web2py] Re: Resizing a user uploaded image

2013-01-08 Thread Bruno Rocha
Yeah it is a problem in THUMB function, thumb function looks for files
under /uploads and you are defining another folder.

change the imageutils module replacing /uploads with /uploads/profile

On Tue, Jan 8, 2013 at 9:30 PM, Daniele Pestilli wrote:

> I put imageutils in my app's modules directory, then I added:
> Field("thumbnail", "upload", uploadfolder=os.path.join(request.folder,
> 'uploads', 'profiles', 'thumbs')),
> to the appropriate database table, and below that, in the same file
> (db.py) I wrote:
>
> from imageutils import THUMB
> db.tutor.thumbnail.compute = lambda row: THUMB(row.picture, 200, 200)
>
> but the resizing doesn't seem to work. Am I doing something wrong?
>
>
> On Tue, Jan 8, 2013 at 9:29 PM, Michele Comitini <
> michele.comit...@gmail.com> wrote:
>
>> I use wand for the task: http://pypi.python.org/pypi/Wand/0.1.10
>> there are many other bindings on the impressive *magick libraries, but
>> this one being a ctypes implementation is light and fast enough..
>>
>> mic
>>
>>
>> 2013/1/8 Bruno Rocha :
>> > I am using this recipe:
>> >
>> >
>> http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box
>> >
>> > I have plans to integrate it with a JavaScript Cropper plugin to get the
>> > dimensions.
>> >
>> > --
>> >
>> >
>> >
>>
>> --
>>
>>
>>
>>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Resizing a user uploaded image

2013-01-08 Thread Bruno Rocha
I am using this recipe:

http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box

I have plans to integrate it with a JavaScript Cropper plugin to get the
dimensions.

-- 





  1   2   3   4   5   6   7   8   9   10   >