Re: [web2py] Re: Web2py MVC and Qooxdoo

2011-10-20 Thread Phyo Arkar
I have not dig into JSON RPC of web2py and qooxdoo yet ,

Thank you soo much for giving me.

I will try to replace with JSON RPC.

Can you also list me advantages?

Thanks.

Phyo.

On 10/20/11, omicron  wrote:
> Why not jsonrpc ?
>
> In web2py, i use decorator like this :
> @service.jsonrpc
> def insert(code, libelle, cours=1.0):
> try:
> id = dba.devise.insert(code=code, libelle=libelle)
> except:
> dba.rollback()
> raise Exception(sys.exc_info()[1])
> else:
> dba.commit()
> return int(id)
>
> And with QooxDoo :
> var rpc = new qx.io.remote.Rpc('/myapp/devise/call/jsonrpc');
> rpc.addListener('completed', function(e) {
> var id = e.getData().result;
>   ...
> this.close();
> }, this);
> rpc.addListener('failed', function(e) {
> alert("Erreur RPC: " + e.getData().message);
> });
> rpc.callAsyncListeners(true, 'insert', this.code.getValue(),
> this.libelle.getValue());
>
>
>
> On 20 oct, 00:16, Phyo Arkar  wrote:
>> Here it is.
>>
>> Check it out.
>>
>> http://code.google.com/p/herspos
>>
>> :)
>>
>> On 10/20/11, Phyo Arkar  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Yes,
>>
>> > I was writing a POS application for my wife's sushi shop as a practice
>> > . I am enjoyingQooXDooA Lot now.
>>
>> > Its unfinished but already usable for adding Items and record. You
>> > will get whole idea.
>>
>> > Now i am going to Release it as Opensource, so Everyone can use and
>> > contribute too.
>>
>> > I am uploading to googlecode now.
>>
>> > Thanks
>>
>> > Phyo.
>>
>> > On 10/18/11, wwwgong  wrote:
>> >> Hi Phyo,
>> >> I have exactly the same question as yours when you first started this
>> >> thread 1 month ago.
>> >> can you share your working sample withqooxdooand web2py integration?
>> >> I am interested in usingQooxdoofor custom UI in front of web2py.
>> >> Thanks,
>> >> Wen
>>
>> >> my email=wen.g.g...@gmail.com
>>
>> >> On Sep 19, 3:31 pm, Phyo Arkar  wrote:
>> >>> yeah , how abt retrofittingQooxdoointo pyjamas? it should work. It
>> >>> will be easier. Then introduce it into web2py how thats soudns? I only
>> >>> tested pyjamas a bit.
>>
>> >>> after coding mnore and more inQooxdoo,I realize jquery-UI main
>> >>> weakness is making user depending on html and css , and selectors.
>> >>> Actually that wont work for application style UIs.
>>
>> >>> why i like about  qooxdoois i never (really never) have to look back
>> >>> at html and CSS at all. another main point is as i am a java hater ,
>> >>> even thoqooxdoocode is much like java its still in javascript so its
>> >>> a lot easier.And not like GWT it dont need java to do anything at all
>> >>> just python to generate and compile code :) .
>>
>> >>> On 9/20/11, Ross Peoples  wrote:
>>
>> >>> > I have been looking atqooxdooas a replacement for jQuery UI for
>> >>> > quite
>> >>> > a
>> >>> > while, since they seem to have a nice set of widgets. I don't know
>> >>> > why
>> >>> > it
>> >>> > takes the jQuery UI team over a year to make a menubar widget
>> >>> > (that's
>> >>> > still
>> >>> > not finished), when you could probably write your own high-quality
>> >>> > version
>> >>> > in a couple of days. That is the one thing that really bugs me about
>> >>> > jQuery
>> >>> > UI: the seemingly stagnent development pace. I understand that
>> >>> > things
>> >>> > like
>> >>> > accessibility take a little more time, but other frameworks (and
>> >>> > even
>> >>> > individuals) can crank out new widgets in no time that are sometimes
>> >>> > higher
>> >>> > quality than the jQuery UI ones. (end rant)
>>
>> >>> > Anyways, as you mentioned, web2py is focused more on traditional
>> >>> > HTML.
>> >>> >Qooxdooseems to generate its own HTML based on the JavaScript code
>> >>> > you
>> >>> > enter (like with desktop programming). It seems more like an AJAX
>> >>> > application builder rather than an HTML additive, like jQuery.
>> >>> > Before
>> >>> > coming
>> >>> > to web2py, I evaluated Vaadin, which is a Java server/client
>> >>> > integrated
>> >>> > framework that is built on Google Web Toolkit (like pyjamas is).
>> >>> > Only
>> >>> > you
>> >>> > program everything in Java. It's pretty powerful and the widgets
>> >>> > were
>> >>> > the
>> >>> > best I've ever seen (quite a lot of them too). The only problem with
>> >>> > it
>> >>> > though is that trying to do something that would be simple with HTML
>> >>> > and
>> >>> > JavaScript would require you to make your own widget and recompile
>> >>> > the
>> >>> > entire widget set. It was great for working inside the box, but way
>> >>> > too
>> >>> > difficult if you wanted to step outside the box.
>>
>> >>> > Enough with the babbling: what we would need to do is make
>> >>> > aqooxdoohelper
>> >>> > that can generate JS code for the widgets. However, it might just be
>> >>> > easier
>> >>> > for everyone to write their own JavaScript, since it's well
>> >>> > documented
>> >>> > on
>> >>> > theqooxdoosite. As for the AJAX communications, according to
>> >>> 

Re: [web2py] Re: Qooxdoo + Web2py Based AJAX POS system, Released!

2011-10-20 Thread Phyo Arkar
Qooxdoo is very fast for me. What browser you use? and ur PC Specs?
to change table size it just need to put inside resizable pane. and
they will be resizable.
I will separate two tables in different tabs , they shouldn't be
inside one page i guess.

On 10/20/11, greenpoise  wrote:
> ah ok..got it..I have never tried or didnt know anything about qooxdoo
> as a matter of fact. I like it but for some reason is slow in my
> browser..scrolling that is.. the tables are such a treat for a
> backoffice perspective...can these tables size can be change, like
> their width??
>
>
>
>
> On Oct 19, 4:34 pm, Phyo Arkar  wrote:
>> Oh you dont need to login , login is not read yet i forget to add that :D
>>
>> On 10/20/11, Phyo Arkar  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > our restaurant just opened 2 months ago , and no shes not using any
>> > POS Software , registering by hand, She started using this POS this
>> > week,. It was just 2 week of coding in my free time . I am busy with
>> > other projects .
>>
>> > I am going to put more features .
>>
>> > The feature she requested right now is to make filtering work by date
>> > and items (1st priority :D) .
>> > i am going to get it work tomorrow. if you guys have any idea feel
>> > free to suggest :) .
>>
>> > On 10/20/11, greenpoise  wrote:
>> >> Cool. Is your wife currently using a POS?? we are currently using
>> >> Microsoft Dynamics RMS and wow..what a battle it has been..
>>
>> >> On Oct 19, 4:26 pm, Phyo Arkar  wrote:
>> >>> its hard to make it configurable , i don't know how to pass variable
>> >>> from Qooxdoo to web2py thats why i need to hard-code it. coz qooxdoo
>> >>> is totally js and web2py's template code wont work inside JS files.
>>
>> >>> One thing is to pass via url-string is that acceptable ?
>>
>> >>> On 10/20/11, greenpoise  wrote:
>>
>> >>> > Got ya..thanks..will do..
>>
>> >>> > d
>>
>> >>> > On Oct 19, 4:19 pm, Phyo Arkar  wrote:
>> >>> >> rename it to HersPOS (URL is hardcoded).
>>
>> >>> >> On 10/20/11, greenpoise  wrote:
>>
>> >>> >> > Mine does not show anything. I did as pbreit said, under /herspos
>> >>> >> > but
>> >>> >> > nothing.
>>
>> >>> >> > On Oct 19, 4:14 pm, Phyo Arkar  wrote:
>> >>> >> >> upper toolbar buttons not working yet , i forgot to mention
>> >>> >> >> that.
>>
>> >>> >> >> On 10/20/11, Phyo Arkar  wrote:
>>
>> >>> >> >> > ok i will make a w2p release.
>> >>> >> >> > I will also make it configurable.
>> >>> >> >> > You guys feel free to clone. modify what you feel needed.
>> >>> >> >> > I had tested on chrome and firefox on linux and firefox on
>> >>> >> >> > windows
>> >>> >> >> > ,
>> >>> >> >> > can you give me the firebug output or chrome devtool output ?
>>
>> >>> >> >> > On 10/20/11, greenpoise  wrote:
>> >>> >> >> >> Neat,thanks for sharing. I download it havent checked out.
>> >>> >> >> >> Can
>> >>> >> >> >> you
>> >>> >> >> >> package it so users can install?
>>
>> >>> >> >> >> d
>>
>> >>> >> >> >> On Oct 19, 3:24 pm, Phyo Arkar 
>> >>> >> >> >> wrote:
>> >>> >> >> >>> Hello Web2py.
>>
>> >>> >> >> >>> As a practice for integrating Qooxdoo and web2py. I had
>> >>> >> >> >>> created
>> >>> >> >> >>> a
>> >>> >> >> >>> Point of Sales system for my wife's sushi shop.
>>
>> >>> >> >> >>> All people who have trouble integrating Qooxdoo, can base on
>> >>> >> >> >>> my
>> >>> >> >> >>> code.
>> >>> >> >> >>> It used multiple Qooxdoo features .
>>
>> >>> >> >> >>> - Tables
>> >>> >> >> >>> - Folder Trees
>> >>> >> >> >>> - Events
>> >>> >> >> >>> - Event Bubbling
>> >>> >> >> >>> - Delegates
>> >>> >> >> >>> - Custom Class
>> >>> >> >> >>> - AJAX
>> >>> >> >> >>> - Datastore and controllers
>> >>> >> >> >>> - Remote Table
>>
>> >>> >> >> >>> Now i decided to release it as opensource. Please check :
>>
>> >>> >> >> >>>http://code.google.com/p/herspos/
>> >>> >> >> >>> ---
>>
>> >>> >> >> >>> HersPOS
>>
>> >>> >> >> >>> Web2py + Qooxdoo based resturant POS . Feel feel to use and
>> >>> >> >> >>> contribute!
>> >>> >> >> >>> Started for my wife's Sushi Restaurant, and as a practice
>> >>> >> >> >>> for
>> >>> >> >> >>> Qooxdoo
>> >>> >> >> >>> framework , integrating with web2py.Now avaliable for
>> >>> >> >> >>> everyone.This
>> >>> >> >> >>> project is not completed yet, but mostly functional.
>>
>> >>> >> >> >>> Features :
>>
>> >>> >> >> >>> - Full application UI powered by Qooxdoo
>>
>> >>> >> >> >>> - AJAX View of item records using Qooxdoo table.
>>
>> >>> >> >> >>> - AJAX View of sales records.
>>
>> >>> >> >> >>> - Add new sales record.
>>
>> >>> >> >> >>> - Add new items.
>>
>> >>> >> >> >>> - Totals summary.
>>
>> >>> >> >> >>> Todo :
>>
>> >>> >> >> >>> - Sorting
>>
>> >>> >> >> >>> - Filter by date (Clicking on left tree)
>>
>> >>> >> >> >>> - Filtering by items (Clicking on left tree)
>>
>> >>> >> >> >>> - Editing records


[web2py] Re: Error: Start as Windows Service

2011-10-20 Thread omicron
And if you change ip = '0.0.0.0' and comment the line 'interfaces' ?

On 20 oct, 08:36, toan75  wrote:
> Yes, i renamed options_std.py to options.py.
>
> import socket
> import os
>
> ip = '192.168.0.1'
> port = 80
> interfaces=[('0.0.0.0',80),('0.0.0.0',443,'ssl_private_key.pem','ssl_certif 
> icate.pem')]
> password = ''  # ##  means use the previous password
> pid_filename = 'httpserver.pid'
> log_filename = 'httpserver.log'
> profiler_filename = None
> #ssl_certificate = 'ssl_certificate.pem'  # ## path to certificate file
> #ssl_private_key = 'ssl_private_key.pem'  # ## path to private key file
> #numthreads = 50 # ## deprecated; remove
> minthreads = None
> maxthreads = None
> server_name = socket.gethostname()
> request_queue_size = 5
> timeout = 30
> shutdown_timeout = 5
> folder = os.getcwd()
> extcron = None
> nocron = None


[web2py] Re: Web2py MVC and Qooxdoo

2011-10-20 Thread omicron
Wikipedia is you friend http://en.wikipedia.org/wiki/JSON-RPC
and read this http://manual.qooxdoo.org/1.5.x/pages/communication/rpc.html

On 20 oct, 09:47, Phyo Arkar  wrote:
> I have not dig into JSON RPC of web2py and qooxdoo yet ,
>
> Thank you soo much for giving me.
>
> I will try to replace with JSON RPC.
>
> Can you also list me advantages?
>
> Thanks.
>
> Phyo.
>
> On 10/20/11, omicron  wrote:
>
>
>
>
>
>
>
> > Why not jsonrpc ?
>
> > In web2py, i use decorator like this :
> > @service.jsonrpc
> > def insert(code, libelle, cours=1.0):
> >     try:
> >         id = dba.devise.insert(code=code, libelle=libelle)
> >     except:
> >         dba.rollback()
> >         raise Exception(sys.exc_info()[1])
> >     else:
> >         dba.commit()
> >         return int(id)
>
> > And with QooxDoo :
> > var rpc = new qx.io.remote.Rpc('/myapp/devise/call/jsonrpc');
> > rpc.addListener('completed', function(e) {
> >     var id = e.getData().result;
> >    ...
> >     this.close();
> > }, this);
> > rpc.addListener('failed', function(e) {
> >     alert("Erreur RPC: " + e.getData().message);
> > });
> > rpc.callAsyncListeners(true, 'insert', this.code.getValue(),
> > this.libelle.getValue());
>
> > On 20 oct, 00:16, Phyo Arkar  wrote:
> >> Here it is.
>
> >> Check it out.
>
> >>http://code.google.com/p/herspos
>
> >> :)
>
> >> On 10/20/11, Phyo Arkar  wrote:
>
> >> > Yes,
>
> >> > I was writing a POS application for my wife's sushi shop as a practice
> >> > . I am enjoyingQooXDooA Lot now.
>
> >> > Its unfinished but already usable for adding Items and record. You
> >> > will get whole idea.
>
> >> > Now i am going to Release it as Opensource, so Everyone can use and
> >> > contribute too.
>
> >> > I am uploading to googlecode now.
>
> >> > Thanks
>
> >> > Phyo.
>
> >> > On 10/18/11, wwwgong  wrote:
> >> >> Hi Phyo,
> >> >> I have exactly the same question as yours when you first started this
> >> >> thread 1 month ago.
> >> >> can you share your working sample withqooxdooand web2py integration?
> >> >> I am interested in usingQooxdoofor custom UI in front of web2py.
> >> >> Thanks,
> >> >> Wen
>
> >> >> my email=wen.g.g...@gmail.com
>
> >> >> On Sep 19, 3:31 pm, Phyo Arkar  wrote:
> >> >>> yeah , how abt retrofittingQooxdoointo pyjamas? it should work. It
> >> >>> will be easier. Then introduce it into web2py how thats soudns? I only
> >> >>> tested pyjamas a bit.
>
> >> >>> after coding mnore and more inQooxdoo,I realize jquery-UI main
> >> >>> weakness is making user depending on html and css , and selectors.
> >> >>> Actually that wont work for application style UIs.
>
> >> >>> why i like about  qooxdoois i never (really never) have to look back
> >> >>> at html and CSS at all. another main point is as i am a java hater ,
> >> >>> even thoqooxdoocode is much like java its still in javascript so its
> >> >>> a lot easier.And not like GWT it dont need java to do anything at all
> >> >>> just python to generate and compile code :) .
>
> >> >>> On 9/20/11, Ross Peoples  wrote:
>
> >> >>> > I have been looking atqooxdooas a replacement for jQuery UI for
> >> >>> > quite
> >> >>> > a
> >> >>> > while, since they seem to have a nice set of widgets. I don't know
> >> >>> > why
> >> >>> > it
> >> >>> > takes the jQuery UI team over a year to make a menubar widget
> >> >>> > (that's
> >> >>> > still
> >> >>> > not finished), when you could probably write your own high-quality
> >> >>> > version
> >> >>> > in a couple of days. That is the one thing that really bugs me about
> >> >>> > jQuery
> >> >>> > UI: the seemingly stagnent development pace. I understand that
> >> >>> > things
> >> >>> > like
> >> >>> > accessibility take a little more time, but other frameworks (and
> >> >>> > even
> >> >>> > individuals) can crank out new widgets in no time that are sometimes
> >> >>> > higher
> >> >>> > quality than the jQuery UI ones. (end rant)
>
> >> >>> > Anyways, as you mentioned, web2py is focused more on traditional
> >> >>> > HTML.
> >> >>> >Qooxdooseems to generate its own HTML based on the JavaScript code
> >> >>> > you
> >> >>> > enter (like with desktop programming). It seems more like an AJAX
> >> >>> > application builder rather than an HTML additive, like jQuery.
> >> >>> > Before
> >> >>> > coming
> >> >>> > to web2py, I evaluated Vaadin, which is a Java server/client
> >> >>> > integrated
> >> >>> > framework that is built on Google Web Toolkit (like pyjamas is).
> >> >>> > Only
> >> >>> > you
> >> >>> > program everything in Java. It's pretty powerful and the widgets
> >> >>> > were
> >> >>> > the
> >> >>> > best I've ever seen (quite a lot of them too). The only problem with
> >> >>> > it
> >> >>> > though is that trying to do something that would be simple with HTML
> >> >>> > and
> >> >>> > JavaScript would require you to make your own widget and recompile
> >> >>> > the
> >> >>> > entire widget set. It was great for working inside the box, but way
> >> >>> > too
> >> >>> > difficult if you wanted to step outs

[web2py] Re: new features and new book sections/chapters

2011-10-20 Thread kesh
hey Robin
am also just loving the new web2py.where can i get the docs for the new 
features please share the link



[web2py] Re: join and sum - display in view

2011-10-20 Thread Anthony
You can do

sum(r.t_table.f_field for r in rows)


On Thursday, October 20, 2011 1:27:02 AM UTC-4, andrej burja wrote:
>
> in controler i do join and sum
> the result si rows object
> in response._vars the sum is displayed in
> SUM(t_table.f_field)
>
> what is the syntax to display that in view?
>
> andrej
>


[web2py] Re: join and sum - display in view

2011-10-20 Thread Anthony
Wait, do you mean that you did the sum as part of the select? What exactly 
did you return to the view (the whole Rows object), and how do you want to 
display the results? In general, you would access the sum "field" like 
rows[row_number]['SUM(t_table.f_field)']. Note, you can also assign the sum 
to a variable prior to the select and then use the variable name to access 
the sum from the Rows object -- 
see http://web2py.com/book/default/chapter/06#belongs (sum is discussed 
right after belongs).

On Thursday, October 20, 2011 1:27:02 AM UTC-4, andrej burja wrote:
>
> in controler i do join and sum
> the result si rows object
> in response._vars the sum is displayed in
> SUM(t_table.f_field)
>
> what is the syntax to display that in view?
>
> andrej
>


[web2py] Best way to toggle db migration on production server?

2011-10-20 Thread Cliff
I have migrate=False on my production server.

Any thoughts on the best way to toggle migrate to True, then
immediately back when upgrading the model?

As the application and user base grow I don't want to be manually
editing table defs every time I change the model.


Re: [web2py] Re: join and sum - display in view

2011-10-20 Thread Martín Mulone
FROM THE BOOK

Previously, you have used the count operator to count records. Similarly,
you can use the sum operator to add (sum) the values of a specific field
from a group of records. As in the case of count, the result of a sum is
retrieved via the store object:

1.
2.
3.

>>> sum = db.log.severity.sum()
>>> print db().select(sum).first()[sum]
6

Expression can be combined to form more complex expressions. For example
here we are computing the sum of the length of all the servery strings in
the logs, increased of one:

1.
2.

>>> sum = (db.log.severity.len()+1).sum()
>>> print db().select(sum).first()[sum]


2011/10/20 Anthony 

> Wait, do you mean that you did the sum as part of the select? What exactly
> did you return to the view (the whole Rows object), and how do you want to
> display the results? In general, you would access the sum "field" like
> rows[row_number]['SUM(t_table.f_field)']. Note, you can also assign the
> sum to a variable prior to the select and then use the variable name to
> access the sum from the Rows object -- see
> http://web2py.com/book/default/chapter/06#belongs (sum is discussed right
> after belongs).
>
>
> On Thursday, October 20, 2011 1:27:02 AM UTC-4, andrej burja wrote:
>
>> in controler i do join and sum
>> the result si rows object
>> in response._vars the sum is displayed in
>> SUM(t_table.f_field)
>>
>> what is the syntax to display that in view?
>>
>> andrej
>>
>


-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: join and sum - display in view

2011-10-20 Thread andrej burja
controller:

def person():
sum = db.t_payement.f_value.sum()
rows= 
db().select(db.t_person.f_name,db.t_person.f_surname,db.t_person.f_city, 
sum, groupby=db.t_person.id,
left=db.t_payement.on(db.t_person.id==db.t_payement.f_person)) 
return dict(rows=rows)

view:

{{=TR(TD(row.t_person.f_name,' ',row.t_person.f_surname),TD())}}

i want to display sum of payments for each person 
in headers of table ({{=BEAUTIFY(response._vars)}}) in default view this is 
shown as
SUM(t_payement.f_value)






[web2py] error pages with proper status code

2011-10-20 Thread Grzegorz Śliwiński
Currently it's quite impossible to maintain custom error pages for
HTTP 404 and still keep the proper response code

If we redirect with routes_onerror we can get every error page dressed
in overall page layout, but the response code is 200 OK, which isn't
very good.

If we do not redirect, we could always set the body when raising 404
errors, but then you'd have to define routes for every controller and
action and direct catch all pattern to controller::action responsible
just for raising HTTP 404 error.

is there any solution to this problem, or plans on fixing it?


[web2py] Re: join and sum - display in view

2011-10-20 Thread andrej burja
it si probably something starting with
row._extra
because rows object starts with
, 't_person': 



Re: [web2py] smartgrid setup

2011-10-20 Thread Manuele

On 20/10/2011 07:43, petrasadi wrote:

Is it possible to set custom levels of access for view, edit and
delete functions of the smartgrid?
For example, can I allow all users to access "View", but only
authenticated user to access "Edit"?
Thank you
what about to calculate the proper boolean value of grid properties 
based on the user roles and use it in the grid itself? I mean something like



def foo():
if auth.user_group=='':
editable=True
else:
editable=False
form=SQLFORM.grid(, eiditable=editable)
return dict(form=form)

Manuele


[web2py] Re: join and sum - display in view

2011-10-20 Thread Anthony
Try

TD(row[sum])

or

TD(row['SUM(t_payement.f_value)'])

Anthony

On Thursday, October 20, 2011 8:04:27 AM UTC-4, andrej burja wrote:
>
> controller:
>
> def person():
> sum = db.t_payement.f_value.sum()
> rows= 
> db().select(db.t_person.f_name,db.t_person.f_surname,db.t_person.f_city, 
> sum, groupby=db.t_person.id,
> left=db.t_payement.on(db.t_person.id==db.t_payement.f_person)) 
> return dict(rows=rows)
>
> view:
>
> {{=TR(TD(row.t_person.f_name,' ',row.t_person.f_surname),TD())}}
>
> i want to display sum of payments for each person 
> in headers of table ({{=BEAUTIFY(response._vars)}}) in default view this is 
> shown as
> SUM(t_payement.f_value)
>
>
>
>
>

[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Anthony
db=DAL(..., migrate_enabled=True|False) enables or disables migrations 
completely, for the entire db. See the end of this 
section: http://web2py.com/book/default/chapter/06#Migrations.

On Thursday, October 20, 2011 7:52:34 AM UTC-4, Cliff wrote:
>
> I have migrate=False on my production server. 
>
> Any thoughts on the best way to toggle migrate to True, then 
> immediately back when upgrading the model? 
>
> As the application and user base grow I don't want to be manually 
> editing table defs every time I change the model.



[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Cliff
Anthony, thanks for the pointer.

What I'm looking for is some hint about how I can check if the model
is at the latest and greatest level.

Something like this:

def  some_function_to_see_if_we_need_to_migrate():
 ## code goes here
## ??

migrate_enabled = some_function_to_see_if_we_need_to_migrate()
db=DAL(...migrate_enabled=migrate_enabled)

Maybe the answer is in the sql.log file.

Once I figure it out I'll share my answer.

On Oct 20, 8:49 am, Anthony  wrote:
> db=DAL(..., migrate_enabled=True|False) enables or disables migrations
> completely, for the entire db. See the end of this
> section:http://web2py.com/book/default/chapter/06#Migrations.
>
>
>
> On Thursday, October 20, 2011 7:52:34 AM UTC-4, Cliff wrote:
>
> > I have migrate=False on my production server.
>
> > Any thoughts on the best way to toggle migrate to True, then
> > immediately back when upgrading the model?
>
> > As the application and user base grow I don't want to be manually
> > editing table defs every time I change the model.


[web2py] Re: Tell Web2py Groups: The Web2py Book 3rd Edition is long over due

2011-10-20 Thread Massimo Di Pierro

The web2py 4th ed is almost ready. Problem is that we keep addi
features...and we need to decide on new welcome layout or we cannot
make screenshots

The packt book is in the hands of the publisher.

Both book shout be available berofe christmas

On Oct 19, 2:16 pm, joseph simpson  wrote:
> Just checking on the current state of the Web2py online book update as well
> as the rumored "Packt Web2py book."
>
> Any new projected release dates?
>
> Have fun,
>
> Joe
>
>
>
>
>
> On Tue, Sep 27, 2011 at 7:00 AM, Jim Steil  wrote:
> > +1 for keeping in the book format.  Definitely helped attract me to Web2py.
>
> >    -Jim
>
> > On 9/26/2011 10:18 PM, Andrew wrote:
>
> >> I was actually qutie impressed with the book-like docs when I first
> >> saw them.  It gives the framework a polished, professional feel (I
> >> think).  I say keep it, but I'm all for keeping it up to date, in line
> >> with new functionality being released in the stable version.
>
> >> I'm also hanging out for an update with all of the new features.
>
> >> On Sep 27, 3:29 pm, pbreit  wrote:
>
> >>> I wonder if we could benefit from docs that are more dynamic and less
> >>> book-like? I'm not totally enamored with Sphinx, though.
>
> --
> Joe Simpson
>
> Sent From My DROID!!


[web2py] comparing datatime Fields

2011-10-20 Thread Web2Py Freak
Dear All ,

i have a table called events which looks like this :

db.define_table('events',Field('title'),Field('description','text'),Field('datetime','datetime',default=request.now,readable=False,writable=False))


and in my default/events.html  i want to get the event the the
datetime in it is less that now , am trying to do it like this  :

events=db(db.event.datetime > request.now ).select(db.events.ALL)


but its not working , do you have any idea how to do it ??


Best reagards,
Hassan alnatour


[web2py] Re: Qooxdoo + Web2py Based AJAX POS system, Released!

2011-10-20 Thread Massimo Di Pierro

Where can we see it in action?

On Oct 19, 5:24 pm, Phyo Arkar  wrote:
> Hello Web2py.
>
> As a practice for integrating Qooxdoo and web2py. I had created a
> Point of Sales system for my wife's sushi shop.
>
> All people who have trouble integrating Qooxdoo, can base on my code.
> It used multiple Qooxdoo features .
>
> - Tables
> - Folder Trees
> - Events
> - Event Bubbling
> - Delegates
> - Custom Class
> - AJAX
> - Datastore and controllers
> - Remote Table
>
> Now i decided to release it as opensource. Please check :
>
> http://code.google.com/p/herspos/
> ---
>
> HersPOS
>
> Web2py + Qooxdoo based resturant POS . Feel feel to use and contribute!
> Started for my wife's Sushi Restaurant, and as a practice for Qooxdoo
> framework , integrating with web2py.Now avaliable for everyone.This
> project is not completed yet, but mostly functional.
>
> Features :
>
> - Full application UI powered by Qooxdoo
>
> - AJAX View of item records using Qooxdoo table.
>
> - AJAX View of sales records.
>
> - Add new sales record.
>
> - Add new items.
>
> - Totals summary.
>
> Todo :
>
> - Sorting
>
> - Filter by date (Clicking on left tree)
>
> - Filtering by items (Clicking on left tree)
>
> - Editing records


[web2py] Re: error pages with proper status code

2011-10-20 Thread Massimo Di Pierro

Open a ticket this may be a bug


On Oct 20, 7:05 am, Grzegorz Śliwiński  wrote:
> Currently it's quite impossible to maintain custom error pages for
> HTTP 404 and still keep the proper response code
>
> If we redirect with routes_onerror we can get every error page dressed
> in overall page layout, but the response code is 200 OK, which isn't
> very good.
>
> If we do not redirect, we could always set the body when raising 404
> errors, but then you'd have to define routes for every controller and
> action and direct catch all pattern to controller::action responsible
> just for raising HTTP 404 error.
>
> is there any solution to this problem, or plans on fixing it?


Re: [web2py] DAL: Selecting using the 'WHERE' clause

2011-10-20 Thread Sathvik Ponangi
@howsec, Thank you!

On Thu, Oct 20, 2011 at 3:50 AM, howesc  wrote:

> google has been changing how indexing works so you need custom indexes less
> often.  if you app does not need them, then no index.yaml file will be
> created during local usage.  this is OK as long as you have tested each
> query you have built that will run on production.
>
> about the text property, from
> http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#TextProperty
>
> "Unlike 
> StringProperty,
> a TextProperty value can be more than 500 characters long. However,
> TextProperty values are not indexed, and cannot be used in filters or sort
> orders."




-- 
Sathvik Ponangi


[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Anthony
I don't know if it's worth running a function on every request to check for 
model changes when presumably such changes will be relatively infrequent. 
Why not just manually run a migration whenever you make a change?

On Thursday, October 20, 2011 9:10:32 AM UTC-4, Cliff wrote:
>
> Anthony, thanks for the pointer. 
>
> What I'm looking for is some hint about how I can check if the model 
> is at the latest and greatest level. 
>
> Something like this: 
>
> def  some_function_to_see_if_we_need_to_migrate(): 
>  ## code goes here 
> ## ?? 
>
> migrate_enabled = some_function_to_see_if_we_need_to_migrate() 
> db=DAL(...migrate_enabled=migrate_enabled) 
>
> Maybe the answer is in the sql.log file. 
>
> Once I figure it out I'll share my answer. 
>
> On Oct 20, 8:49 am, Anthony  wrote: 
> > db=DAL(..., migrate_enabled=True|False) enables or disables migrations 
> > completely, for the entire db. See the end of this 
> > section:http://web2py.com/book/default/chapter/06#Migrations. 
> > 
> > 
> > 
> > On Thursday, October 20, 2011 7:52:34 AM UTC-4, Cliff wrote: 
> > 
> > > I have migrate=False on my production server. 
> > 
> > > Any thoughts on the best way to toggle migrate to True, then 
> > > immediately back when upgrading the model? 
> > 
> > > As the application and user base grow I don't want to be manually 
> > > editing table defs every time I change the model.



[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Massimo Di Pierro

Store in a file the date of your model file and check. When thy change
migrate and update files

On Oct 20, 6:52 am, Cliff  wrote:
> I have migrate=False on my production server.
>
> Any thoughts on the best way to toggle migrate to True, then
> immediately back when upgrading the model?
>
> As the application and user base grow I don't want to be manually
> editing table defs every time I change the model.


Re: [web2py] comparing datatime Fields

2011-10-20 Thread Richard Vézina
I think you can't pass a instruction :

Not working : db(db.event.datetime > request.now ).select(db.events.ALL)

Try :

is_now = request.now

db(db.event.datetime > is_now ).select(db.events.ALL)


or maybe you need time delta from python datetime...

Richard


On Thu, Oct 20, 2011 at 9:47 AM, Web2Py Freak wrote:

> Dear All ,
>
> i have a table called events which looks like this :
>
>
> db.define_table('events',Field('title'),Field('description','text'),Field('datetime','datetime',default=request.now,readable=False,writable=False))
>
>
> and in my default/events.html  i want to get the event the the
> datetime in it is less that now , am trying to do it like this  :
>
> events=db(db.event.datetime > request.now ).select(db.events.ALL)
>
>
> but its not working , do you have any idea how to do it ??
>
>
> Best reagards,
> Hassan alnatour
>


Re: [web2py] Web2py on android

2011-10-20 Thread Richard Vézina
Gears is deprecated
and
will no longer be available as of December 2011.

Seems Google has drop it...

Richard

On Wed, Oct 19, 2011 at 1:10 PM, Sebastian E. Ovide <
sebastian.ov...@gmail.com> wrote:

> have you considered Google Gears ?
>
>
> 2011/10/19 António Ramos 
>
>> hello, can i install web2py on android?
>>
>> The need is to create an app for an android table that in some
>> circumstances may not have network access.
>>
>> As soo as it gets network signal a replication action could syncronize
>> content with a server.Example at the end of the day.
>>
>> Also the tablet may be used by everyone besides the admin.
>>
>>
>> Am i in the wrong lane?
>>
>>
>
>
> --
> Sebastian E. Ovide
>
>
>
>
>


[web2py] new web2py books (was Re: Tell Web2py Groups: The Web2py Book 3rd Edition is long over due)

2011-10-20 Thread Gour
On Thu, 20 Oct 2011 06:40:35 -0700 (PDT)
Massimo Di Pierro
 wrote:

> The web2py 4th ed is almost ready. Problem is that we keep addi
> features...and we need to decide on new welcome layout or we cannot
> make screenshots

Is the 'code' for the book available for the public (if one wants to fix some
spelling errors etc.) ?

Same publisher?

> The packt book is in the hands of the publisher.

Congratulations!!

I'll preorder it very soon...

Here is the link for (potential buyers):

http://www.packtpub.com/web2py-application-development-recipes-to-master-python-web-framework-cookbook/book


Sincerely,
Gour


-- 
While contemplating the objects of the senses, a person 
develops attachment for them, and from such attachment lust 
develops, and from lust anger arises.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: Error: Start as Windows Service

2011-10-20 Thread toan75
Still the same error.


[web2py] Re: Cannot see Plugins listed in Wizard

2011-10-20 Thread Matthew
Per Massimo's advice, I created an issue for this here:
http://code.google.com/p/web2py/issues/detail?id=478

Please star it if you are experiencing the same issue.

On Oct 19, 4:00 pm, Matthew  wrote:
> Here is a screenshot to illustrate,http://bit.ly/qL7VjAand a
> previous thread about testing the 
> wizard,http://groups.google.com/group/web2py/browse_thread/thread/6c368ee272...


[web2py] Re: error pages with proper status code

2011-10-20 Thread Grzegorz Śliwiński
Where should I open the ticket?
I've read about google code somewhere here but can't find the link
neither on a web2py page nor here...

On Oct 20, 3:51 pm, Massimo Di Pierro 
wrote:
> Open a ticket this may be a bug
>
> On Oct 20, 7:05 am, Grzegorz ¦liwiñski  wrote:
>
>
>
> > Currently it's quite impossible to maintain custom error pages for
> > HTTP 404 and still keep the proper response code
>
> > If we redirect with routes_onerror we can get every error page dressed
> > in overall page layout, but the response code is 200 OK, which isn't
> > very good.
>
> > If we do not redirect, we could always set the body when raising 404
> > errors, but then you'd have to define routes for every controller and
> > action and direct catch all pattern to controller::action responsible
> > just for raising HTTP 404 error.
>
> > is there any solution to this problem, or plans on fixing it?


[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Cliff
This also should work...

Before pushing the code create a file using touch databases/
forcemigrate

In db.py:
import os.path
db = DAL(migrate_enabled=os.path.exists('databases/forcemigrate')

Then in the last model file xxx_cleanup.py
if os.path.exists('databases/forcemigrate'): os.remove('databases/
forcemigrate')

On Oct 20, 9:55 am, Massimo Di Pierro 
wrote:
> Store in a file the date of your model file and check. When thy change
> migrate and update files
>
> On Oct 20, 6:52 am, Cliff  wrote:
>
>
>
> > I have migrate=False on my production server.
>
> > Any thoughts on the best way to toggle migrate to True, then
> > immediately back when upgrading the model?
>
> > As the application and user base grow I don't want to be manually
> > editing table defs every time I change the model.


[web2py] Re: smartgrid setup

2011-10-20 Thread petrasadi
This is great. Thank you.


[web2py] Re: error pages with proper status code

2011-10-20 Thread Anthony
http://code.google.com/p/web2py/issues/list

On Thursday, October 20, 2011 10:15:10 AM UTC-4, Grzegorz Śliwiński wrote:
>
> Where should I open the ticket? 
> I've read about google code somewhere here but can't find the link 
> neither on a web2py page nor here... 
>
> On Oct 20, 3:51 pm, Massimo Di Pierro  
> wrote: 
> > Open a ticket this may be a bug 
> > 
> > On Oct 20, 7:05 am, Grzegorz ¦liwiñski  wrote: 
> > 
> > 
> > 
> > > Currently it's quite impossible to maintain custom error pages for 
> > > HTTP 404 and still keep the proper response code 
> > 
> > > If we redirect with routes_onerror we can get every error page dressed 
> > > in overall page layout, but the response code is 200 OK, which isn't 
> > > very good. 
> > 
> > > If we do not redirect, we could always set the body when raising 404 
> > > errors, but then you'd have to define routes for every controller and 
> > > action and direct catch all pattern to controller::action responsible 
> > > just for raising HTTP 404 error. 
> > 
> > > is there any solution to this problem, or plans on fixing it?



[web2py] Re: comparing datatime Fields

2011-10-20 Thread Web2Py Freak
Dear Richard ,

its working now  i just had db.event insted of db.events  now its
working will  , thank you ,

Best Regards,


Re: [web2py] Web2py on android

2011-10-20 Thread Sebastian E. Ovide
I've just read about it
http://gearsblog.blogspot.com/2011/03/stopping-gears.html   it makes
sense

It looks like HTML5 is the way to go...

On Thu, Oct 20, 2011 at 3:14 PM, Richard Vézina  wrote:

> Gears is 
> deprecated and
> will no longer be available as of December 2011.
>
> Seems Google has drop it...
>
> Richard
>
> On Wed, Oct 19, 2011 at 1:10 PM, Sebastian E. Ovide <
> sebastian.ov...@gmail.com> wrote:
>
>> have you considered Google Gears ?
>>
>>
>> 2011/10/19 António Ramos 
>>
>>> hello, can i install web2py on android?
>>>
>>> The need is to create an app for an android table that in some
>>> circumstances may not have network access.
>>>
>>> As soo as it gets network signal a replication action could syncronize
>>> content with a server.Example at the end of the day.
>>>
>>> Also the tablet may be used by everyone besides the admin.
>>>
>>>
>>> Am i in the wrong lane?
>>>
>>>
>>
>>
>> --
>> Sebastian E. Ovide
>>
>>
>>
>>
>>
>


-- 
Sebastian E. Ovide


[web2py] FluxFlex hosting

2011-10-20 Thread raven
free FluxFlex hosting seems to work well,
except that it will not install a packed application.   James


[web2py] Auth in MongoDB

2011-10-20 Thread Francisco Costa
Hi,
we are in the process of converting our MySQL DB to MongoDB (via
pymongo).

We have already convert the auth_user table.
Now we want to change the auth connection from
auth = Auth(globals(), db)
to
auth = Auth(globals(), mongo)

but we get this error:
TypeError: 'Collection' object is not callable. If you meant to call
the 'Table' method on a 'Database' object it is failing because no
such method exists.

Is there any way that the auth supports Collections and not only
tables?


[web2py] In a grid is it possible to represent a filename as a link to the file?

2011-10-20 Thread apple
In my model I have:
 db.customerfile.filename.represent= lambda filename, row: \
A(filename, _href=URL('download', args=row.file))
 db.customerfile.file.readable=False
 db.customerfile.file.writable=False

In a SQLFORM this shows the filename as a link which opens the file.

I would like a grid to similarly display just the filename with a link
to open the file. However the "represent" only works if you have both
the file and filename fields included in the grid.

Is there a way to just display the filename? Why does the grid display
fields with "readable=False"?


Re: [web2py] Re: Tell Web2py Groups: The Web2py Book 3rd Edition is long over due

2011-10-20 Thread joseph simpson
Thanks for the update



On Thu, Oct 20, 2011 at 6:40 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

>
> The web2py 4th ed is almost ready. Problem is that we keep addi
> features...and we need to decide on new welcome layout or we cannot
> make screenshots
>
> The packt book is in the hands of the publisher.
>
> Both book shout be available berofe christmas
>
> On Oct 19, 2:16 pm, joseph simpson  wrote:
> > Just checking on the current state of the Web2py online book update as
> well
> > as the rumored "Packt Web2py book."
> >
> > Any new projected release dates?
> >
> > Have fun,
> >
> > Joe
> >
> >
> >
> >
> >
> > On Tue, Sep 27, 2011 at 7:00 AM, Jim Steil  wrote:
> > > +1 for keeping in the book format.  Definitely helped attract me to
> Web2py.
> >
> > >-Jim
> >
> > > On 9/26/2011 10:18 PM, Andrew wrote:
> >
> > >> I was actually qutie impressed with the book-like docs when I first
> > >> saw them.  It gives the framework a polished, professional feel (I
> > >> think).  I say keep it, but I'm all for keeping it up to date, in line
> > >> with new functionality being released in the stable version.
> >
> > >> I'm also hanging out for an update with all of the new features.
> >
> > >> On Sep 27, 3:29 pm, pbreit  wrote:
> >
> > >>> I wonder if we could benefit from docs that are more dynamic and less
> > >>> book-like? I'm not totally enamored with Sphinx, though.
> >
> > --
> > Joe Simpson
> >
> > Sent From My DROID!!
>



-- 
Joe Simpson

Sent From My DROID!!


[web2py] Re: join and sum - display in view

2011-10-20 Thread Anthony
On Thursday, October 20, 2011 8:43:10 AM UTC-4, Anthony wrote:
>
> Try
>
> TD(row[sum])
>
> Actually, the above will only work if the controller returns 'sum' in the 
dictionary -- otherwise it will be undefined in the view.



[web2py] SOLVED join and sum - display in view

2011-10-20 Thread andrej burja
this one works

TD(row['SUM(t_payement.f_value)'])

and also this

TD(row._extra['SUM(t_payement.f_value)'])


[web2py] Re: Qooxdoo + Web2py Based AJAX POS system, Released!

2011-10-20 Thread greenpoise
I was using firefox..my laptop is pretty old...using linux on a 4 gb
ram dual core laptop.. it was the scrolling that just dragged





On Oct 20, 12:51 am, Phyo Arkar  wrote:
> Qooxdoo is very fast for me. What browser you use? and ur PC Specs?
> to change table size it just need to put inside resizable pane. and
> they will be resizable.
> I will separate two tables in different tabs , they shouldn't be
> inside one page i guess.
>
> On 10/20/11, greenpoise  wrote:
>
>
>
>
>
>
>
> > ah ok..got it..I have never tried or didnt know anything about qooxdoo
> > as a matter of fact. I like it but for some reason is slow in my
> > browser..scrolling that is.. the tables are such a treat for a
> > backoffice perspective...can these tables size can be change, like
> > their width??
>
> > On Oct 19, 4:34 pm, Phyo Arkar  wrote:
> >> Oh you dont need to login , login is not read yet i forget to add that :D
>
> >> On 10/20/11, Phyo Arkar  wrote:
>
> >> > our restaurant just opened 2 months ago , and no shes not using any
> >> > POS Software , registering by hand, She started using this POS this
> >> > week,. It was just 2 week of coding in my free time . I am busy with
> >> > other projects .
>
> >> > I am going to put more features .
>
> >> > The feature she requested right now is to make filtering work by date
> >> > and items (1st priority :D) .
> >> > i am going to get it work tomorrow. if you guys have any idea feel
> >> > free to suggest :) .
>
> >> > On 10/20/11, greenpoise  wrote:
> >> >> Cool. Is your wife currently using a POS?? we are currently using
> >> >> Microsoft Dynamics RMS and wow..what a battle it has been..
>
> >> >> On Oct 19, 4:26 pm, Phyo Arkar  wrote:
> >> >>> its hard to make it configurable , i don't know how to pass variable
> >> >>> from Qooxdoo to web2py thats why i need to hard-code it. coz qooxdoo
> >> >>> is totally js and web2py's template code wont work inside JS files.
>
> >> >>> One thing is to pass via url-string is that acceptable ?
>
> >> >>> On 10/20/11, greenpoise  wrote:
>
> >> >>> > Got ya..thanks..will do..
>
> >> >>> > d
>
> >> >>> > On Oct 19, 4:19 pm, Phyo Arkar  wrote:
> >> >>> >> rename it to HersPOS (URL is hardcoded).
>
> >> >>> >> On 10/20/11, greenpoise  wrote:
>
> >> >>> >> > Mine does not show anything. I did as pbreit said, under /herspos
> >> >>> >> > but
> >> >>> >> > nothing.
>
> >> >>> >> > On Oct 19, 4:14 pm, Phyo Arkar  wrote:
> >> >>> >> >> upper toolbar buttons not working yet , i forgot to mention
> >> >>> >> >> that.
>
> >> >>> >> >> On 10/20/11, Phyo Arkar  wrote:
>
> >> >>> >> >> > ok i will make a w2p release.
> >> >>> >> >> > I will also make it configurable.
> >> >>> >> >> > You guys feel free to clone. modify what you feel needed.
> >> >>> >> >> > I had tested on chrome and firefox on linux and firefox on
> >> >>> >> >> > windows
> >> >>> >> >> > ,
> >> >>> >> >> > can you give me the firebug output or chrome devtool output ?
>
> >> >>> >> >> > On 10/20/11, greenpoise  wrote:
> >> >>> >> >> >> Neat,thanks for sharing. I download it havent checked out.
> >> >>> >> >> >> Can
> >> >>> >> >> >> you
> >> >>> >> >> >> package it so users can install?
>
> >> >>> >> >> >> d
>
> >> >>> >> >> >> On Oct 19, 3:24 pm, Phyo Arkar 
> >> >>> >> >> >> wrote:
> >> >>> >> >> >>> Hello Web2py.
>
> >> >>> >> >> >>> As a practice for integrating Qooxdoo and web2py. I had
> >> >>> >> >> >>> created
> >> >>> >> >> >>> a
> >> >>> >> >> >>> Point of Sales system for my wife's sushi shop.
>
> >> >>> >> >> >>> All people who have trouble integrating Qooxdoo, can base on
> >> >>> >> >> >>> my
> >> >>> >> >> >>> code.
> >> >>> >> >> >>> It used multiple Qooxdoo features .
>
> >> >>> >> >> >>> - Tables
> >> >>> >> >> >>> - Folder Trees
> >> >>> >> >> >>> - Events
> >> >>> >> >> >>> - Event Bubbling
> >> >>> >> >> >>> - Delegates
> >> >>> >> >> >>> - Custom Class
> >> >>> >> >> >>> - AJAX
> >> >>> >> >> >>> - Datastore and controllers
> >> >>> >> >> >>> - Remote Table
>
> >> >>> >> >> >>> Now i decided to release it as opensource. Please check :
>
> >> >>> >> >> >>>http://code.google.com/p/herspos/
> >> >>> >> >> >>> ---
>
> >> >>> >> >> >>> HersPOS
>
> >> >>> >> >> >>> Web2py + Qooxdoo based resturant POS . Feel feel to use and
> >> >>> >> >> >>> contribute!
> >> >>> >> >> >>> Started for my wife's Sushi Restaurant, and as a practice
> >> >>> >> >> >>> for
> >> >>> >> >> >>> Qooxdoo
> >> >>> >> >> >>> framework , integrating with web2py.Now avaliable for
> >> >>> >> >> >>> everyone.This
> >> >>> >> >> >>> project is not completed yet, but mostly functional.
>
> >> >>> >> >> >>> Features :
>
> >> >>> >> >> >>> - Full application UI powered by Qooxdoo
>
> >> >>> >> >> >>> - AJAX View of item records using Qooxdoo table.
>
> >> >>> >> >> >>> - AJAX View of sales records.
>
> >> >>> >> >> >>> - Add new sales record.
>
> >> >>> >> >> >>> - Add new items.
>
> >> >>> >> >> >>> - Totals summary.
>
> >> >>> >> >> >>> Todo :
>
> >> >>> >> >> >>> - Sorting
>
> >> >>> >> >> >>> - Filter 

[web2py] Template var doesn't appear with leading zero

2011-10-20 Thread Vinicius Assef
Hi guys,
I'm facing a little problem here.

In my view I have:
{{n=3}}
{{='%2d' % n}}

This shows the number " 3" (a space before the number 3). I expected
it shows "03" (a leading zero).

Is it the way it should work?
I think variable interpolation should mantain its contents when
printed to the user.

Anybody know why this is happening?

--
Vinicius Assef.


Re: [web2py] Template var doesn't appear with leading zero

2011-10-20 Thread Richard Vézina
Try
'%002d'%n

Richard

On Thu, Oct 20, 2011 at 2:43 PM, Vinicius Assef wrote:

> Hi guys,
> I'm facing a little problem here.
>
> In my view I have:
> {{n=3}}
> {{='%2d' % n}}
>
> This shows the number " 3" (a space before the number 3). I expected
> it shows "03" (a leading zero).
>
> Is it the way it should work?
> I think variable interpolation should mantain its contents when
> printed to the user.
>
> Anybody know why this is happening?
>
> --
> Vinicius Assef.
>


[web2py] Re: SOLVED join and sum - display in view

2011-10-20 Thread Massimo Di Pierro
Please use Anthony's advice:

row[sum]

Do not use

_extra

because it is deprecated and do not use

row['SUM(t_payement.f_value)']

because the syntax may not work with every database engine.

On Oct 20, 12:17 pm, andrej burja  wrote:
> this one works
>
> TD(row['SUM(t_payement.f_value)'])
>
> and also this
>
> TD(row._extra['SUM(t_payement.f_value)'])


[web2py] Ajax sample function does not work on Update form

2011-10-20 Thread Franklin Freitas
I am using a form very similar to the Ajax sample on chapter 3 to
search for customers and once you see the results, you click on the
record you want so customer id and name are added to the form fields
on my main processing form. This works fine on my "add new" records
form.

I have another page to "update records", similar to the "add new
records" page. On this form the Ajax doesn't work, when I call the
Ajax function I get in the target div the content of the index page.
After trying to see why it would only work in one page and the add and
update records pages are similar I found the reason. On the update
page there is an id on the url (to be read using request.args(0)) this
causes the error, for some reason when there is an argument in that
position the Ajax get confused and doesn't return the right results.

I tried adding a "/21" at the end of my "add new" page url and the
Ajax also fails, this confirms that this is the cause of the error. I
guess somehow the Ajax gets confused with this

Has anyone else experience this error ?

Thanks for your help


Re: [web2py] Template var doesn't appear with leading zero

2011-10-20 Thread Richard Vézina
Sorry,

'%03d'%n

00n

'%02d'%n

0n

http://stackoverflow.com/questions/134934/display-number-with-leading-zeros

Richard

On Thu, Oct 20, 2011 at 3:17 PM, Richard Vézina  wrote:

>
> Try
> '%002d'%n
>
> Richard
>
>
> On Thu, Oct 20, 2011 at 2:43 PM, Vinicius Assef wrote:
>
>> Hi guys,
>> I'm facing a little problem here.
>>
>> In my view I have:
>> {{n=3}}
>> {{='%2d' % n}}
>>
>> This shows the number " 3" (a space before the number 3). I expected
>> it shows "03" (a leading zero).
>>
>> Is it the way it should work?
>> I think variable interpolation should mantain its contents when
>> printed to the user.
>>
>> Anybody know why this is happening?
>>
>> --
>> Vinicius Assef.
>>
>
>


[web2py] uploading files to the database

2011-10-20 Thread apple
I am now experimenting with uploading files to the database but have
not been successful and have some questions:

1) Field('file','upload', uploadfield='fileblob'),

I understand this is supposed to create the fileblob field
automatically. However it does not seem to do this for me. Does it not
work with sqlite?

2) I have added fileblob to my model explicitly and when i display a
SQLFORM it displays a button and lets me choose a file. However when I
submit then the record is redisplayed and the file does not seem to be
shown nor is it in the database. I don't see what I am doing wrong. Is
there an example somewhere that shows file uploads to the database
working?

3) If I use a custom form which loops through form.custom.label then
it fails at self.custom.widget["fileblob"] saying it is a key error.
Do I have to explicitly miss out the fileblob fields within my custom
table?


[web2py] Re: Ajax sample function does not work on Update form

2011-10-20 Thread Anthony
Can you show some code?

On Thursday, October 20, 2011 3:21:12 PM UTC-4, Franklin Freitas wrote:
>
> I am using a form very similar to the Ajax sample on chapter 3 to 
> search for customers and once you see the results, you click on the 
> record you want so customer id and name are added to the form fields 
> on my main processing form. This works fine on my "add new" records 
> form. 
>
> I have another page to "update records", similar to the "add new 
> records" page. On this form the Ajax doesn't work, when I call the 
> Ajax function I get in the target div the content of the index page. 
> After trying to see why it would only work in one page and the add and 
> update records pages are similar I found the reason. On the update 
> page there is an id on the url (to be read using request.args(0)) this 
> causes the error, for some reason when there is an argument in that 
> position the Ajax get confused and doesn't return the right results. 
>
> I tried adding a "/21" at the end of my "add new" page url and the 
> Ajax also fails, this confirms that this is the cause of the error. I 
> guess somehow the Ajax gets confused with this 
>
> Has anyone else experience this error ? 
>
> Thanks for your help



[web2py] Re: uploading files to the database

2011-10-20 Thread Anthony
On Thursday, October 20, 2011 3:57:24 PM UTC-4, apple wrote:
>
> I am now experimenting with uploading files to the database but have 
> not been successful and have some questions: 
>
> 1) Field('file','upload', uploadfield='fileblob'), 
>
> I understand this is supposed to create the fileblob field 
> automatically. However it does not seem to do this for me. Does it not 
> work with sqlite? 
>

I don't think it's supposed to be automatic -- I think you're supposed to 
define the uploadfield explicitly.
 

>
> 2) I have added fileblob to my model explicitly and when i display a 
> SQLFORM it displays a button and lets me choose a file. However when I 
> submit then the record is redisplayed and the file does not seem to be 
> shown nor is it in the database. I don't see what I am doing wrong. Is 
> there an example somewhere that shows file uploads to the database 
> working? 
>

See http://web2py.com/book/default/chapter/11#Upload-Files-in-Database.
 

>
> 3) If I use a custom form which loops through form.custom.label then 
> it fails at self.custom.widget["fileblob"] saying it is a key error. 
> Do I have to explicitly miss out the fileblob fields within my custom 
> table?


The 'fileblob' field doesn't get a widget -- just the 'file' field does. The 
'file' field is the upload field, so it gets displayed in the form. The 
'fileblob' field is just used to store the file so doesn't need to get 
displayed in the form.
 


[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread pbreit
Reminds me of a recent inquiry about the possibility of more visibility and 
control of migrations. I'm curious if other frameworks have interesting 
migration capabilities? Like would it be possible to review a migration 
before it is performed? Would it be possible to explicitly run that 
migration by itself? Thinking out loud here.

Re: [web2py] Template var doesn't appear with leading zero

2011-10-20 Thread Vinicius Assef
I cannot believe I made this mistake! :-O

Sure it worked, Richard.
Sorry, guys.


On Thu, Oct 20, 2011 at 5:23 PM, Richard Vézina
 wrote:
> Sorry,
> '%03d'%n
> 00n
> '%02d'%n
> 0n
> http://stackoverflow.com/questions/134934/display-number-with-leading-zeros
>
> Richard
> On Thu, Oct 20, 2011 at 3:17 PM, Richard Vézina
>  wrote:
>>
>> Try
>> '%002d'%n
>> Richard
>>
>> On Thu, Oct 20, 2011 at 2:43 PM, Vinicius Assef 
>> wrote:
>>>
>>> Hi guys,
>>> I'm facing a little problem here.
>>>
>>> In my view I have:
>>> {{n=3}}
>>> {{='%2d' % n}}
>>>
>>> This shows the number " 3" (a space before the number 3). I expected
>>> it shows "03" (a leading zero).
>>>
>>> Is it the way it should work?
>>> I think variable interpolation should mantain its contents when
>>> printed to the user.
>>>
>>> Anybody know why this is happening?
>>>
>>> --
>>> Vinicius Assef.
>>
>
>


[web2py] Re: Error: Start as Windows Service

2011-10-20 Thread Brian M
Check that you've got the pywin32 module installed. 
http://pypi.python.org/pypi/pywin32/214

~Brian


[web2py] @auth.requires_login problem

2011-10-20 Thread brushek
Hello,

I craated test app, in default.py added above index (and no other
changes in project):

@auth.requires_login()
def index():
...

After logging in, and going to index I get folowing error:


Traceback (most recent call last):
  File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/users/brushek/web2py/applications/test/controllers/
default.py", line 72, in 
  File "/home/users/brushek/web2py/gluon/globals.py", line 149, in

self._caller = lambda f: f()
  File "/home/users/brushek/web2py/gluon/tools.py", line 2465, in f
if condition and callable(condition):
UnboundLocalError: local variable 'condition' referenced before
assignment

Version of web2py:
$ cat VERSION
Version 1.99.3 (2011-10-19 08:46:51) dev

How to solve this problem ?

regards,
 brushek




[web2py] Plugin files disappearing during editing

2011-10-20 Thread Matthew
I am trying to create a plugin. Is there any reason that files
prefixed with "plugin_" do not show up when you restart web2py to edit
them again?

http://img7.imagebanana.com/img/wcibbzg2/Selection_010.png

Thanks,
Matthew


[web2py] Re: Plugin files disappearing during editing

2011-10-20 Thread Anthony
Plugin files are shown separately -- scroll to the bottom of the page, and 
you should see the plugins listed in the Plugins section. Click on one, and 
you'll get a separate page for the plugin files.

[web2py] Re: Plugin files disappearing during editing

2011-10-20 Thread Matthew
Thank you!

On Oct 20, 7:47 pm, Anthony  wrote:
> Plugin files are shown separately -- scroll to the bottom of the page, and
> you should see the plugins listed in the Plugins section. Click on one, and
> you'll get a separate page for the plugin files.


[web2py] Navigation links with Plugin & CRUD

2011-10-20 Thread Matthew
Is there any way to change the default behavior of the CRUD select
view when using a plugin? Right now, I have to navigate to the select
screen with ".../plugin_wmgraph/data...", but the generated links on
the page point to ".../default/data...", so an error occurs when
clicking them.

http://img6.imagebanana.com/img/aw2vsbdl/pTZ6ZW0mVK.png

Thanks,
Matthew


[web2py] Learning to test

2011-10-20 Thread Joseph Jude
All,
I have been looking into automated testing of web2py. I have looked at the 
below pages:

http://web2py.com/AlterEgo/default/show/260
http://packages.python.org/web2py_utils/test_runner.html
http://www.web2pyslices.com/slices/take_slice/67
http://ncdegroot.blogspot.com/2011/09/web2py-automate-unittesting-doctesting.html

However, is there any open source project with test modules that I can look 
into how the testing is done in real projects and learn?

Thank you,
Joseph


[web2py] Re: Error: Start as Windows Service

2011-10-20 Thread toan75
I have not tried it but it will run. Thank very much.


[web2py] Re: @auth.requires_login problem

2011-10-20 Thread Massimo Di Pierro
This is not fixed in trunk. Please check it.

On Oct 20, 4:45 pm, brushek  wrote:
> Hello,
>
> I craated test app, in default.py added above index (and no other
> changes in project):
>
> @auth.requires_login()
> def index():
> ...
>
> After logging in, and going to index I get folowing error:
>
> Traceback (most recent call last):
>   File "/home/users/brushek/web2py/gluon/restricted.py", line 192, in
> restricted
>     exec ccode in environment
>   File "/home/users/brushek/web2py/applications/test/controllers/
> default.py", line 72, in 
>   File "/home/users/brushek/web2py/gluon/globals.py", line 149, in
> 
>     self._caller = lambda f: f()
>   File "/home/users/brushek/web2py/gluon/tools.py", line 2465, in f
>     if condition and callable(condition):
> UnboundLocalError: local variable 'condition' referenced before
> assignment
>
> Version of web2py:
> $ cat VERSION
> Version 1.99.3 (2011-10-19 08:46:51) dev
>
> How to solve this problem ?
>
> regards,
>  brushek


[web2py] Re: Navigation links with Plugin & CRUD

2011-10-20 Thread Massimo Di Pierro
Do not use crud.select. use SQLFORM.grid instead. So much better.

On Oct 20, 8:34 pm, Matthew  wrote:
> Is there any way to change the default behavior of the CRUD select
> view when using a plugin? Right now, I have to navigate to the select
> screen with ".../plugin_wmgraph/data...", but the generated links on
> the page point to ".../default/data...", so an error occurs when
> clicking them.
>
> http://img6.imagebanana.com/img/aw2vsbdl/pTZ6ZW0mVK.png
>
> Thanks,
> Matthew


[web2py] a couple of related questions

2011-10-20 Thread niknok
I have a person table[1] with a parent field with a clickable
representation view of the record. If I put this on a grid and click on
the link, I get a "not authorized" error message. I thought I need to
pass the signature so I can make it viewable. (This works fine if
parameter user_signature=False)

Also, I have defined a default representation for the person table but
in my validation statement, note that I had to specify the same format
again. I'm wondering if there's a way to tell the validator to use the
default representation of the person (which I thought was web2py's
default behavior.)

In my grid, I specified a new button [2] in the links parameter, how do
I specificy an icon for this button? For example I want to use what's
already in base.css (book, heart, cross etc.)

/r
Nik

[1]
db.define_table('person'
,Field('birth_date', 'date', requires=IS_DATE())
,Field('last_name', notnull=True)
,Field('given_name', notnull=True)
,Field('parent', 'list:reference person'
,requires=IS_EMPTY_OR(IS_IN_DB(db, 'person.id'
  ,'%(last_name)s,
%(given_name)s [%(birth_date)s]'
  ,multiple=True
  ,zero=T('pick one')))
,represent =  lambda value, row: [A(' ▸'+
db.person[v].given_name , _href = URL('index/view/person', args=[v]))
for v in value])
,auth.signature
,format='%(last_name)s, %(given_name)s [%(birth_date)s]'
)


[2]
 form=SQLFORM.grid( db.person
  ,fields=[db.person.id, db.person.last_name,
db.person.given_name
,db.person.middle_name,
db.person.gender, db.person.birth_date, db.person.parent]
  ,showbuttontext=False
  ,sorter_icons=('[▴]','[▾]')
  ,onvalidation=person_processing
  ,links = [lambda row: A('X',
_href=URL(args=["view", db.person, row.id] ))]
  )



[web2py] Re: Navigation links with Plugin & CRUD

2011-10-20 Thread greenpoise
I keep reading SQLFORM.grid. Any example out there with the different
options?


thanks

Dan




On Oct 20, 7:35 pm, Massimo Di Pierro 
wrote:
> Do not use crud.select. use SQLFORM.grid instead. So much better.
>
> On Oct 20, 8:34 pm, Matthew  wrote:
>
>
>
>
>
>
>
> > Is there any way to change the default behavior of the CRUD select
> > view when using a plugin? Right now, I have to navigate to the select
> > screen with ".../plugin_wmgraph/data...", but the generated links on
> > the page point to ".../default/data...", so an error occurs when
> > clicking them.
>
> >http://img6.imagebanana.com/img/aw2vsbdl/pTZ6ZW0mVK.png
>
> > Thanks,
> > Matthew


[web2py] Re: Best way to toggle db migration on production server?

2011-10-20 Thread Cliff
With Ruby on Rails you can roll migrations back.  I think you can even
roll migrations back to a prior level, not just the last one.

Every migration has its own log file.   Relying on hazy memory here,
but I think Rails puts the SQL for the migration in the log file along
with the SQL to roll back the migration.

On Oct 20, 4:40 pm, pbreit  wrote:
> Reminds me of a recent inquiry about the possibility of more visibility and
> control of migrations. I'm curious if other frameworks have interesting
> migration capabilities? Like would it be possible to review a migration
> before it is performed? Would it be possible to explicitly run that
> migration by itself? Thinking out loud here.


[web2py] Re: Navigation links with Plugin & CRUD

2011-10-20 Thread Cliff
The very long thread (~115 posts) about grid and smartgrid is the best
source.  Sorry, don't recall the title.

On Oct 20, 10:57 pm, greenpoise  wrote:
> I keep reading SQLFORM.grid. Any example out there with the different
> options?
>
> thanks
>
> Dan
>
> On Oct 20, 7:35 pm, Massimo Di Pierro 
> wrote:
>
> > Do not use crud.select. use SQLFORM.grid instead. So much better.
>
> > On Oct 20, 8:34 pm, Matthew  wrote:
>
> > > Is there any way to change the default behavior of the CRUD select
> > > view when using a plugin? Right now, I have to navigate to the select
> > > screen with ".../plugin_wmgraph/data...", but the generated links on
> > > the page point to ".../default/data...", so an error occurs when
> > > clicking them.
>
> > >http://img6.imagebanana.com/img/aw2vsbdl/pTZ6ZW0mVK.png
>
> > > Thanks,
> > > Matthew
>
>


[web2py] Re: Navigation links with Plugin & CRUD

2011-10-20 Thread greenpoise
got it..thanks




On Oct 20, 8:04 pm, Cliff  wrote:
> The very long thread (~115 posts) about grid and smartgrid is the best
> source.  Sorry, don't recall the title.
>
> On Oct 20, 10:57 pm, greenpoise  wrote:
>
>
>
>
>
>
>
> > I keep reading SQLFORM.grid. Any example out there with the different
> > options?
>
> > thanks
>
> > Dan
>
> > On Oct 20, 7:35 pm, Massimo Di Pierro 
> > wrote:
>
> > > Do not use crud.select. use SQLFORM.grid instead. So much better.
>
> > > On Oct 20, 8:34 pm, Matthew  wrote:
>
> > > > Is there any way to change the default behavior of the CRUD select
> > > > view when using a plugin? Right now, I have to navigate to the select
> > > > screen with ".../plugin_wmgraph/data...", but the generated links on
> > > > the page point to ".../default/data...", so an error occurs when
> > > > clicking them.
>
> > > >http://img6.imagebanana.com/img/aw2vsbdl/pTZ6ZW0mVK.png
>
> > > > Thanks,
> > > > Matthew


[web2py] SQLFORM.grid / Powergrid

2011-10-20 Thread greenpoise
I have a few questions regarding the grids.

1. Is SQLFORM.grid the implementation of Powergrid? meaning, does
SQLFORM.grid has all the features of Powergrid?

2. Is there an option to edit a value on the fly rather than using an
edit button? sort of like edit in place pyslice.

3. Is search as you type an option (type ahead)?


Thanks

Dan


[web2py] Found a bug: XMLRPC with basic authorization fails

2011-10-20 Thread Robin Marshall
Hi,

Just wanted to say that we found a bug in 1.99.2 when using XMLRPC
services with the @auth.requires_login decorator using basic
authentication.

It looks like some code was refactored out of requires_login into a
generic requires method which might be the cause of the problem.

A quick hack was to change the following code, but obviously that
won't work very well for people who aren't using basic authentication.

def is_logged_in(self):
"""
checks if the user is logged in and returns True/False.
if so user is in auth.user as well as in session.auth.user
"""
if self.user:
return True
return False

to:

def is_logged_in(self):
"""
checks if the user is logged in and returns True/False.
if so user is in auth.user as well as in session.auth.user
"""
if self.basic() and self.user:
return True
return False

Cheers,
Robin


[web2py] Re: DAL: Selecting using the 'WHERE' clause

2011-10-20 Thread Sathvik Ponangi
Am I getting this error because of a timeout on the Appengine SDK?

INFO 2011-10-21 03:43:14,782 dal.py:3399] 1

INFO 2011-10-21 03:43:14,786 gaehandler.py:72]  Request: 
> 64720.00ms/64719.96ms (real time/cpu time)

INFO 2011-10-21 03:43:14,913 recording.py:371] Saved; key: 
> __appstats__:03, part: 109 bytes, full: 260037 bytes, overhead: 0.014 + 
> 0.124; link: http://localhost:8087/_ah/stats/details?time=1319168530066

INFO 2011-10-21 03:43:15,118 dev_appserver.py:4143] "POST /init/mobwrite 
> HTTP/1.1" 200 -

Traceback (most recent call last):

  File "C:\Python25\lib\SocketServer.py", line 222, in handle_request

self.process_request(request, client_address)

  File "C:\Python25\lib\SocketServer.py", line 241, in process_request

self.finish_request(request, client_address)

  File "C:\Python25\lib\SocketServer.py", line 254, in finish_request

self.RequestHandlerClass(request, client_address, self)

  File "C:\Program 
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 
> 3855, in __init__

BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)

  File "C:\Python25\lib\SocketServer.py", line 522, in __init__

self.handle()

  File "C:\Python25\lib\BaseHTTPServer.py", line 316, in handle

self.handle_one_request()

  File "C:\Python25\lib\BaseHTTPServer.py", line 310, in handle_one_request

method()

  File "C:\Program 
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 
> 3869, in do_POST

self._HandleRequest()

  File "C:\Program 
> Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 
> 4125, in _HandleRequest

raise e

error: (10053, 'Software caused connection abort')



[web2py] Hide menu until after authentication.

2011-10-20 Thread Mike Veltman

Gentle people,

First a remark I started playing with SQLFORM.grid and it was very ugly, until 
I did throw away my application and recreated it with the wizard, and then it  
was fine. ;-)

Second, I would like my response.menu to show up after authentication. What is 
the most elegant way of doing that ?

Thanks in advance.


With regards,
Mike Veltman




[web2py] Re: FluxFlex hosting

2011-10-20 Thread Lazarof

https://github.com/nus/web2py-for-fluxflex/blob/master/README.md

On Oct 20, 8:07 pm, raven  wrote:
> free FluxFlex hosting seems to work well,
> except that it will not install a packed application.   James