Re: [web2py] Re: MariaDB

2012-10-05 Thread vinicius...@gmail.com

That's exactly what its site is spreading to the whole world.

If it doesn't work, it would be a worldwide deception.



On 10/05/2012 03:05 PM, Massimo Di Pierro wrote:

Ias you say it is supposed to work as a drop-in replacement. I never
tried but it should work fine with one of the mysql drivers and the
web2py mysql adapter.

On Friday, 5 October 2012 12:26:13 UTC-5, mikech wrote:

MariaDb is supposedly a drop in replacement for MySql.  Does anyone
have any experience using this with Web2py?

--





--





Re: [web2py] Re: How do you organize your applications to be unit-tested?

2012-10-04 Thread vinicius...@gmail.com
You're right, Richard, but I was asking how you organize your production 
code, not your test code.


What is your strategies to isolate components to achieve a better 
unit-testing scenario?


--
Vinicius Assef


On 10/04/2012 12:49 PM, Richard Vézina wrote:

I am reading actually about unit testing and doctest in docstring should
be pretty small, as a rule of thumb it should be less longer than you
docstring documentation.

But, it says too that it pretty convenient to have at least one doctest
in docstring since it could help a lot in identifying outdated docstring
since if you refactor you code without touch you docstring your doctest
should failed so you know you are good for a bit of documentation pleasure.

I read too that docstring can be kept apart the docstring a .txt file,
so the long unit test should go there.

So when doctest help you better understand and document the purpose of
the code and if it is short it should go in docstring if it get bloated
you can move it in .txt file apart.

Richard

On Thu, Oct 4, 2012 at 10:27 AM, Marek Mollin rog...@gmail.com
mailto:rog...@gmail.com wrote:

I only use doc-string testing. For everything I do its snap and
effective enough. Plus it can trigered from admin.
Though it is not recomnded way of unittesting - it has its problems,
bloats the code base, does not provide clean seperation between
tests and actual app.


W dniu środa, 3 października 2012 21:46:03 UTC+2 użytkownik
viniciusban napisał:

Hi all.

I continue diving into unit-testing and I'd like to know how do you
organize your applications to be unit-tested.

Thin controllers? DAO classes? How do you decouple things in
web2py to
make unit-testing easy?

--
Vinicius Assef

--




--





--





Re: [web2py] args or vars

2012-10-04 Thread vinicius...@gmail.com
If the function you mention is a controller function invoked directly by 
the user via URL, I'd choose vars because the number of recs is only a 
configuration to shape your presentation.



On 10/04/2012 05:33 PM, Richard wrote:

Hello,

Let say I want to pass to a function the number of records I want out of
a query in order to limit the number of record displayed in a
component... Should I pass it as a args or a vars?

Thanks

Richard

--





--





[web2py] How do you organize your applications to be unit-tested?

2012-10-03 Thread vinicius...@gmail.com

Hi all.

I continue diving into unit-testing and I'd like to know how do you 
organize your applications to be unit-tested.


Thin controllers? DAO classes? How do you decouple things in web2py to 
make unit-testing easy?


--
Vinicius Assef

--





Re: [web2py] Classes in markmin

2012-09-03 Thread vinicius...@gmail.com
But is there some tool to generate offline docs, like Sphinx, using 
themes and linking local pages?


That's what I'm looking for.

--
Vinicius Assef


On 09/03/2012 01:54 AM, Bruno Rocha wrote:

There is markmin2pdf and markmin2html on gluon.contrib

https://github.com/web2py/web2py/tree/master/gluon/contrib/markmin

--





--





Re: [web2py] Search Database field auto complete

2012-09-02 Thread vinicius...@gmail.com

http://web2py.com/books/default/chapter/29/07#Autocomplete-widget


On 09/02/2012 11:05 AM, BlueShadow wrote:

Hi,
I got huge database with a name field...  I have to search for
individual lines quite often. So I wanted to make a search box for it.
If Christmas was today I would love it it would be somewhat similar like
the google search: like while your typing it shows you the possibilities
with those first letters. Is there a way to do this in python? Has
anyone done this before?
Thanks

--





--





[web2py] Global formstyle configuration

2012-09-02 Thread vinicius...@gmail.com

I think it would be nice to have some global configs in web2py.
One of them is formstyle.

It's unpleasant to define formstyle in every FORM definition.
This formstyle config could come in db.py like Auth configs.

So, once defined my app formstyle, it should be used as default. But in 
a specific FORM, I could override it, according to my needs.


Any oppinion?

--
Vinicius Assef


On 09/02/2012 12:12 PM, Anthony wrote:

We also need to document the new formstyle='bootstrap' option as well as
the new callable formstyle option that takes the form and fields and
builds the entire form DOM.

Anthony

On Saturday, September 1, 2012 5:37:11 PM UTC-4, Massimo Di Pierro wrote:

These features are now documented in the html book. Working on more.

[x] Support for DAL(lazy_tables=True) and
db.define_table(on_define=lambda table:), thanks Jonathan
[x] db(...).select(cacheable=True) make select 30% faster
[x] db(...).select(cache=(cache.ram,3600)) now caches parsed data
100x faster
[x] db(...).count(cache=(cache.ram,3600)) now supported
[x] MongoDB support in DAL (experimental), thanks Mark Breedveld
[x] db.mytable._before_insert, _after_insert, _before_update,
_after_update, _before_delete. _after_delete (list of callbacks)
[x] DAL BIGINT support and DAL(...,bigint_id=True)
[x] IS_IN_DB(..., distinct=True)
[x] new syntax: db.mytable.insert(myuploadfield=open()), thank
you Iceberg
[x] db(...).select(db.mytable.myfield.count(distinct=True))
[x] teradata adapter, thanks Andrew Willimott
[x] experimental Sybase Adapter
[x] added db.table.field.avg()
[x] Field(... 'upload', default=path) now accepts a path to a local
file as default value, if user does not upload a file. Relative path
looks inside current application folder, thanks Marin
[x] executesql(...,fields=,columns=) allows parsing of results in
Rows, thanks Anthony

[x] @auth.requires_login(otherwise=URL(...))
[x] CRYPT now defaults to pbkdf2(1000,20,sha1)
[x] allow storage of uploads on any PyFileSystem (including amazon)

[x] more export options in SQLFORM.grid and SQLFORM.smartgrid (html,
xml, csv, ...)

[x] new layout based on Twitter Bootstrap
[x] New generic views: generic.ics (Mac Mail Calendar) and
generic.map (Google Maps)
[x] request.args(0,default=0, cast=int, otherwise=URL(...)), thanks
Anthony
[x] redirect(...,type='auto') will be handled properly in ajax responses
[x] routes in can redirect outside with
routes_in=[('/path','303-http://..')]
[x] .coffee and .less support in response.files, thanks Sam Sheftel
[x] ldap certificate support
[x] pg8000 postgresql driver support (experimental)

[x] db.table.field.like(...,case_sensitive=False) (thanks Floyd)
[x] db.table.field.regexp(...) for sqlite and postgres
[ ] db(...,ignore_common_filters=True)
[x] db(db.dog_id.belongs(db.dogs.owner=='james')).select()
[ ] db(...).select().group_by_value(db.table.field) (thanks Yair)
[x] db = DAL('imap://user:password@server:port') support (thanks
Alan Etkin)
[x] db = DAL('teradata://DSN=dsn;UID=user;PWD=pass;
DATABASE=database') (thanks Adrew Willmott)
[x] db = DAL('mongodb://127.0.0.1:5984/db
http://127.0.0.1:5984/db') (experimental, thanks Mark Breedveld)
[x] db = DAL('cubrid')  (experimental)
[x] db = DAL('postgres:pg8000:...') and DAL('postgres:psycopg2:...')
[x] pg8000 now ships with web2py (thanks Mariano)
[x] reponse.delimiters = ('\\[','\\]') (thanks Denes)
[x] conditional menu items
(reponse.menu=[(title,bool,link,[],condition)]



I could use some help documenting these features

[ ] geodal and spatialite, thanks Denes and Fran (experimental)
[ ] Support for Google App Engine projections, thanks Christian
[ ] Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
[ ] DIV(..).elements(...replace=...), thanks Anthony
[ ] new fpdf, thanks Mariano
[ ] included web-based debugger (experimental, thanks Mariano)
[ ] pluralization system (Vladyslav)
[ ] T.M helper (Vladyslav)


Eventually some of the new features require a loger discussion in a
blog-like fashion than just a mention and a short example in the book.


--





--





Re: [web2py] Re: Global formstyle configuration

2012-09-02 Thread vinicius...@gmail.com

Anthony, another one would be hide_error.

These are settings affect app style of visualization and user 
interaction. So, it makes sense to be defined once and overriden when 
necessary.


--
Vinicius Assef


On 09/02/2012 12:34 PM, Anthony wrote:

Are there other examples of potential global configs? For forms, perhaps
we could set the default via a formstyle class attribute, which you
could then change once in your code.

Anthony

On Sunday, September 2, 2012 11:27:42 AM UTC-4, viniciusban wrote:

I think it would be nice to have some global configs in web2py.
One of them is formstyle.

It's unpleasant to define formstyle in every FORM definition.
This formstyle config could come in db.py like Auth configs.

So, once defined my app formstyle, it should be used as default. But in
a specific FORM, I could override it, according to my needs.

Any oppinion?

--
Vinicius Assef


On 09/02/2012 12:12 PM, Anthony wrote:
 We also need to document the new formstyle='bootstrap' option as well as
 the new callable formstyle option that takes the form and fields and
 builds the entire form DOM.

 Anthony

 On Saturday, September 1, 2012 5:37:11 PM UTC-4, Massimo Di Pierro wrote:

 These features are now documented in the html book. Working on more.

 [x] Support for DAL(lazy_tables=True) and
 db.define_table(on_define=lambda table:), thanks Jonathan
 [x] db(...).select(cacheable=True) make select 30% faster
 [x] db(...).select(cache=(cache.ram,3600)) now caches parsed data
 100x faster
 [x] db(...).count(cache=(cache.ram,3600)) now supported
 [x] MongoDB support in DAL (experimental), thanks Mark Breedveld
 [x] db.mytable._before_insert, _after_insert, _before_update,
 _after_update, _before_delete. _after_delete (list of callbacks)
 [x] DAL BIGINT support and DAL(...,bigint_id=True)
 [x] IS_IN_DB(..., distinct=True)
 [x] new syntax: db.mytable.insert(myuploadfield=open()), thank
 you Iceberg
 [x] db(...).select(db.mytable.myfield.count(distinct=True))
 [x] teradata adapter, thanks Andrew Willimott
 [x] experimental Sybase Adapter
 [x] added db.table.field.avg()
 [x] Field(... 'upload', default=path) now accepts a path to a local
 file as default value, if user does not upload a file. Relative path
 looks inside current application folder, thanks Marin
 [x] executesql(...,fields=,columns=) allows parsing of results in
 Rows, thanks Anthony

 [x] @auth.requires_login(otherwise=URL(...))
 [x] CRYPT now defaults to pbkdf2(1000,20,sha1)
 [x] allow storage of uploads on any PyFileSystem (including amazon)

 [x] more export options in SQLFORM.grid and SQLFORM.smartgrid (html,
 xml, csv, ...)

 [x] new layout based on Twitter Bootstrap
 [x] New generic views: generic.ics (Mac Mail Calendar) and
 generic.map (Google Maps)
 [x] request.args(0,default=0, cast=int, otherwise=URL(...)), thanks
 Anthony
 [x] redirect(...,type='auto') will be handled properly in ajax 
responses
 [x] routes in can redirect outside with
 routes_in=[('/path','303-http://..')]
 [x] .coffee and .less support in response.files, thanks Sam Sheftel
 [x] ldap certificate support
 [x] pg8000 postgresql driver support (experimental)

 [x] db.table.field.like(...,case_sensitive=False) (thanks Floyd)
 [x] db.table.field.regexp(...) for sqlite and postgres
 [ ] db(...,ignore_common_filters=True)
 [x] db(db.dog_id.belongs(db.dogs.owner=='james')).select()
 [ ] db(...).select().group_by_value(db.table.field) (thanks Yair)
 [x] db = DAL('imap://user:password@server:port') support (thanks
 Alan Etkin)
 [x] db = DAL('teradata://DSN=dsn;UID=user;PWD=pass;
 DATABASE=database') (thanks Adrew Willmott)
 [x] db = DAL('mongodb://127.0.0.1:5984/db http://127.0.0.1:5984/db
 http://127.0.0.1:5984/db') (experimental, thanks Mark Breedveld)
 [x] db = DAL('cubrid')  (experimental)
 [x] db = DAL('postgres:pg8000:...') and DAL('postgres:psycopg2:...')
 [x] pg8000 now ships with web2py (thanks Mariano)
 [x] reponse.delimiters = ('\\[','\\]') (thanks Denes)
 [x] conditional menu items
 (reponse.menu=[(title,bool,link,[],condition)]



 I could use some help documenting these features

 [ ] geodal and spatialite, thanks Denes and Fran (experimental)
 [ ] Support for Google App Engine projections, thanks Christian
 [ ] Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
 [ ] DIV(..).elements(...replace=...), thanks Anthony
 [ ] new fpdf, thanks Mariano
 [ ] 

Re: [web2py] Re: Global formstyle configuration

2012-09-02 Thread vinicius...@gmail.com

Yes, Bruno.

But wouldn't it be better if it was just a config?



On 09/02/2012 09:09 PM, Bruno Rocha wrote:

This should work..

# On models
class SQLFORM(SQLFORM):
 ''' Customized SQLFORM '''

 def __init__(self, *args, **kwargs):
 kwargs.setdefault(formstyle, divs)
 super(MySQLFORM, self).__init__(*args, **kwargs)




On Sun, Sep 2, 2012 at 8:11 PM, vinicius...@gmail.com
mailto:vinicius...@gmail.com vinicius...@gmail.com
mailto:vinicius...@gmail.com wrote:

Anthony, another one would be hide_error.

These are settings affect app style of visualization and user
interaction. So, it makes sense to be defined once and overriden
when necessary.

--
Vinicius Assef



On 09/02/2012 12:34 PM, Anthony wrote:

Are there other examples of potential global configs? For forms,
perhaps
we could set the default via a formstyle class attribute,
which you
could then change once in your code.

Anthony

On Sunday, September 2, 2012 11:27:42 AM UTC-4, viniciusban wrote:

 I think it would be nice to have some global configs in web2py.
 One of them is formstyle.

 It's unpleasant to define formstyle in every FORM definition.
 This formstyle config could come in db.py like Auth configs.

 So, once defined my app formstyle, it should be used as
default. But in
 a specific FORM, I could override it, according to my needs.

 Any oppinion?

 --
 Vinicius Assef


 On 09/02/2012 12:12 PM, Anthony wrote:
  We also need to document the new formstyle='bootstrap'
option as well as
  the new callable formstyle option that takes the form and
fields and
  builds the entire form DOM.
 
  Anthony
 
  On Saturday, September 1, 2012 5:37:11 PM UTC-4, Massimo
Di Pierro wrote:
 
  These features are now documented in the html book.
Working on more.
 
  [x] Support for DAL(lazy_tables=True) and
  db.define_table(on_define=__lambda table:), thanks
Jonathan
  [x] db(...).select(cacheable=True) make select 30% faster
  [x] db(...).select(cache=(cache.__ram,3600)) now
caches parsed data
  100x faster
  [x] db(...).count(cache=(cache.__ram,3600)) now supported
  [x] MongoDB support in DAL (experimental), thanks
Mark Breedveld
  [x] db.mytable._before_insert, _after_insert,
_before_update,
  _after_update, _before_delete. _after_delete (list of
callbacks)
  [x] DAL BIGINT support and DAL(...,bigint_id=True)
  [x] IS_IN_DB(..., distinct=True)
  [x] new syntax:
db.mytable.insert(__myuploadfield=open()), thank
  you Iceberg
  [x]
db(...).select(db.mytable.__myfield.count(distinct=True))
  [x] teradata adapter, thanks Andrew Willimott
  [x] experimental Sybase Adapter
  [x] added db.table.field.avg()
  [x] Field(... 'upload', default=path) now accepts a
path to a local
  file as default value, if user does not upload a
file. Relative path
  looks inside current application folder, thanks Marin
  [x] executesql(...,fields=,__columns=) allows parsing
of results in
  Rows, thanks Anthony
 
  [x] @auth.requires_login(__otherwise=URL(...))
  [x] CRYPT now defaults to pbkdf2(1000,20,sha1)
  [x] allow storage of uploads on any PyFileSystem
(including amazon)
 
  [x] more export options in SQLFORM.grid and
SQLFORM.smartgrid (html,
  xml, csv, ...)
 
  [x] new layout based on Twitter Bootstrap
  [x] New generic views: generic.ics (Mac Mail
Calendar) and
  generic.map (Google Maps)
  [x] request.args(0,default=0, cast=int,
otherwise=URL(...)), thanks
  Anthony
  [x] redirect(...,type='auto') will be handled
properly in ajax responses
  [x] routes in can redirect outside with
  routes_in=[('/path','303-__http://..')]
  [x] .coffee and .less support in response.files,
thanks Sam Sheftel
  [x] ldap certificate support
  [x] pg8000 postgresql driver support (experimental)
 
  [x] db.table.field.like(...,case___sensitive=False)
(thanks Floyd)
  [x] db.table.field.regexp

[web2py] Unit tests

2012-09-02 Thread vinicius...@gmail.com

Hi guys.

I'd like to know if this still is the recommended way to write unit 
tests in Web2py: http://www.web2py.com/AlterEgo/default/show/260


--
Vinicius Assef

--





Re: [web2py] Re: Unit tests

2012-09-02 Thread vinicius...@gmail.com

So, could we consider webclient the official way to unittest web2py apps?


On 09/03/2012 12:41 AM, Massimo Di Pierro wrote:

Now you also have gluon/contrib/webclient.py

On Sunday, 2 September 2012 21:57:47 UTC-5, viniciusban wrote:

Hi guys.

I'd like to know if this still is the recommended way to write unit
tests in Web2py: http://www.web2py.com/AlterEgo/default/show/260
http://www.web2py.com/AlterEgo/default/show/260

--
Vinicius Assef

--





--





[web2py] Classes in markmin

2012-09-02 Thread vinicius...@gmail.com
I'm in charge to find a good solution to document some projects and I 
faced markdown, reST and markmin.


I found this thread from about 1 year ago: 
https://groups.google.com/forum/?fromgroups=#!topic/web2py/driLl6I8K64


Comparing reST with markmin, I observed reST creates div to 
encapsulate lists, sections, etc. We can benefit of this approach to 
customize presentations with CSS.


What does markmin do about it?

I know Web2py book app is written to support markmin and to publish the 
book on the web. But do we have some sphinx-like tool to generate static 
html files from markmin?


--
Vinicius Assef

--





Re: [web2py] Re: web2py 2.0.5 is out

2012-09-01 Thread vinicius...@gmail.com

Great! \o/


On 09/01/2012 05:18 PM, Richard Vézina wrote:

Confirm backward compatibility.

I just migrate from 1.99.4 to 2.0.5

Notice, that I change :

controllers/appadmin.py
static/css/*
static/js/*
static/images/*
views/*generic.*
views/web2py_ajax.html

With the files form welcome app, provided within web2py.

Thanks Massimo and all developers for this promising new web2py version!!

Richard

On Sat, Sep 1, 2012 at 1:11 PM, Massimo Di Pierro
massimo.dipie...@gmail.com mailto:massimo.dipie...@gmail.com wrote:

I agree. we kind of have a referral program (experts4solutions.com
http://experts4solutions.com) and I am happy to sell support to
businesses. We need to create more structure. There are definitively
business opportunities.


On Saturday, 1 September 2012 08:32:55 UTC-5, apps in tables wrote:

So, How to do business with web2py?

How to find a customer ( needs web app )?

How to find a technical support ?

I think the business side of web2py needs to be wraped up in a
video by massimo...


On Saturday, September 1, 2012 4:26:56 PM UTC+3, apps in tables
wrote:

Most of the users will donate, specially the ones who do
business with web2py.

On Saturday, September 1, 2012 3:30:12 PM UTC+3, Massimo Di
Pierro wrote:

No you do not win anything. It means make a gift to
web2py. It is the usual donation box.

On Saturday, 1 September 2012 00:38:29 UTC-5, apps in
tables wrote:

make a gift to win 10,000 ???

it is in the main page of web2py.com http://web2py.com

--




--





--





[web2py] Is 2.0.2 or 2.0.3 really a stable version?

2012-08-31 Thread vinicius...@gmail.com

First of all, I'd like to thank you all. You're making a great job, guys.
I see web2py becoming more reliable to bigger projects and I'm very 
pleased with it.

You all rock! :-)

In spite of this huge effort, isn't it premature to call 2.0.2 or even 
2.0.3 stable? I know there were several months of hard work, but if we 
have bugs detected so fast, we cannot call it stable yet, right?


Maybe some release candidate call or a pre-release period for tests, 
before spreading it as stable would help us.


--
Vinicius Assef


On 08/30/2012 05:49 PM, Massimo Di Pierro wrote:

All bugs reported today have been fixed in 2.0.3 out now (except a minor
issue with markmin that we are investigating).

If you find other issues, please continue report them. We'd rather fix
them sooner rather than later.

Thanks for all your help and testing.

Massimo



On Wednesday, 29 August 2012 22:41:34 UTC-5, Massimo Di Pierro wrote:

After 5 months. It is done. This is the most waited and the most
feature-packed release.

I am sure we'll find some corners that need to be ironed but it is
considerably better than 1.99.7. It adds lot of new features and
improves many existing ones:

- 57,000 new lines of code and closed 279 issues since 1.99.7.
- Retrieving data from DB should be faster, in particular
select(cacheable=True)
- Has a new scheduler, a built-in wiki, new language and
pluralization system, better markmin with oembed support and better
scaffolding app, increased security.
- Lots of experimental features including GIS support, mongodb
support, built-in auth.wiki(), and more.

Should be 100% backward compatible. If you run into any issue let us
know ASAP.

I personally want to thank the major contributors to this release
(in alphabetic order)
Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg,
Jonathan, Marc, Mariano, Marin, Martin, Mark, Michael, Michele,
Niphlod, Patrick, Vladyslav,
They spend many nights testing, coding, debugging at a very fast pace.

Many many people have contributed.

If your contribution has not been properly acknowledged please let
us know ASAP. It is probably an oversight.


Massimo


Detailed changelog
===

## 2.00.2

### DAL Improvements

- Support for DAL(lazy_tables=True) and
db.define_table(on_define=lambda table:), thanks Jonathan
- db(...).select(cacheable=True) make select 30% faster
- db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x
faster
- db(...).count(cache=(cache.ram,3600)) now supported
- MongoDB support in DAL (experimental), thanks Mark Breedveld
- geodal and spatialite, thanks Denes and Fran (experimental)
- db.mytable._before_insert, _after_insert, _before_update,
_after_update, _before_delete. _after_delete (list of callbacks)
- db(...).update_naive(...) same as update but ignores
table._before_update and table._after_update
- DAL BIGINT support and DAL(...,bigint_id=True)
- IS_IN_DB(..., distinct=True)
- new syntax: db.mytable.insert(myuploadfield=open()), thank you
Iceberg
- db(...).select(db.mytable.myfield.count(distinct=True))
- db(db.a)._update(name=db(db.b.a==db.a.id
http://db.a.id).nested_select(db.b.id http://db.b.id))
- db.mytable.myfield.filter_in, filter_out
- db.mytable._enable_record_versioning(db) adds versioning to this table
- teradata adapter, thanks Andrew Willimott
- experimental Sybase Adapter
- added db.table.field.avg()
- Support for Google App Engine projections, thanks Christian
- Field(... 'upload', default=path) now accepts a path to a local
file as default value, if user does not upload a file. Relative path
looks inside current application folder, thanks Marin
- executesql(...,fields=,columns=) allows parsing of results in
Rows, thanks Anthony

### Auth improvements

- auth.enable_record_versioning(db)  adds full versioning to all tables
- @auth.requires_login(otherwise=URL(...))
- auth supports salt and compatible with third party data, thanks
Dave Stoll
- CRYPT now defaults to pbkdf2(1000,20,sha1)
- Built-in wiki with menu, tags, search, media, permissions. def
index: return auth.wiki()
- auth.settings.everybody_group_id
- allow storage of uploads on any PyFileSystem (including amazon)

### Form improvements

- FORM.confirm('Are you sure?',{'Back':URL(...)})
- SQLFORM.smartdictform(dict)
- form.add_button(value,link)
- SQLFORM.grid(groupby='...')
- fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
- more export options in SQLFORM.grid and SQLFORM.smartgrid (html,
xml, csv, ...)

### Admin improvements

- new admin pages: manage_students, bulk_regsiter, and progress reports
- increased security in admin against CSRF
- experimental Git integration
- experimental 

Re: [web2py] Is 2.0.2 or 2.0.3 really a stable version?

2012-08-31 Thread vinicius...@gmail.com
See, guys, I'm not blaming anyone and I'm not saying Web2py is not good, 
or your work failed.


I pay my bills working with web2py for the last year. I use it for 3 
years, now. I really like that and help spread the word.




Web2py has so much features and it is impossible to test everything.


Sorry, but I cannot agree with this statement. Is it the official position?

Remember, one of the strengths is our backward compatibility. It can be 
achieved with detailed tests **before** anouncing a new stable release.


Stable means: you can download and just use it. Anything different 
is almost stable or buggy yet or, using beautiful words, release 
candidate or pre-release version.


I'd like to hear your oppinions.

--
Vinicius Assef



On 08/31/2012 09:01 AM, Marin Pranjić wrote:

It is called stable since no one using trunk/nightly build detected
those errors.

I agree with you, but you cannot blame anyone.


On Fri, Aug 31, 2012 at 1:44 PM, vinicius...@gmail.com
mailto:vinicius...@gmail.com vinicius...@gmail.com
mailto:vinicius...@gmail.com wrote:

First of all, I'd like to thank you all. You're making a great job,
guys.
I see web2py becoming more reliable to bigger projects and I'm very
pleased with it.
You all rock! :-)

In spite of this huge effort, isn't it premature to call 2.0.2 or
even 2.0.3 stable? I know there were several months of hard work,
but if we have bugs detected so fast, we cannot call it stable yet,
right?

Maybe some release candidate call or a pre-release period for tests,
before spreading it as stable would help us.

--
Vinicius Assef


On 08/30/2012 05:49 PM, Massimo Di Pierro wrote:

All bugs reported today have been fixed in 2.0.3 out now (except
a minor
issue with markmin that we are investigating).

If you find other issues, please continue report them. We'd
rather fix
them sooner rather than later.

Thanks for all your help and testing.

Massimo



On Wednesday, 29 August 2012 22:41:34 UTC-5, Massimo Di Pierro
wrote:

 After 5 months. It is done. This is the most waited and the
most
 feature-packed release.

 I am sure we'll find some corners that need to be ironed
but it is
 considerably better than 1.99.7. It adds lot of new
features and
 improves many existing ones:

 - 57,000 new lines of code and closed 279 issues since 1.99.7.
 - Retrieving data from DB should be faster, in particular
 select(cacheable=True)
 - Has a new scheduler, a built-in wiki, new language and
 pluralization system, better markmin with oembed support
and better
 scaffolding app, increased security.
 - Lots of experimental features including GIS support, mongodb
 support, built-in auth.wiki(), and more.

 Should be 100% backward compatible. If you run into any
issue let us
 know ASAP.

 I personally want to thank the major contributors to this
release
 (in alphabetic order)
 Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic,
Iceberg,
 Jonathan, Marc, Mariano, Marin, Martin, Mark, Michael, Michele,
 Niphlod, Patrick, Vladyslav,
 They spend many nights testing, coding, debugging at a very
fast pace.

 Many many people have contributed.

 If your contribution has not been properly acknowledged
please let
 us know ASAP. It is probably an oversight.


 Massimo


 Detailed changelog
 ===

 ## 2.00.2

 ### DAL Improvements

 - Support for DAL(lazy_tables=True) and
 db.define_table(on_define=__lambda table:), thanks Jonathan
 - db(...).select(cacheable=True) make select 30% faster
 - db(...).select(cache=(cache.__ram,3600)) now caches
parsed data 100x
 faster
 - db(...).count(cache=(cache.__ram,3600)) now supported
 - MongoDB support in DAL (experimental), thanks Mark Breedveld
 - geodal and spatialite, thanks Denes and Fran (experimental)
 - db.mytable._before_insert, _after_insert, _before_update,
 _after_update, _before_delete. _after_delete (list of
callbacks)
 - db(...).update_naive(...) same as update but ignores
 table._before_update and table._after_update
 - DAL BIGINT support and DAL(...,bigint_id=True)
 - IS_IN_DB(..., distinct=True)
 - new syntax:
db.mytable.insert(__myuploadfield=open()), thank you
 Iceberg
 - db(...).select(db.mytable.__myfield.count(distinct=True))
 - db(db.a)._update

Re: [web2py] Customizing Auth

2012-08-31 Thread vinicius...@gmail.com

Your error is here:
(invalid syntax (20_auth_db.py, line 36))



On 08/31/2012 02:25 PM, Annet wrote:

|(invalid syntax (20_auth_db.py, line 36))|


--





Re: [web2py] Is 2.0.2 or 2.0.3 really a stable version?

2012-08-31 Thread vinicius...@gmail.com

+1

Again, note that I'm not against our team. I'm on it, too.

I'm not criticizing. I'm suggesting quality improvement.

--
Vinicius Assef



On 08/31/2012 11:07 AM, Richard Vézina wrote:

Hello,

I love web2py and normally I just wait a bit when there is new version
to make sure I don't spend to much time on version issue.

I also test de trunk once in a wild, but I found difficult to proceed
that way. 1) I don't have much time, 2) there is often little issue that
will be gone in a release that are actually artifact of development I
think. I mean, the developer know that there is most probably something
wrong with the new code he produce, but just can't test it in all situation.

For sure, tag a beta testing version before releasing could make more
work and struggle with version control to make sure patch spread over
all branch (trunk, beta), but I think it could be very good to have a
beta testing a week before stable.

Anyway, I don't have to much problem with the actual practices, but I
think beta test could had avoid 1.99.5 for example, since this version
has be the beta test version and 1.99.7 the final.

Richard

On Fri, Aug 31, 2012 at 9:49 AM, Anthony abasta...@gmail.com
mailto:abasta...@gmail.com wrote:

 Web2py has so much features and it is impossible to test everything.

Sorry, but I cannot agree with this statement. Is it the
official position?


Well, we can probably improve the unit test coverage. And there's
been recent talk of developing a test application to check against
for some functional testing. But as with any software (particularly
as complex as a web framework), it's not possible to test every
conceivable permutation of functionality a user might implement. We
have to rely on reports of bugs found in the wild to some extent.

Stable means: you can download and just use it. Anything
different
is almost stable or buggy yet or, using beautiful words,
release
candidate or pre-release version.


We had two (officially labeled) release candidates

(http://code.google.com/p/web2py/source/detail?r=ed41a29eb7c2e283587c141d0464b6c9be68eb0d).
Maybe we should change the Nightly Build label on the downloads
page to Release Candidate, and perhaps advertise a bit more. Not
sure it will help, though, as there were already many requests for
testers. What do you suggest?

Anthony

--




--





--





Re: [web2py] Re: web2py 2.0 stats

2012-08-29 Thread vinicius...@gmail.com

+1.

That's a big weakness in our beloved framework.
But, unfortunately, I cannot help with that. I've tried in the past, but 
it's difficult to follow pitch of new features.


--
Vinicius Assef


On 08/29/2012 02:32 PM, apps in tables wrote:

Examples and Self explanatory documentation will save you a lot
questions, specially from me:)

Ashraf

--





--





Re: [web2py] Best way to insert 200k records?

2012-08-17 Thread vinicius...@gmail.com

Maybe you can face transaction size problems with this volume.

Web2py, by default, just commits after a successful transaction. So, try 
to db.commit() after some transaction completion identification.


But I think processing time wouldn't be your problem.

--
Vinicius Assef



On 08/17/2012 08:50 AM, Mike Girard wrote:

Hello:

What is the prescribed method for doing large bulk inserts? I am using sqllite 
as my backend.

Is it ok to just write a Python script that talks to the db directly or should 
the DAL be used? The book says the bulk_insert method is not more advantageous 
than a for loop.

I searched this group for an answer but didn't find anything definitive.

Thanks.

PS Kudos to the web2py creator and contributors. Every day I am struck by how 
elegant, easy and well-designed it is.



--





Re: [web2py] Best way to insert 200k records?

2012-08-17 Thread vinicius...@gmail.com

I'd choose bulk_insert, but you should run some benchmarks, too.


On 08/17/2012 09:08 AM, Mike Girard wrote:

But what method should I use? Is there anything better than bulk_insert? 
Naturally I would like this to work as fast as possible.

Thanks.



--





Re: [web2py] Re: How do larger teams develop with Web2py?

2012-08-09 Thread vinicius...@gmail.com

I Agree. Good words.


On 08/09/2012 10:48 AM, Massimo Di Pierro wrote:

Listen everybody. This thread is hilarious but not very professional.

I think most of the people on this thread are hardcore programmers and
most of us came to some conclusions:
1) it is not the idea that has value, it is the execution
2) the success of a project is strongly correlated with the skills of
the programmers who work on it, the time and love they put in it.
3) it does not really matter how much money is put into a project, if
the programmers are not good, and if they do not care about the project,
it will not succeed.

Is there any value in management and or of software development methods?
I think there is. I am not saying which method is best because there is
not one size fits all but good programmers in my experience are self
disciplined. They follow a methodology to keep track of bugs and
systematically fix them. Their methodology may not exactly match named
ones (agile or waterfall or other) but it is a methodology.

Massimo

--





--





Re: [web2py] Re: How do larger teams develop with Web2py?

2012-08-09 Thread vinicius...@gmail.com

Luc, I don't see that.

Web2py allows your team to work colaboratively. We work this way in our 
company.


By the way, I'd say some characteristics enforce this separation. In 
Django, for example, you must have your routes planned and templates 
coded to allow programmers to work. Without them, you cannot see any 
running code.


In Web2py you can quick off immediately because you don't need to plan 
urls in advance and you have default views. This way, your frontend devs 
can be disconnected from your backend devs. Later, you can worry about 
standardized urls and don't change anything in your app.


We're working this way with great success.

--
Vinicius Assef


On 08/09/2012 01:25 PM, Luc Chase wrote:

Must admit site is funny; I almost bought the t-shirt.
I don't mean to imply any particular methodology (even though I do tend to
favour evolutionary, functional prototyping methods hence my interest in
Web2py).
I'm more interested in how larger web dev projects are affected (or not) by
the integrated nature of web2py, regardless of the dev methology used. Can
larger teams work collaboratively just as easily with web2py as with say
very lightweight frameworks (or perhaps more easily)?  My belief is that
they can, but it is only my belief.  There are some who say that the
architecture of web2py is likely to make it more difficult to separate the
concerns of the various team members.

--
Luc

On Wednesday, 8 August 2012 21:39:20 UTC+1, Luc Chase wrote:


What particular constraints and advantages does using web2py tend to bring
for larger project development teams as opposed to those working solo or in
very small teams?

I assume for example these roles benefit from rapid feedback and ability
to adjust requirements more easily?

- Project stakeholder (client or business owner)
- Project manager
- Producer
- Editor/copywriter
- Information architect
- Business-systems analyst
- Tech lead
- Database administrator
- Quality assurance engineer

But are these roles less-able or more-able to work in parallel?

- Graphic designer
- HTML developer
- Developer






--





[web2py] update_or_insert() inserting id=None

2012-08-08 Thread vinicius...@gmail.com

Hi folks.

I'm facing a problem with table.update_or_insert().

I have: my_tab.update_or_insert(my_tab.name==my_name, name=my_name, 
phone=my_phone)


When the search condition is not satisfied (i.e no records found) a new 
record with id=None is inserted in my_tab. The action is correct, but id 
shouldn't be None.


Am I doing something wrong or is it a bug?

--
Vinicius Assef

--





Re: [web2py] update_or_insert() inserting id=None

2012-08-08 Thread vinicius...@gmail.com

Thanks Richard. That's not necessary.

I just found out my sqlite table was corrupted. By some reason ID field 
was not created as autoincrement.


I dropped the table and recreated it. Now it's working fine.

Thank you.

--
Vinicius Assef


On 08/08/2012 11:35 AM, Richard Vézina wrote:

Open an issue on google code!

Which web2py version?

Richard

On Wed, Aug 8, 2012 at 10:10 AM, vinicius...@gmail.com
mailto:vinicius...@gmail.com vinicius...@gmail.com
mailto:vinicius...@gmail.com wrote:

Hi folks.

I'm facing a problem with table.update_or_insert().

I have: my_tab.update_or_insert(my___tab.name
http://my_tab.name==my_name, name=my_name, phone=my_phone)

When the search condition is not satisfied (i.e no records found) a
new record with id=None is inserted in my_tab. The action is
correct, but id shouldn't be None.

Am I doing something wrong or is it a bug?

--
Vinicius Assef

--




--





--





Re: [web2py] How do larger teams develop with Web2py?

2012-08-08 Thread vinicius...@gmail.com

It's not a Web2py question. It's a team management point.

As far as Web2py work with MVC (Django, Rails, etc. as well), all pros 
and cons apply here, too.


It's a matter of your workload approach. Maybe some reading in scrum or 
other management technique may help you.


--
Vinicius Assef


On 08/08/2012 05:39 PM, Luc Chase wrote:

What particular constraints and advantages does using web2py tend to
bring for larger project development teams as opposed to those working
solo or in very small teams?

I assume for example these roles benefit from rapid feedback and ability
to adjust requirements more easily?

  * Project stakeholder (client or business owner)
  * Project manager
  * Producer
  * Editor/copywriter
  * Information architect
  * Tech lead
  * Database administrator
  * Quality assurance engineer

But are these roles less-able or more-able to work in parallel?

  * Graphic designer
  * HTML developer
  * Developer

--





--





Re: [web2py] web2py 2.0 almost done

2012-08-07 Thread vinicius...@gmail.com


Is there a changelog?


On 08/07/2012 01:33 AM, Massimo Di Pierro wrote:

Web2py 2.0 is almost done.
Please try the nightly build.
Let us know if it breaks anything.

massimo

--





--





Re: [web2py] updating web2py src on live site and web2py shutdown/restart

2012-08-06 Thread vinicius...@gmail.com

You'll do this in a test environment before, right? ;-)


On 08/06/2012 01:37 PM, wdtatenh wrote:

I'm about to update the src code on a live site hosted by webfaction.
I'm assuming that web2py server must be stopped and restarted.

Web2py is running from the original installation script and has never
had to be shutdown before.  I've not gone through this on a live site
performing a manual shutdown/restart, so I appreciate anyone's
indulgence in this.

My question is what is the normal command line instruction for shutting
down and restarting web2py from the command line?
I'm assuming the basic steps involved here are:
1. Shutdown server
2. Upload new source to the web2py folder
3. restart server

Appreciate any input.  Thanks

--





--





Re: [web2py] Re: Giving a talk promoting web2py over Django

2012-08-02 Thread vinicius...@gmail.com
Massimo, about hot install applications, it's true just if you use 
default routes, right?


Or there's some way to do that using custom routes?

--
Vinicius Assef



On 08/01/2012 02:23 PM, Massimo Di Pierro wrote:

I really have nothing to add but some history.

I was a Django programmer (although never a Django contributor) and I
have developed web sites for the United Nations in Django. I have taught
Django here at DePaul University. I started web2py as a teaching because
I found the learning curve with Django was too steep. Moreover when
web2py was created Django was not the same as today. It did not have the
template escaping on by default (web2py did), it had a bug in CSRF
protection (web2py's one always worked), did not have migration (still
does not but now there is third party solution), did not support
multiple database connections (there was as Django fork but it took long
time to be merged), did not support multiple projects (web2py always
did), did not support left joins and aggregates (web2py always did).
Django always supported less database engine than web2py (and some not
very well, for example web2py generates better SQL code for pagination
in Oracle). Django always had and still has a more polised and
customizable admin (equivalent to web2py's appadmin) and a better
interface for many-to-many relations.

They are philosophically differences:
Django preferes explicit is better than implicit so you have do define
lots of boilerplate
web2py says do not repeat yourself so you have lots of
default behavior (magic?) but documented and backward compatible.

Other communities have used various arguments to criticize some web2py's
design decisions. All design decisions have pros and cons. Some of
the criticism has legs and some has not. What is important is that those
decisions were not motivated by ignorance but by carefully considering
the alternatives. As a result of those design decision web2py is the
only framework that allows hot install and uninstall of apps without
restarting the web server (with any web server) and supports multiple
projects under one web2py instance without library conflicts.

I also want to stress that our community is very friendly. We have
always shown great respect for other people's work and we have tried to
learn from them. We have taken ideas from Django, TG, Flask, etc and we
proudly acknowledged it.

Massimo




On Wednesday, 1 August 2012 11:55:32 UTC-5, Anthony wrote:

If it's a Django-friendly crowd, it might also be helpful to be
prepared to handle the inevitable criticisms that will come. The big
issues that tend to arise are (a) global objects/lack of
imports/lack of explicitness/too much magic, (b) use of exec, and
(c) pure Python in views. The links below address these and other
criticisms.

  * 
http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi

http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi?__snids__=28309519#ans341179
 (scroll
a bit for response to criticism by Jacob Kaplan-Moss, creator of
Django).
  * https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J
https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J
  * http://news.ycombinator.com/item?id=3767009
http://news.ycombinator.com/item?id=3767009
  * http://www.web2py.com/AlterEgo/default/show/271
http://www.web2py.com/AlterEgo/default/show/271
  * http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546

http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546
  * 
http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595

http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595
 (addressing
criticism of pure Python in views)

And a little support from Zed Shaw regarding magic:
https://twitter.com/zedshaw/status/80415443558477825
https://twitter.com/zedshaw/status/80415443558477825,
https://twitter.com/zedshaw/status/80418794526351360
https://twitter.com/zedshaw/status/80418794526351360

Anthony

On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:

Tonight I'm going to present my little social-network to a
user-group.

I'm going to show them my code, some slides, the website, the
mobile apps and tell them when Django isn't as good as web2py.

Are there any particular features of web2py you would recommend
I highlight? - Also, are there any major drawbacks in Django
that web2py has that is easily advertisable?

(I have a slide or two on this, but I'm sure as longtime
users/developers of web2py you'd have more to pitch-in)

Thanks for all information,

Alec Taylor

--





--





Re: [web2py] Re: Web2py site/app with several deily accesses

2012-08-02 Thread vinicius...@gmail.com

Could you tell us its url?


On 08/02/2012 01:27 PM, howesc wrote:

my largest project is servicing 2.5 million requests per day.  (API
calls and website views combined)
  - google app engine (big table)
  - modelless
  - medium use of memcache, slight use of google edge cache


On Wednesday, August 1, 2012 7:13:04 AM UTC-7, viniciusban wrote:

This question has been asked here from time to time, but always things
get up to date.

So, do you have some case using web2py to serve several (hundreds of
thousands, or millions) page hits a day?

What is your app architecture? Model based? Modelless?
What database do you use?

Tell us something about it.

--
Vinicius Assef

--





--





[web2py] Web2py site/app with several deily accesses

2012-08-01 Thread vinicius...@gmail.com
This question has been asked here from time to time, but always things 
get up to date.


So, do you have some case using web2py to serve several (hundreds of 
thousands, or millions) page hits a day?


What is your app architecture? Model based? Modelless?
What database do you use?

Tell us something about it.

--
Vinicius Assef

--





Re: [web2py] Giving a talk promoting web2py over Django

2012-08-01 Thread vinicius...@gmail.com

We2bpy strengths over Django:

1) Automatic migrations. It enforces baby steps design just 
out-of-the-box. South migrations is a powerful tool, but Django doesn't 
have it natively yet.
2) Web2py shows a generic template when you don't have one created. Yet, 
baby steps guaranteed.


I see these 2 as good features to Web2py newbies.


--
Vinicius Assef



On 08/01/2012 12:46 PM, Alec Taylor wrote:

Tonight I'm going to present my little social-network to a user-group.

I'm going to show them my code, some slides, the website, the mobile
apps and tell them when Django isn't as good as web2py.

Are there any particular features of web2py you would recommend I
highlight? - Also, are there any major drawbacks in Django that web2py
has that is easily advertisable?

(I have a slide or two on this, but I'm sure as longtime
users/developers of web2py you'd have more to pitch-in)

Thanks for all information,

Alec Taylor

--





--





Re: [web2py] Re: Visit Plugow on FISL13

2012-07-26 Thread vinicius...@gmail.com

We generate them using a Google API and read them using ZBar.

There are different modules in this totem. One of them is the Web2py 
part. Another is the ZBar thing.

They can be all in one machine or distributed among several ones.

But I'm not authorized to detail this implementation right now.
We'll have a presentation today on FISL, in Brazil. Maybe, after that I 
could tell you in deep details.


Keep in touch.

--
Vinicius Assef



On 07/26/2012 02:52 AM, Annet wrote:

Hi Vinicius,

I don't understand Portuguese, but it sounds like a interesting application.

I had a look at several ways to generate QRcodes, how do you generate them?
How exactly do you interact with them?

Kind regards,

Annet.

--





--





Re: [web2py] Re: Complex query with left outer join

2012-07-26 Thread vinicius...@gmail.com

Some suggestions, but I've not tested any of them:

1) Use timedelta(days=int(db.userCard.stage)) to convert your Field to int.

2) Split your query in 2 parts. The 2nd should use find() or exclude().

3) Use db.executesql() to insert your SQL statement.


--
Vinicius Assef



On 07/26/2012 12:23 PM, jw wrote:

Ok guys... I did step for step and now the query works for the stage
(progress).
The second thing (stage is multiplicator for time) I have no glue how to
move on.

cards2learn = db((db.groupCards.card_id == db.card.id) \
  (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \
  (session.chosenSubject_id == db.card.subject_id) \
  (db.userCard.card_id == db.card.id)
  (db.userCard.stage = 5) \
  (db.userCard.lastTimeLearned  (date.today() -
timedelta(days=(1
 ).select(db.userCard.ALL,db.card.ALL,db.groupCards.ALL,
left=db.userCard.on((db.userCard.card_id == db.card.id)))

timedelta(days=(1)) should be timedelta(days=(db.userCard.stage)) but it
says:


type 'exceptions.TypeError' unsupported type for timedelta
days component: Field


How do I use the db.userCard.stage in timedelta (stage is an integer
field in the table)?

Many thanks for the previous answers!

--





--





Re: [web2py] Re: Complex query with left outer join

2012-07-26 Thread vinicius...@gmail.com

I think you're right, @Niphlod.

I didn't note this.

@jw, tell us how you solved it, ok?

--
Vinicius Assef



On 07/26/2012 12:52 PM, Niphlod wrote:

Currently you'd have to code a view in the database (or simply a
string condition to pass on) to achieve that.

date.today() - timedelta(something) is a python fixed value that
doesn't get re-evaluated at runtime by the database substituting the
something for each value of every row.

If you need the structure to be portable and absolutely need to have a
single query fetching all of this, you need to change your db structure.

If you're going to run always on a fixed db engine you could write
something exploiting the functionalities of that db engine.

Remember that most of the times is easier (and the resources negligible)
to fetch rows from the db and filter them with python.

|
cards2learn =db((db.groupCards.card_id ==db.card.id http://db.card.id)\
(db.groupCards.studyGroup_id ==auth.user.studyGroup_id)\
(session.chosenSubject_id ==db.card.subject_id)\
(db.userCard.card_id ==db.card.id http://db.card.id)
(db.userCard.stage =5)\
# (db.userCard.lastTimeLearned  (date.today() - timedelta(days=(1
).select(db.userCard.ALL,db.

card.ALL,db.groupCards.ALL,left=db.userCard.on((db.userCard.card_id
==db.card.id http://db.card.id)))

cards2learn.exclude(lambdarow:row.usercard.lasttimelearned
request.now -timedelta(days=row.usercard.stage))

|





  should work. (totally untested)

On Thursday, July 26, 2012 5:23:51 PM UTC+2, jw wrote:

Ok guys... I did step for step and now the query works for the stage
(progress).
The second thing (stage is multiplicator for time) I have no glue
how to move on.

cards2learn = db((db.groupCards.card_id == db.card.id
http://db.card.id) \
  (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \
  (session.chosenSubject_id == db.card.subject_id) \
  (db.userCard.card_id == db.card.id http://db.card.id)
  (db.userCard.stage = 5) \
  (db.userCard.lastTimeLearned  (date.today() -
timedelta(days=(1
 ).select(db.userCard.ALL,db.card.ALL,db.groupCards.ALL,
left=db.userCard.on((db.userCard.card_id == db.card.id
http://db.card.id)))

timedelta(days=(1)) should be timedelta(days=(db.userCard.stage))
but it says:


type 'exceptions.TypeError' unsupported type for timedelta
days component: Field


How do I use the db.userCard.stage in timedelta (stage is an integer
field in the table)?

Many thanks for the previous answers!

--





--





Re: [web2py] Re: Empty Database value is not None, but an empty string

2012-07-25 Thread vinicius...@gmail.com

Sorry, but I cannot figure out why this is happening.

Here, my data becomes None if I do this. I'm using SQLite.
If you define a fresh new table in your db.py with just one string 
field, just using default configs, this problem still happens?


--
Vinicius Assef


On 07/25/2012 12:31 AM, Mark Li wrote:

Anthony, I tried

|
db.mytable.import_from_csv_file([file object],null='')
|

from the web2py shell, but it gave me an error:

OperationalError: near ): syntax error


In fact, trying to import from csv using the book's method does not work
at all, although exporting works fine.


Viniciusban, I'm inserting data through the database administation
interface (filling out the form). I've also tried importing the CSV file
through the administrative interface as well, where all blank spaces in
the csv some out to empty strings (unless the field type is 'integer').



On Monday, July 23, 2012 10:47:24 PM UTC-7, viniciusban wrote:

Yes, they are default settings.

It's quite strange you get empty strings instead null (None, in
Python).

How are you inserting data into db? Are you using a SQLFORM or
my_table.validate_and_insert() or simply mytable.insert()?

Do you get same results (blank values) inserting it from web2py shell
using simply mytable.insert()?

--
Vinicius Assef


 On Monday, July 23, 2012 5:58:19 PM UTC-4, Mark Li wrote:

 Aren't those the default values for a Field Contructor? I tried
 explicitly adding notnull=False and required=False, and didn't
 set the default property, but empty values still come out as an
 empty string instead of None.

 On Monday, July 23, 2012 2:48:56 PM UTC-7, viniciusban wrote:

 As far as I know, let notnull=False and required=False for 
your
 fields and don't set default property.



 On 07/23/2012 06:32 PM, Mark Li wrote:
  Unfortunately the lambda method didn't work, Anthony. Any other 
ideas
  for having a None default for empty entries?
 
 
  On a side note, if the 'integer' field type is used, then a 
blank entry
  results in a None. Don't know if that helps but it's something 
I've noticed.
 
  On Monday, July 23, 2012 2:07:51 PM UTC-7, Anthony wrote:
 
  To enter a value of None, this might work:
 
  |
  default=lambda:None
  |
 
  Anthony
 
  On Monday, July 23, 2012 5:04:44 PM UTC-4, Anthony wrote:
 
  default=None means that no default is specified, not 
that a
  default value of None will be inserted.
 
  Anthony
 
  On Monday, July 23, 2012 5:02:33 PM UTC-4, Mark Li 
wrote:
 
  I have a table defined in the following manner:
 
  db.define_table('songinfo',
  Field('songtitle'),
  Field('artist'))
 
  When I add an empty entry, or upload a CSV with 
empty
  values, I can only access those values with a 
database call like
 
  songs = db(db.songinfo.artist==).select()
 
  as opposed to db(db.songinfo.artist==None).select()
 
 
  The web2py book states that fields default=None, 
but I'm
  getting an empty string. Is there an appropriate 
way to have
  None instead of an empty string in the database?
 
 
  --
 
 
 

 --




--





--





Re: [web2py] Complex query with left outer join

2012-07-25 Thread vinicius...@gmail.com

timedelta syntax is timedelta(days=1)

On 07/25/2012 11:13 AM, jw wrote:

Hi,

my question is about the following query. I'm planning to program an
e-learning software. For this I use three tables to select the cards to
learn for today.
Table cards contains the question, userCard contains the progress
for the special student (lastTimeLearned as a multiplicator for the
calculating of the next time to learn), subject contains the name of
the subject and groupCard contains the answer for the special group.

groupCards = db((db.groupCards.card_id == db.card.id) \
  (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \
  (session.chosenSubject_id == db.card.subject_id)
  (db.userCard.stage = 5) \
  (db.userCard.lastTimeLearned  (datetime.date.today() -
datetime.timedelta(days=(1
 ).select(db.userCard.id,db.card.id,
left=db.userCard.on((db.userCard.card_id == db.card.id)))

I would like to select in this query all the cards for a specific
student in a choosen subject, with the answers of his learnGroup
(groupCard) and only the cards he doesn't learned today. I try to use
the left outer join, because there are cards, the user learns them for
the first time.
I tried many hours to find a correct query but now i feel desperate.

The other thing is the '1' in the timedelta. I get the exception, that
it is not allowed to use a field in timedelta.

Can somebody please help me?
P.S.: Sory for my english!

--





--





Re: [web2py] Re: Complex query with left outer join

2012-07-25 Thread vinicius...@gmail.com

Indeed, pbreit.

Did you check if your SQL query is correct?
print db._lastsql would help, too.

Baby steps, baby. Baby steps.

--
Vinicius Assef



On 07/25/2012 01:58 PM, pbreit wrote:

I don't really understand what you're trying to do but I would recommend
trying to simplify. First, you don't always need to do a join or a left
join. Try to figure out if those are really necessary. For example, do
you really need to join the questions and the progress or can you
retrieve those separately? Second, you're only selecting for two fields.
That may be OK but I would suggest selecting for all fields (ie, delete
db.userCard.id,db.card.id, from select()). If you want to optimize
*after* you get it working, then you can do so. Third, working with
datetime and DB can be difficult. Try to get the query working before
adding a timedate query component.

When I build a complex query, I start with one query, make it work, then
add a query, make it work, and so on.

--





--





Re: [web2py] BR()

2012-07-25 Thread vinicius...@gmail.com

No, you cannot.

On 07/25/2012 02:18 PM, Lucas R. Martins wrote:

You also can use {{=BR()*5}}  or {{=ANYTHING()*5}}

Em Qua 25 Jul 2012 13:51:38 BRT, Toby Shepard escreveu:

In my own html generating libraries, I normally allow
an integer argument to the BR maker, which is a count
of how many tags to put out. So:

{{=BR(5)}}

could output BRBRBRBRBR

This works out since the BR tag can't have any components
anyway.

Just a thought. I find it useful at times.

Tobiah






--





[web2py] Visit Plugow on FISL13

2012-07-25 Thread vinicius...@gmail.com
Plugow is a totem developed by our team, at Agencia X4, using Python and 
web2py.


It integrates several techologies like webcam, qrcode, social networks 
(twitter and fb) and youtube.
We're on FISL 13 [1] (International Free Software Forum, 13th edition) 
in Brazil.


If you understand Portuguese, see it: http://labs.agenciax4.com.br/fisl13
BTW, this hotsite is powered by web2py, too. ;-) I has been our main web 
technology for about a year, now.



[1] http://softwarelivre.org/fisl13

--
Vinicius Assef

--





Re: [web2py] BR()

2012-07-25 Thread vinicius...@gmail.com

They don't work. Output is escaped.

Try it out.

--
Vinicius Assef


On 07/25/2012 03:40 PM, Anthony wrote:

Though you can do:

|
{{=BR().xml()*5}}
|

or

|
{{=str(BR())*5}}
|

Anthony

On Wednesday, July 25, 2012 1:23:37 PM UTC-4, viniciusban wrote:

No, you cannot.

On 07/25/2012 02:18 PM, Lucas R. Martins wrote:
 You also can use {{=BR()*5}}  or {{=ANYTHING()*5}}

 Em Qua 25 Jul 2012 13:51:38 BRT, Toby Shepard escreveu:
 In my own html generating libraries, I normally allow
 an integer argument to the BR maker, which is a count
 of how many tags to put out. So:

 {{=BR(5)}}

 could output BRBRBRBRBR

 This works out since the BR tag can't have any components
 anyway.

 Just a thought. I find it useful at times.

 Tobiah




--





--





Re: [web2py] BR()

2012-07-25 Thread vinicius...@gmail.com

You cannot, too.

I've tested. The correct way is: {{=XML(str(BR())*5)}}




On 07/25/2012 04:09 PM, Derek wrote:

Ok, how about {{=(BR()*5).XML()}}

On Wednesday, July 25, 2012 11:53:05 AM UTC-7, viniciusban wrote:

They don't work. Output is escaped.

Try it out.

--
Vinicius Assef


On 07/25/2012 03:40 PM, Anthony wrote:
 Though you can do:

 |
 {{=BR().xml()*5}}
 |

 or

 |
 {{=str(BR())*5}}
 |

 Anthony

 On Wednesday, July 25, 2012 1:23:37 PM UTC-4, viniciusban wrote:

 No, you cannot.

 On 07/25/2012 02:18 PM, Lucas R. Martins wrote:
  You also can use {{=BR()*5}}  or {{=ANYTHING()*5}}
 
  Em Qua 25 Jul 2012 13:51:38 BRT, Toby Shepard escreveu:
  In my own html generating libraries, I normally allow
  an integer argument to the BR maker, which is a count
  of how many tags to put out. So:
 
  {{=BR(5)}}
 
  could output BRBRBRBRBR
 
  This works out since the BR tag can't have any components
  anyway.
 
  Just a thought. I find it useful at times.
 
  Tobiah
 
 
 

 --




--





--





Re: [web2py] Re: Visit Plugow on FISL13

2012-07-25 Thread vinicius...@gmail.com

Sure, Massimo.

You go to http://labs.agenciax4.com.br/fisl13 , log in with your twitter 
or fb and get a QRCode.
After that, you head to our totem, show your qrcode (what identifies you 
on it) and record a video.
This video is converted and uploaded to our youtube account with your 
name on it and your timeline is updated with video address. So, your 
followers (and friends) click on it and watch your published video.


Besides that, our totem is used to entertainment, interacting via 
qrcodes. Eash screen is a web2py page, running in a firefox with some 
plugins to show it in kiosk mode. They play music, video or show images 
and/or text pages.


Our core app is based fully on web2py. Our server and its interaction 
with totem, too.

So, it is.

If you're gathering local cases to present in Python Brazil Conference, 
we're available and we live in Rio.


--
Vinicius Assef



On 07/25/2012 06:18 PM, Massimo Di Pierro wrote:

Can you tell us more hat it does?

On Wednesday, 25 July 2012 12:36:46 UTC-5, viniciusban wrote:

Plugow is a totem developed by our team, at Agencia X4, using Python
and
web2py.

It integrates several techologies like webcam, qrcode, social networks
(twitter and fb) and youtube.
We're on FISL 13 [1] (International Free Software Forum, 13th edition)
in Brazil.

If you understand Portuguese, see it:
http://labs.agenciax4.com.br/fisl13
http://labs.agenciax4.com.br/fisl13
BTW, this hotsite is powered by web2py, too. ;-) I has been our main
web
technology for about a year, now.


[1] http://softwarelivre.org/fisl13 http://softwarelivre.org/fisl13

--
Vinicius Assef

--





--





Re: [web2py] Template security

2012-07-25 Thread vinicius...@gmail.com
It will be as safe as you care about it. But, surely it is not a good 
practice.


Even web2py's views having the power to use full python code, you should 
separate your app in layers. You should place, as far as it is possible, 
just presentation logic in views.
Exceptions happen. And full Python power are there for them. But, use it 
with care.


--
Vinicius Assef


On 07/25/2012 07:33 PM, Babak wrote:

Of course *I* like Python code. But what about giving access to the
templates/views where we do not want to grant access to the internals of
the server via system calls. ie,

{{
import os
os.popen('...')
}}

Can this be safer?

--





--





Re: [web2py] Unit Testing Database Best Practices

2012-07-23 Thread vinicius...@gmail.com

+1

On 07/23/2012 11:40 AM, Richard Vézina wrote:

I am interesting in what will come out of this thread...

But, to me I think your last question on fact that database will have
undertermined set of data mean that you maybe not validate your app base
on the entries of the database but on a testing database with a set of
known data, that you can even charge on need for the test. Also, you
will just test the limit with data that will for example help to
demonstrate that a field type is appropriately defined to get all type
of data you intend to put in in. Count, if variable get creates, etc.,
is more in the basic thing you can always check for every function...

I am also pretty new to unit test in general and have most the same
questions.

Cheers!

Richard


On Sun, Jul 22, 2012 at 9:41 PM, Mark Li markruole...@gmail.com
mailto:markruole...@gmail.com wrote:

I'm fairly new to test-driven development and have decided it is the
best way to go for my new webapp. While functional tests with
selenium seem to be more straightforward (as far as what the tests
want to accomplish), I'm lost on what unit tests for the database
should test for.

For example, if I have a database table with columns id, 'dogowner',
and 'dogname', and have a controller returning a dict with
'dogowners', what should I be testing in the unit tests for the
database and controller?

The database table will be fixed with a limited number of 'dogowner'
entries, about 10, so should I be testing whether the database has
10 entries, and if the len of the dict returned by the controller is
10? This datatable may not be fixed in the future, so what
functionality of the database would I be testing for?



I'm following http://www.web2py.com/AlterEgo/default/show/260 , but
while that page explains HOW to go about unit testing, it doesn't
explain what I should be testing for. Anyone experienced with TDD in
web2py want to point me in the right direction? Thanks in advance!

--




--





--





Re: [web2py] Logic check in View, to check if auth.user.group_id...

2012-07-23 Thread vinicius...@gmail.com
If your doubt is about view syntax, it's just the way you outlined, with 
a few changes.


1) Change {{T(...)}} by {{=T(...)}}
2) Close the else with {{PASS}}

Always remember web2py views can have normal Python code. But don't 
overuse it, ok?


--
Vinicius Assef


On 07/23/2012 02:55 PM, Alec Taylor wrote:

I'm confused at how I'm meant to do logic checks, e.g. with a test-case
model:

auth.settings.extra_fields['auth_user']=  [Field('member_of',  'list:reference 
db.group_of_events',  requires=IS_IN_DB(db,  db.group_of_events,  
'%(group_name)s',  multiple=True))]

db.define_table(
 'group_of_events',
 Field('group_name',  notnull=True,  requires=[IS_SLUG(),  IS_NOT_IN_DB(db, 
 'group_of_events.group_name')]),
 format='%(group_name)s'
)

And I want to do a check like this in the View:

{{if  thisgroupidin  request.auth_user.member_of:}}
# BTW: I already have the variable: `thisgroupid`
{{T('Welcome back Mr member!')}}
{{else:}}
{{T('Become a member')}}

*How do I perform the aforementioned check in a web2py view?*
*
*
Thanks for all information,

Alec Taylor

--





--





Re: [web2py] Re: Empty Database value is not None, but an empty string

2012-07-23 Thread vinicius...@gmail.com
As far as I know, let notnull=False and required=False for your 
fields and don't set default property.




On 07/23/2012 06:32 PM, Mark Li wrote:

Unfortunately the lambda method didn't work, Anthony. Any other ideas
for having a None default for empty entries?


On a side note, if the 'integer' field type is used, then a blank entry
results in a None. Don't know if that helps but it's something I've noticed.

On Monday, July 23, 2012 2:07:51 PM UTC-7, Anthony wrote:

To enter a value of None, this might work:

|
default=lambda:None
|

Anthony

On Monday, July 23, 2012 5:04:44 PM UTC-4, Anthony wrote:

default=None means that no default is specified, not that a
default value of None will be inserted.

Anthony

On Monday, July 23, 2012 5:02:33 PM UTC-4, Mark Li wrote:

I have a table defined in the following manner:

db.define_table('songinfo',
Field('songtitle'),
Field('artist'))

When I add an empty entry, or upload a CSV with empty
values, I can only access those values with a database call like

songs = db(db.songinfo.artist==).select()

as opposed to db(db.songinfo.artist==None).select()


The web2py book states that fields default=None, but I'm
getting an empty string. Is there an appropriate way to have
None instead of an empty string in the database?


--





--





Re: [web2py] Re: Empty Database value is not None, but an empty string

2012-07-23 Thread vinicius...@gmail.com

Yes, they are default settings.

It's quite strange you get empty strings instead null (None, in Python).

How are you inserting data into db? Are you using a SQLFORM or 
my_table.validate_and_insert() or simply mytable.insert()?


Do you get same results (blank values) inserting it from web2py shell 
using simply mytable.insert()?


--
Vinicius Assef



On Monday, July 23, 2012 5:58:19 PM UTC-4, Mark Li wrote:

Aren't those the default values for a Field Contructor? I tried
explicitly adding notnull=False and required=False, and didn't
set the default property, but empty values still come out as an
empty string instead of None.

On Monday, July 23, 2012 2:48:56 PM UTC-7, viniciusban wrote:

As far as I know, let notnull=False and required=False for your
fields and don't set default property.



On 07/23/2012 06:32 PM, Mark Li wrote:
 Unfortunately the lambda method didn't work, Anthony. Any other ideas
 for having a None default for empty entries?


 On a side note, if the 'integer' field type is used, then a blank 
entry
 results in a None. Don't know if that helps but it's something I've 
noticed.

 On Monday, July 23, 2012 2:07:51 PM UTC-7, Anthony wrote:

 To enter a value of None, this might work:

 |
 default=lambda:None
 |

 Anthony

 On Monday, July 23, 2012 5:04:44 PM UTC-4, Anthony wrote:

 default=None means that no default is specified, not that a
 default value of None will be inserted.

 Anthony

 On Monday, July 23, 2012 5:02:33 PM UTC-4, Mark Li wrote:

 I have a table defined in the following manner:

 db.define_table('songinfo',
 Field('songtitle'),
 Field('artist'))

 When I add an empty entry, or upload a CSV with empty
 values, I can only access those values with a database 
call like

 songs = db(db.songinfo.artist==).select()

 as opposed to db(db.songinfo.artist==None).select()


 The web2py book states that fields default=None, but I'm
 getting an empty string. Is there an appropriate way to 
have
 None instead of an empty string in the database?


 --




--





--





Re: [web2py] The Mystery of the Hidden View

2012-07-22 Thread vinicius...@gmail.com

Your d.html view must certainly be located in /your_app/views/group/ dir.

What do you want exactly to achieve?
What is really happening?

--
Vinicius Assef


On 07/22/2012 02:49 PM, Alec Taylor wrote:

My `group` controller located at: /social/controllers/group.py, has a
view located at: /social/views/group/d.html.

For the event page (routed off group), I am calling a function with an
argument.

Unfortunately I can't seem to find where I can overwrite its default view.

I've tried: /social/views/group/event_page.html,
/social/views/group/event_page/index.html and:
/social/views/event_page/index.html.

# /social/controllers/group.py
def  d():
 group=  db(db.group_of_events.group_name==  request.args(0)).select()  or  
redirect(URL('',  'groups'))
 events=  db(db.event.group_id==  group[0].id).select()
 if  request.args(1):
 return  event_page({'foo':'bar'})
 return  dict(group=group,  events=events,  eventpage=eventpage)

def  event_page(eid):
 eventpage={'foo':'bar'}
 return  dict(eventpage=eventpage)


*Where do I place my replacement view?*

Thanks for all suggestions,

Alec Taylor

--





--





Re: [web2py] web2py.com offline

2012-07-20 Thread vinicius...@gmail.com

Bruno, how many pageviews a day?

On 07/20/2012 03:40 PM, Bruno Rocha wrote:


Well, I think web2py.com http://web2py.com and web2pyslices.com
http://web2pyslices.com needs a better hosting solution.


On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com
mailto:davidramsayreinh...@gmail.com wrote:

can't get to the website today.

--




--





--





Re: [web2py] Re: Accessing non-returned items in Views

2012-07-18 Thread vinicius...@gmail.com

We know locals() fits well in this situation.

But I am working in a system develop returning locals() from all 
controllers. It's a pain to discover where things are defined and if a 
change in a controller (ie. killing some unused variables) will or not 
affect that view. Mainly the bigger ones.


It's good to be explicit whenever possible.

So, I wouldn't lay on returning locals() everywhere. I'd rather 
return(dict1=dict1, dict2=dict2, ...) in this simple situation with few 
variables.


--
Vinicius Assef



On 07/17/2012 06:50 PM, adohertyd wrote:

Simple as that :) thanks Massimo Web2py is fantastic

On Tuesday, 17 July 2012 22:45:48 UTC+1, Massimo Di Pierro wrote:

replace

return dict(ReturnedDict=OtherDict)

with

return locals()

On Tuesday, 17 July 2012 16:40:00 UTC-5, adohertyd wrote:

In my function page2(): I return a dictionary to be accessed by
the page2 HTML view. In the page2 function I have some other
dictionaries. What I want to do to be able to use the
non-returned dictionaries in the HTML code to show some items.
This is a sample of what I want: Hope it's clear

|
defpage2():


Dict1={key1:{keyA:value,keyB:value,keyC:value}
Dict2={key2:{keyD:value,keyE:value,keyF:value}

OtherDict={key:value,key:value...}

returndict(ReturnedDict=OtherDict)
|


|
page2.html:


ul
{{forx inReturnedDict:}}
{{ifx inDict1:}}
li{{=Dict1[x]['keyA']}}{{=Dict1[x]['keyB']/li
{{elifx inDict2:}}
li{{=Dict2[x]['keyD']}}{{=Dict2[x]['keyE']/li
{{pass}}
/ul
|


--





--





Re: [web2py] Re: Making a field non-editable, but writable using SQLFORM

2012-07-17 Thread vinicius...@gmail.com

Maybe Massimo's ideia can work for you.

But don't be afraid to count on custom forms. They give us much more power.



On 07/17/2012 12:37 PM, Massimo Di Pierro wrote:

Doesn't

db.table.field.writable = False
db.table.field.default = 'whatever'

do what you want?

On Thursday, 16 June 2011 13:05:34 UTC-5, JayShaffstall wrote:

I have a situation where I need to adjust an SQLFORM field to be
non-editable.  I can do that with .writable = False, but that seems to
also prevents database I/O for that field.  What I'm trying to do is
set a default that cannot be changed.

Is there a way to set an SQLFORM field so that it appears as a label
on the form itself, but is still writable for the database?

For reference, I'm doing this with a field in the form returned by
auth.register, so I cannot insert code between the form creation and
the accepts call.  I believe I'm restricted to working with the model
before calling auth.register, or by using custom forms.

Jay

--





--





Re: [web2py] Web2py using json

2012-07-08 Thread vinicius...@gmail.com

Let's break the scenario in 2 parts.

1) How will you send it to web2py?

a) As a query string via HTTP GET encapsulated in only one param
b) As several params, using a standard query string
c) Via HTTP POST
d) Other (tell us):


2) The web2py part is easy because it's Python, anyway. Just use json 
Python module: http://docs.python.org/library/json.html


--
Vinicius Assef


On 07/07/2012 02:47 AM, Akash Kakkar wrote:

Hi,

I want to send string content (html) from client to server using JSON
and then decode the JSON to string in python controller, Can somebody
help me with the syntax.

Thanks
Akash




Re: [web2py] Re: Web2py - internet explorer - admin login fails - http://127.0.0.1:8000/....

2012-07-08 Thread vinicius...@gmail.com

What was the solution?

On 07/08/2012 01:38 PM, wdtatenh wrote:

OK - now it's working - thanks for the tips.

On Sunday, July 8, 2012 9:21:45 AM UTC-4, Massimo Di Pierro wrote:

Does it ask you for the admin password?

On Sunday, 8 July 2012 07:44:46 UTC-5, wdtatenh wrote:

Thanks - tried it didn't work... even removed the tail and
started with http://.localhost:8000







Re: [web2py] please help us test web2py

2012-07-06 Thread vinicius...@gmail.com

Could you, please, tell us what should be tested?

What has changed?

By the way, what is salt password? I searched dictionary, but didn't 
find a good translation. Sorry my poor English.


--
Vinicius Assef


On 07/06/2012 01:52 AM, Massimo Di Pierro wrote:

There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL
please help us check the new trunk did not break anything.

We have salted password auth = Auth(...,salt=True). Check it out.

We also have ability to deploy to openstack from admin.

Thanks to all those who have and still are putting lots of time on this.

massimo




Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread vinicius...@gmail.com

Short answer: manually.

You cannot connect (join or make a relation) fields among different 
databases.




On 07/06/2012 02:16 PM, Horus wrote:

Yes I understand CAS is for central auth, so i have let the cas provider
be the app that takes care of login, registration, signup, what have
you; as it should
the tables are being created, so I am assuming that the other apps
should be able to access the tables if they exist all in the same database.

The underlying question, as I had added.
*
how does web2py perform multiple database information exchange?*


On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote:

Well CAS is for central authentication, not for sharing database
tables ... . The error you got simply says that your second app cant
see tables from cas provider app.





Re: [web2py] Select with text field

2012-07-06 Thread vinicius...@gmail.com

How much data (in KB ou MB) are loaded into these text fields?

Could you show us your model file where you execute this define_table()? 
(aka db.py)




On 07/06/2012 02:04 PM, Marcello Parra wrote:

I'm not using executesql...

I'm trying just:

query = q_processos.select()


It seems to load all data from database...




On Fri, Jul 6, 2012 at 12:40 PM, Richard Vézina
ml.richard.vez...@gmail.com mailto:ml.richard.vez...@gmail.com wrote:

Are you running this request as raw SQL with executesql??

http://web2py.com/books/default/chapter/29/6#executesql

If your request is slow at backend level, maybe you have a problem
with your design...

What is your backend?

Richard


On Fri, Jul 6, 2012 at 11:12 AM, Marcello Parra parro...@gmail.com
mailto:parro...@gmail.com wrote:

Hello, Richard,


I save 2 HTML pages.

SELECT processo.id http://processo.id, processo.na
http://processo.na, processo.na_limpo, processo.nu
http://processo.nu, processo.nu_limpo, processo.html,
processo.html1, processo.processado, processo.processado2,
processo.processado_dia, processo.origem, processo.classe,
processo.fase, processo.assunto, processo.instancia,
processo.json, processo.conferido, processo.autuado_dia,
processo.orgao_julgador, processo.relator, processo.autor,
processo.reu, processo.advs, processo.autor1, processo.reu1,
processo.acompanhando_dia, processo.encerrado_dia,
processo.vara, processo.numero_origem,
processo.ultimo_andamento_dia, processo.ultimo_andamento,
processo.sentenca, processo.sentenca_dia, processo.sentenca_crc,
processo.1_crc, processo.2_crc, processo.enviado_dia,
processo.created_at FROM processo WHERE (processo.encerrado_dia
IS NULL);


One solution is select just the fields I need and not the TEXT
ones...

But I found that should be an easier way


Thanks...




On Fri, Jul 6, 2012 at 10:30 AM, Richard Vézina
ml.richard.vez...@gmail.com
mailto:ml.richard.vez...@gmail.com wrote:

What the nature of the data in size?

Could you show us your select statment?

Richard


On Fri, Jul 6, 2012 at 8:41 AM, Marcello parro...@gmail.com
mailto:parro...@gmail.com wrote:

Hello all,

I have a table with two text fields.
I'm trying to make a select with about 7,000 records in
a console.
My memory goes up, until full, and then the process is
killed

If I comment those text fields in the table definition
and try again, it run the select without problem.

In the select, I don't use those fields

What cat I do to solve this ??


Thanks
Marcello









Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread vinicius...@gmail.com

That's a good question, Horus. :-/

I haven't tried that. Theoretically, db_cas.base_tags field could be 
referenced because it needs the db object.


Let us know about your progress on it.

--
Vinicius Assef



On 07/06/2012 03:40 PM, Horus wrote:

Right viniciusban i agree. i don't want to perform joins across
databases explicitly i have never seen that in SQL
BUT I can use the user id from the CAS provider to refer to other tables
in a database

let's say the *CAS* provider has this table called *auth_user* with a
field called *id*.
let's say I have another app called *APP1* with a table
called*user_exams* with a field called *user_id*

To make a relationship I can manually get the id from the auth_user
table (db.auth_user)
and then apply it to the user_exams.

the *CAS* provider contains this table

db.define_table('base_tags',
 Field('name', 'string', label='Tag', length=64,
required=True, notnull=True),
 format='%(name)s'
 )

*APP1* contains a this table

db.define_table('places_tags',
 Field('place_id', db_app1.places, label='Place',
required=True, notnull=True, writable=False, readable=False),
 Field('tag_id', *db_cas.base_tags*, label='Tag',
required=True, notnull=True, writable=False, readable=False)
 )

*Are you saying that Web2Py will not get id from base tags and make that
relationship?*



On Friday, July 6, 2012 1:56:47 PM UTC-4, viniciusban wrote:

Short answer: manually.

You cannot connect (join or make a relation) fields among different
databases.



On 07/06/2012 02:16 PM, Horus wrote:
 Yes I understand CAS is for central auth, so i have let the cas provider
 be the app that takes care of login, registration, signup, what have
 you; as it should
 the tables are being created, so I am assuming that the other apps
 should be able to access the tables if they exist all in the same 
database.

 The underlying question, as I had added.
 *
 how does web2py perform multiple database information exchange?*


 On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote:

 Well CAS is for central authentication, not for sharing database
 tables ... . The error you got simply says that your second app cant
 see tables from cas provider app.






Re: [web2py] Customizing Auth to work with legacy db app

2012-07-05 Thread vinicius...@gmail.com

Hi Jerry.

You can define a db object to connect just to your auth table on MS SQL.
This way, you can customize Auth to your needs.

Remember web2py, by default, store passwords crypted (see CRYPT 
validator). If it's not your scenario, you'll need to override this 
implementation.


A few months ago I needed to customize Auth. I inherited from the 
original and implemented my own methods like loging user in without 
password (in a very special situation), and registering them making 
integration with other tables.


By the way, you'll need to check if the web2py RBAC is enough for you. 
Maybe you'll have to make it use tables used today by your legacy system.


So, I recommend you to customize Auth and enjoy all web2py 
authentication and authorization infrastructure.


--
Vinicius Assef



On 07/05/2012 06:04 PM, Jerry wrote:

Hello,

We have a legacy Cold Fusion app running off a MS SQL db server and plan
to gradually move functionality from CF to web2py.
Both systems will run concurrently, accessing the same db.
Thanks to the web2py (awesome piece of software! thank you Massimo and
the other contributors!) DAL, we can access the legacy database no problem.

The db has a User table with fields like:
FirstName, LastName, Email, Password etc.
The field names do not match the names used in web2py
auth.settings.table_user_name (first_name, last_name, email, passwd etc.)

We would love to use web2py Auth for login/register/profile forms,
decoration of controller actions with @auth, and handling password resets.

It looks like there will be a lot of customization of the Auth settings
to get it to work with our legacy database.
The only alternative I can think of is not using Auth at all. Everything
custom - our own login form, register page, password reset - and we
don't get @auth. decorators.

What would you recommend? I'm guessing this has been done before but I
haven't found a solution.
Is there another way of doing this that makes more sense?

Thanks in advance,

Jerry.




Re: [web2py] conditional models requires check if table already exists for db admin to work

2012-07-03 Thread vinicius...@gmail.com

Use this pattern below everywhere you define a table:

if not 'mytable' in db.tables:
db.define_table('mytable', ...)

I always use it.

--
Vinicius Assef



On 07/03/2012 07:33 AM, selecta wrote:

In my project I use conditional models since I have a lot of tables.
However I have a problem since one of the database tables (defined in a
conditional model) has to be defined in another conditional model
here an example
/models/plugin_restapidoc/plugin_restapidoc.py
/models/wizard/wizard.py
/models/wizard/plugin_restapidoc.py

plugin_restapidoc.py contains the same table definition,
the table is used in the wizard and in the plugin_restapidoc controller
this works fine, but fails when i call the db appadmin

my workaround so far is
models/db.py:
PLUGIN_RESTAPIDOC_DEFINED = False
/models/plugin_restapidoc/plugin_restapidoc.py:
PLUGIN_RESTAPIDOC_DEFINED = True
/models/wizard/plugin_restapidoc.py:
if PLUGIN_RESTAPIDOC_DEFINED:
   define table ...
I wonder if there is a better solution, e.g. one without
the PLUGIN_RESTAPIDOC_DEFINED variable
e.g.
if db.tables.has_key('plugin_restapidoc_table'):
   define table ...
or even better a fix in the appadmin




Re: [web2py] DAL : fill with zeroes a specific field before insert / update

2012-07-02 Thread vinicius...@gmail.com
Remember requires property is not used when you just insert(), 
update() or update_record().


So, in Web2py you don't have anything like a db trigger. You could do it 
using a custom validator like CLEANUP() and using validate_and_insert() 
or validate_and_update() in substitution of regular insert() or update().




On 07/02/2012 10:08 AM, Santiago wrote:

Hello,

I have a field defined as below :

Field('id_indra', length=5, label=T('ID Indra'), notnull=False,
requires=[REQUIRED, MAX_5, IS_MATCH(r'^[a-zA-Z0-9]{5}$')])

Is it is possible to intercept all inserts / updates over this field and
do a zfill() before the accion takes place? So, if the field is '5',
they it would be completed with zeroes with a result of '5' before
insert / update.

Thanks in advance

Regards,
Santiago




Re: [web2py] web2pyslices seems to be down

2012-07-01 Thread vinicius...@gmail.com

It's up and running here, in Brazil.

On 07/01/2012 08:36 AM, Jose C wrote:

Just starting on a project and been trying to access web2pyslices.com
occasionally.  It's been returning 504 errors since Friday (since I
started on this project).  Does anyone know if this site is still active
or who is responsible for it?




Re: [web2py] Alter SQLFORM.factory generated form to put tag into a table

2012-06-28 Thread vinicius...@gmail.com
Richard, wouldn't be better organizing your form direct in HTML using 
custom.form tags?



On 06/28/2012 01:00 PM, Richard Vézina wrote:

Forget the precedent email... I think I found how, it didn't work the
first time I try, so I just put everything into string, maybe I had
problem with a comma...

 inputs_list = []
 for a in field1_names_dict:

inputs_list.append(Field(field1_names_dict[a]['field1_name']+'_f1',
type='boolean', widget=SQLFORM.widgets.checkboxes.widget,
requires=IS_EMPTY_OR(IS_IN_SET([assay_names_dict[a]['field1_name_ui']]

inputs_list.append(Field(field1_names_dict[a]['field1_name']+'_f2',
db.ref_tab1, requires = IS_EMPTY_OR(IS_IN_DB(db,'ref_tab1.id
http://ref_tab1.id','%(REPRESENTFIELD)s'

inputs_list.append(Field(field1_names_dict[a]['field1_name']+'_f3',
db.ref_tab2, requires = IS_EMPTY_OR(IS_IN_DB(db,'ref_tab2.id
http://ref_tab2.id','%(REPRESENTFIELD)s'

I I just have to add the formstyle in the SQLFORM.factory call :

form = SQLFORM.factory(*inputs_list, formstyle='divs')

On Thu, Jun 28, 2012 at 11:47 AM, Richard Vézina
ml.richard.vez...@gmail.com mailto:ml.richard.vez...@gmail.com wrote:

Hello Anthony,

If I don't use eval(), should I use web2py dummy table, I don't see
how I will be able to build dummy table dynamically and declare it
as inputs_list to be use with the asterisk... If I just put a
asterisk in front of my actual generated inputs_list it not working
since the item in the list are text. I don't see how I can insert
Field into the list without generating them as strings...

I will read a bit the links you sent.

Thanks.

Richard


On Thu, Jun 28, 2012 at 11:29 AM, Anthony abasta...@gmail.com
mailto:abasta...@gmail.com wrote:

I wounder what should be the best way to alter a form
generated by SQLFORM.factory in a way where fields will be
placed into a html table a 3 columns.

So each 3 fields I need to insert a tr and each field need
to be in a td...


You might want to create a custom form layout in the view:
http://web2py.com/books/default/chapter/29/7#Custom-forms. That
way you can still use SQLFORM.factory to handle all the widget
creation and processing, but you can present the fields however
you want. You might also check out plugin_solidform
http://dev.s-cubism.com/plugin_solidform.

 formstring = SQLFORM.factory( +','.join(inputs_list)+)

 form = eval(formstring)


No need to eval code like that in Python. If you have a list of
objects you want to submit as separate args to a function, just
precede the list with an asterisk:

|
form =SQLFORM.factory(*input_list)
|

In that case, you can change the way you define the Field items
in the list -- make them actual Field() objects rather than just
strings of code.

Note, for keyword arguments, you can submit a dictionary
preceded by two asterisks:

|
some_function(**some_dictionary)
|

Anthony







[web2py] How to change a form.vars.field value after validation?

2012-06-27 Thread vinicius...@gmail.com

Hi guys.

I'm facing a problem I didn't find a pure web2py solution.

I have a SQLFORM.factory() with some fields, including one captcha field.
Every time the form is showed, the input captcha field must be empty. 
The form may have error in other fields and the captcha could be filled 
right, but a new one is generated every time the form is showed. As 
password fields, the captcha must be always presented empty to the user.


So, I tried to do form.vars.captcha = '' just before my return 
dict(form=form), but the value user filled in keeps showing.

I also tried playing with form.request_vars.captcha but unsuccessfull again.

I found a workaround hardcoding the INPUT tag in my view, instead of 
{{=form.custom.widget.captcha}} as I usually do with other fields.


Does anybody has any suggestion about it? How to change a 
form.vars.field value after validation?


I think a custom validator would solve my problem. But I think it 
shouldn't be necessary in a so simple cenario.


--
Vinicius Assef


Re: [web2py] How to change a form.vars.field value after validation?

2012-06-27 Thread vinicius...@gmail.com

Here it is: http://pastebin.com/2zMNYWnX



On 06/27/2012 05:20 PM, Richard Vézina wrote:

Would you show you SQLFORM.factory code?

Richard

On Wed, Jun 27, 2012 at 4:14 PM, vinicius...@gmail.com
mailto:vinicius...@gmail.com vinicius...@gmail.com
mailto:vinicius...@gmail.com wrote:

Hi guys.

I'm facing a problem I didn't find a pure web2py solution.

I have a SQLFORM.factory() with some fields, including one captcha
field.
Every time the form is showed, the input captcha field must be
empty. The form may have error in other fields and the captcha could
be filled right, but a new one is generated every time the form is
showed. As password fields, the captcha must be always presented
empty to the user.

So, I tried to do form.vars.captcha = '' just before my return
dict(form=form), but the value user filled in keeps showing.
I also tried playing with form.request_vars.captcha but
unsuccessfull again.

I found a workaround hardcoding the INPUT tag in my view, instead
of {{=form.custom.widget.captcha}__} as I usually do with other fields.

Does anybody has any suggestion about it? How to change a
form.vars.field value after validation?

I think a custom validator would solve my problem. But I think it
shouldn't be necessary in a so simple cenario.

--
Vinicius Assef






Re: [web2py] How to change a form.vars.field value after validation?

2012-06-27 Thread vinicius...@gmail.com

Yes, I was rendering {{=form.custom.widget.captcha}} in my view.

Why is this strange?



On 06/27/2012 05:58 PM, pbreit wrote:

Wow, that is some strange code.

What does your view code look like? How are you rendering the captcha
widget?





Re: [web2py] Amazon EC2 discussion

2012-04-30 Thread vinicius...@gmail.com

We use it. We're happy, but the app doesn't have high traffic.

As far as I see in real cases, AWS is a great place to host. I'm 
planning to make a new migration to their platform next month.



On 04/30/2012 06:55 AM, lucas wrote:

hello one and all,

i am curious about using a cloud, like Amazon EC2. i don't know anything
about it. but i am curious. i have always setup my own server and run,
but my needs have changed for more media and the throughput of my
internet will be challenged if i try to host my server locally. so i am
thinking of off-sighting it.

i am very used to CentOS, and free version of Redhat Enterprise, and the
current version of v6.x lets the web2py install script run flawlessly
without all kinds of package dependency issues and cross issues. does
Amazon EC2 allow me to install or have my own CentOS 6.x install?

if amazon EC2 allows that centos 6.x install, then i can easily install
web2py, and postgresql 9.x, and apache and run my own server off-site.
does anyone foresee me having issues if i can do that at all?

thanx in advance and i look forward to your experienced opinions. lucas


Re: [web2py] Amazon EC2 discussion

2012-04-30 Thread vinicius...@gmail.com

We deploy using git pull.



On 04/30/2012 01:33 PM, Massimo Di Pierro wrote:

I have only used it long ago. It was clumsy and slow to deploy. I found
there are other web hosts that use EC2 infrastructure but provide better
interfaces and management tools. Although I never tried any of them.

On Monday, 30 April 2012 09:45:17 UTC-5, viniciusban wrote:

We use it. We're happy, but the app doesn't have high traffic.

As far as I see in real cases, AWS is a great place to host. I'm
planning to make a new migration to their platform next month.


On 04/30/2012 06:55 AM, lucas wrote:
  hello one and all,

  i am curious about using a cloud, like Amazon EC2. i don't know
anything
  about it. but i am curious. i have always setup my own server and
run,
  but my needs have changed for more media and the throughput of my
  internet will be challenged if i try to host my server locally. so
i am
  thinking of off-sighting it.

  i am very used to CentOS, and free version of Redhat Enterprise,
and the
  current version of v6.x lets the web2py install script run flawlessly
  without all kinds of package dependency issues and cross issues. does
  Amazon EC2 allow me to install or have my own CentOS 6.x install?

  if amazon EC2 allows that centos 6.x install, then i can easily
install
  web2py, and postgresql 9.x, and apache and run my own server
off-site.
  does anyone foresee me having issues if i can do that at all?

  thanx in advance and i look forward to your experienced opinions.
lucas