[web2py] Re: A requested feature...

2011-05-06 Thread pbreit
Not a bad idea but not sure exactly how it would work. There are already 
some good scripts in the Web2py distribution for setting up Web2py on Ubuntu 
(my preference) and 
Fedora: http://code.google.com/p/web2py/source/browse/#hg%2Fscripts

I also created some Fabric scripts for Nginx and Cherokee (I should probably 
do Apache):
https://bitbucket.org/pbreit/web2py-automation/src

That makes it pretty easy although I'm sure there's room to make it even 
easier. I'm not very technical and managed to figure everything out in less 
than an hour. It's difficult to automate it more because then you have to 
start working with Amazon APIs and keys. Perhaps there's an opportunity to 
create a AMI that's ready to go. But really, it's not that hard.

I encourage everyone to give it a try especially since you can get a free 
Amazon micro instance for 1 year. I use Rackspace which is around $11/month.


[web2py] A requested feature...

2011-05-06 Thread Jason Brower
I think another nice feature for web2py could be deployment to amazon 
cloud.  That is, it sets up everything on the cloud for you and deploys 
it there.
Other features to go really high-tech would be to also setup the static 
file management for you as well.  So that could be on another server.
These are some of the challenges we are facing with django at my work, 
and something that would be nice on web2py.
Actually, thinking about it, this could be something that amazon may 
even be able to pay for!

BR,
Jason Brower


[web2py] Re: Audit for all tables, independent of CRUD; and transaction rollback.

2011-05-06 Thread nick name
Thanks for the answer. However, as I mentioned in my original post, the 
crud's record versioning is not sufficient for my needs.


[web2py] Re: Audit for all tables, independent of CRUD; and transaction rollback.

2011-05-06 Thread nick name
On Friday, May 6, 2011 6:44:18 PM UTC-4, pbreit wrote:
>
> Check out "auth.signature". It adds and manipulates these columns: 
> is_active, created_on, created_by, modified_on, modified_by. 
>

Thank you for your answer. This is a good "mix-in" table for the things I 
need. However, neither signature nor auth_event help with the problem of 
doing automatic auditing of changes, which is what I need.

Thanks!


[web2py] Re: help

2011-05-06 Thread pbreit
http://grizzlyweb.com/webmaster/javascripts/redirection.asp

But I'm not sure why you would want to do that.


Re: [web2py] Re: help

2011-05-06 Thread TÅ®å ßrown
i have thought about doin it in the controller..but  i used a ajax jquery
function to enter data in a database but right after that i wanted it to
redirect to another page.. i tried calling the fuction of the default page
that i wanted but it doesnt redirect it just gives a 200  instead of a
303... so i really dont know what else to do..

On Fri, May 6, 2011 at 8:08 PM, Shishir Ramam  wrote:

> not sure why you'd do that on the client, but assign a function to
> window.onload
> something like 
>
> (function() {
> var oldonload = window.onload,
> func = function() {
> // redirect here...
> };
> if (typeof window.onload != 'function') {
> window.onload = func;
> } else {
> window.onload = function() {
> if (oldonload) {
> oldonload();
> }
> func();
> }
> }
> })();
>
> I'm kind of new on the list so am willing to be corrected.
> Strictly speaking, this is a javascript question - and belongs elsewhere.
> You might want to search stackoverflow.com for answers - or even
> google/bing -
> they reliably lead me to stackoverflow for most questions I have.
>
> -shishir
>
>
> On Fri, May 6, 2011 at 5:38 PM, Resa  wrote:
>
>> mean i am in index.html and it had a javascript function that holds
>> redirect to physics.html...
>> when i load index.html it doesn't go to index.html  at all it skips it
>> and executed physics.html.. do u understand?
>> so when the page is loaded it executes the JavaScript without it being
>> called
>>
>> On May 6, 7:25 pm, Shishir Ramam  wrote:
>> > http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-p.
>> ..
>> >
>> > On Fri, May 6, 2011 at 5:21 PM, Resa  wrote:
>> > > how can i redirect  to another page in a JavaScript function without
>> > > executing it until the function is actually called???
>> >
>> > --
>> > Imagine there were no hypothetical situations.
>>
>
>
>
> --
> Imagine there were no hypothetical situations.
>



-- 
Live Laugh Love || Strength, Courage and Wisdom 


[web2py] Re: a new html editor

2011-05-06 Thread Massimo Di Pierro
So here is my wish list

1) make sure it does escape or validate URLs (at list allow disabling)
so that we can use it to edit layouts and insert {{=URL(...)}} in
place of links.

2) allow restriction of features so that only allows HTML that can be
converted to markmin.(B, EM, UL/LI, OL/LI, P, BLOCKQUOTE, A, IMG)

3) have a customizable way to embed videos or other objects (for
example latex formulas and charts)



On May 6, 5:29 pm, elffikk  wrote:
> hi,
>
> I am here to present a work in progress: a lighweight jquery based
> html editor
>
> http://8plus2.org/init/static/bolteditor/index.html
>
> it is in alpha version
> now it is 10kb of js code + 15kb html+css+images
> and of course dependencies jquery and jquery.ui.position
>
> user interface (and just user interface) is from another 
> editorhttp://www.openwebware.com/,
> some coding ideas from jquery.rte  http://code.google.com/p/rte-light
>
> why another one?
> - jquery.rte is not feature rich
> - I like openwebware interface but
>   - it is not compatible with jquery
>   - seems not updated for a few years
>
> I need some feedback, ideas, and suggestions on integration with
> web2py
>
> thank you


[web2py] Re: Error on python2.4

2011-05-06 Thread Massimo Di Pierro
Can we see the code that triggered this. I do not think we broke this
but could be.

On May 6, 7:01 pm, Tito Garrido  wrote:
> I could solve the problem commenting the sha512 keys setting...
>
> It's not on my code... seems that web2py doesn't support python 2.4
> anymore...
>
> On Fri, May 6, 2011 at 6:35 PM, pbreit  wrote:
> > Ca we see some code? The lines around line 72 in default.py
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___


Re: [web2py] Re: help

2011-05-06 Thread Shishir Ramam
not sure why you'd do that on the client, but assign a function to
window.onload
something like 

(function() {
var oldonload = window.onload,
func = function() {
// redirect here...
};
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
})();

I'm kind of new on the list so am willing to be corrected.
Strictly speaking, this is a javascript question - and belongs elsewhere.
You might want to search stackoverflow.com for answers - or even google/bing
-
they reliably lead me to stackoverflow for most questions I have.

-shishir


On Fri, May 6, 2011 at 5:38 PM, Resa  wrote:

> mean i am in index.html and it had a javascript function that holds
> redirect to physics.html...
> when i load index.html it doesn't go to index.html  at all it skips it
> and executed physics.html.. do u understand?
> so when the page is loaded it executes the JavaScript without it being
> called
>
> On May 6, 7:25 pm, Shishir Ramam  wrote:
> > http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-p...
> >
> > On Fri, May 6, 2011 at 5:21 PM, Resa  wrote:
> > > how can i redirect  to another page in a JavaScript function without
> > > executing it until the function is actually called???
> >
> > --
> > Imagine there were no hypothetical situations.
>



-- 
Imagine there were no hypothetical situations.


[web2py] Re: Audit for all tables, independent of CRUD; and transaction rollback.

2011-05-06 Thread DenesL

Have a look at http://web2py.com/book/default/chapter/07#Record-Versioning


On May 6, 6:18 pm, nick name  wrote:
> My use of web2py requires an audit trail for (essentially) all database
> tables; The preferable way to do that is to keep a "foo_history" table for
> each table "foo". The records (both audited and original) need to have a
> "revision" that increments with each update, and "last modified on", "last
> modified by" fields that get updated with the user_id and the time on each
> update.
>
> At this point in time, there is no need to delete records - but if there
> was, I'm not sure what the proper way would be -- possibly having another
> field "deleted" on the audit trail table, which would be set to "true" on
> the revision that was the latest version.
>
> Now, the built in Crud system gives me most of what I want (I don't see how
> to make it keep the history of the deleted table above, though for now
> that's not a problem). But there's quite a bit of application logic that
> needs this which cannot be implemented using the Crud.
>
> The "classic" solution is to write this as stored procedures. I would like
> to avoid that for portability and maintenance reasons. Another solution is
> to use my own "update/insert/delete" methods that update audit tables
> whenever a record updates. That's error prone, and I would rather avoid
> that, especially since I _do_ want to build on web2py infrastructure such as
> Crud for other things.
>
> The solution that I'm thinking of is to hook the DAL; specifically, the
> following functions would be sufficient for me; It seems that all database
> modifications go through them eventually, whether called directly or when
> manipulating Rows or Row objects.
>
> insert: (copy all newly added records to the audit table table - easy)
> update: (copy all modified records to the audit table, add a 'revision =
> revision + 1' to the SET code - easy)
> delete: (copy all deleted records to the audit table, adding a 'deleted =
> True' - possibly a little more complicated)
>
> For completeness, hooking "truncate" and "drop table" to do the same thing
> (either raise an error if that is disallowed, or transform it into a delete
> of each individual record so that everything goes into the audit). And I
> would also disable migrations if I do that, because they may change the
> database without updating my audit trail.
>
> Now, before I start working on a monkey patch (or full patch) to dal.py -
> perhaps I've missed a simpler way to do the same thing?
>
> If I haven't - I'm currently working with Postgres and SQLite; I would like
> to contribute the resulting patch to the web2py project, but have no time to
> evaluate and test on other databases/gae at the moment. Is there anything
> else I should be aware of that would be required for other databases?
>
> 
>
> Finally, a question about transaction rollback - in my app, I sometimes want
> to rollback everything (as if I did e.g. raise
> MySecurityException("Forbidden")), but actually return a non-error HTML
> result to the user. I am aware of db.rollback(), but the exception handling
> code does more, e.g., today it does:
>
>  if response._custom_rollback:
>    response._custom_rollback()
>  else:
>    BaseAdapter.close_all_instances('rollback')
>
> I would suggest adding an "response._transaction_verb" variable, which would
> default to 'COMMIT', but could be changed to 'ROLLBACK', and would determine
> what to do with the database (commit/rollback) in the case of a successful
> completion - meaning raising of an HTTP exception or simple return from
> controller.
>
> On other exception, I would expect rollback always (and the application code
> can call db.commit or BaseAdapter.close_all_instances('commit') or whatever
> if needed) - because committing on error is something that has to be
> extremely explicit.
>
> What say you?


[web2py] Re: help

2011-05-06 Thread Resa
mean i am in index.html and it had a javascript function that holds
redirect to physics.html...
when i load index.html it doesn't go to index.html  at all it skips it
and executed physics.html.. do u understand?
so when the page is loaded it executes the JavaScript without it being
called

On May 6, 7:25 pm, Shishir Ramam  wrote:
> http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-p...
>
> On Fri, May 6, 2011 at 5:21 PM, Resa  wrote:
> > how can i redirect  to another page in a JavaScript function without
> > executing it until the function is actually called???
>
> --
> Imagine there were no hypothetical situations.


Re: [web2py] help

2011-05-06 Thread Shishir Ramam
http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery

On Fri, May 6, 2011 at 5:21 PM, Resa  wrote:

> how can i redirect  to another page in a JavaScript function without
> executing it until the function is actually called???




-- 
Imagine there were no hypothetical situations.


[web2py] help

2011-05-06 Thread Resa
how can i redirect  to another page in a JavaScript function without
executing it until the function is actually called???


Re: [web2py] Re: a new html editor

2011-05-06 Thread pbreit
Just seems like the gray fade wil not fit in with any site design. A solid, 
very light shade of gray or just white I think works better. Looks a little 
Windows-ish which will be a non-starter for many.

Re: [web2py] Re: Error on python2.4

2011-05-06 Thread Tito Garrido
I could solve the problem commenting the sha512 keys setting...

It's not on my code... seems that web2py doesn't support python 2.4
anymore...

On Fri, May 6, 2011 at 6:35 PM, pbreit  wrote:

> Ca we see some code? The lines around line 72 in default.py




-- 

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


Re: [web2py] Re: a new html editor

2011-05-06 Thread ADE
I don't mind the gray. Maybe make the colours easily customizable some how
for it

I agree window should be re-sizable

And tool tips are handy :-)

What I think a lot of these apps miss is the ability to embed youtube videos
and different stuff like that

maybe make a BBCode extension also I don't know

Anyway cool

I like it :D

On Fri, May 6, 2011 at 4:31 PM, pbreit  wrote:

> Not too bad. I've been using NicEdit and am reasonably happy although not
> married to it. Despite the plethora of options, I still haven't one that
> doesn't suck in some way. TinyMCE is way too bloated and outdated. CKeditor
> is also bloated and the new design is horrific.
>
> Regarding yours:
> * don't like the gray background
> * need tool tips
> * textarea needs to be resizable
> * i don't love the slide-in effect
> * i assume it's configurable which buttons show?
>
> As far as integration, it shouldn't need to be too tight. Should simply be
> able to assign it to a  and everything works as usual.
>
> It's a nice exercise but unless you are in it for the long term, I'm not
> sure I would switch to it.
>


[web2py] Re: a new html editor

2011-05-06 Thread pbreit
Not too bad. I've been using NicEdit and am reasonably happy although not 
married to it. Despite the plethora of options, I still haven't one that 
doesn't suck in some way. TinyMCE is way too bloated and outdated. CKeditor 
is also bloated and the new design is horrific.

Regarding yours:
* don't like the gray background
* need tool tips
* textarea needs to be resizable
* i don't love the slide-in effect
* i assume it's configurable which buttons show?

As far as integration, it shouldn't need to be too tight. Should simply be 
able to assign it to a  and everything works as usual.

It's a nice exercise but unless you are in it for the long term, I'm not 
sure I would switch to it.


[web2py] Re: Audit for all tables, independent of CRUD; and transaction rollback.

2011-05-06 Thread pbreit
Check out "auth.signature". It adds and manipulates these columns: 
is_active, created_on, created_by, modified_on, modified_by. I think 
is_active is to be used in place of deleting but I'm not sure. I believe 
it's based on the Table Inheritance 
capability: http://web2py.com/book/default/chapter/06#Table-Inheritance

db.define_table('mytable',
Field('myfield'),
auth.signature)

There's also "auth_event" which I think is what CRUD uses for logging.


[web2py] a new html editor

2011-05-06 Thread elffikk
hi,

I am here to present a work in progress: a lighweight jquery based
html editor

http://8plus2.org/init/static/bolteditor/index.html

it is in alpha version
now it is 10kb of js code + 15kb html+css+images
and of course dependencies jquery and jquery.ui.position


user interface (and just user interface) is from another editor
http://www.openwebware.com/,
some coding ideas from jquery.rte  http://code.google.com/p/rte-light

why another one?
- jquery.rte is not feature rich
- I like openwebware interface but
  - it is not compatible with jquery
  - seems not updated for a few years

I need some feedback, ideas, and suggestions on integration with
web2py

thank you





[web2py] Audit for all tables, independent of CRUD; and transaction rollback.

2011-05-06 Thread nick name
My use of web2py requires an audit trail for (essentially) all database 
tables; The preferable way to do that is to keep a "foo_history" table for 
each table "foo". The records (both audited and original) need to have a 
"revision" that increments with each update, and "last modified on", "last 
modified by" fields that get updated with the user_id and the time on each 
update.

At this point in time, there is no need to delete records - but if there 
was, I'm not sure what the proper way would be -- possibly having another 
field "deleted" on the audit trail table, which would be set to "true" on 
the revision that was the latest version.

Now, the built in Crud system gives me most of what I want (I don't see how 
to make it keep the history of the deleted table above, though for now 
that's not a problem). But there's quite a bit of application logic that 
needs this which cannot be implemented using the Crud.

The "classic" solution is to write this as stored procedures. I would like 
to avoid that for portability and maintenance reasons. Another solution is 
to use my own "update/insert/delete" methods that update audit tables 
whenever a record updates. That's error prone, and I would rather avoid 
that, especially since I _do_ want to build on web2py infrastructure such as 
Crud for other things.

The solution that I'm thinking of is to hook the DAL; specifically, the 
following functions would be sufficient for me; It seems that all database 
modifications go through them eventually, whether called directly or when 
manipulating Rows or Row objects.

insert: (copy all newly added records to the audit table table - easy)
update: (copy all modified records to the audit table, add a 'revision = 
revision + 1' to the SET code - easy)
delete: (copy all deleted records to the audit table, adding a 'deleted = 
True' - possibly a little more complicated)

For completeness, hooking "truncate" and "drop table" to do the same thing 
(either raise an error if that is disallowed, or transform it into a delete 
of each individual record so that everything goes into the audit). And I 
would also disable migrations if I do that, because they may change the 
database without updating my audit trail.

Now, before I start working on a monkey patch (or full patch) to dal.py - 
perhaps I've missed a simpler way to do the same thing?

If I haven't - I'm currently working with Postgres and SQLite; I would like 
to contribute the resulting patch to the web2py project, but have no time to 
evaluate and test on other databases/gae at the moment. Is there anything 
else I should be aware of that would be required for other databases?
 


Finally, a question about transaction rollback - in my app, I sometimes want 
to rollback everything (as if I did e.g. raise 
MySecurityException("Forbidden")), but actually return a non-error HTML 
result to the user. I am aware of db.rollback(), but the exception handling 
code does more, e.g., today it does:

 if response._custom_rollback:
   response._custom_rollback()
 else:
   BaseAdapter.close_all_instances('rollback')

I would suggest adding an "response._transaction_verb" variable, which would 
default to 'COMMIT', but could be changed to 'ROLLBACK', and would determine 
what to do with the database (commit/rollback) in the case of a successful 
completion - meaning raising of an HTTP exception or simple return from 
controller.

On other exception, I would expect rollback always (and the application code 
can call db.commit or BaseAdapter.close_all_instances('commit') or whatever 
if needed) - because committing on error is something that has to be 
extremely explicit.

What say you?


[web2py] Re: Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table

2011-05-06 Thread Massimo Di Pierro
Can you print for me what is in request.vars when you get this error?



On May 6, 2:49 pm, andrej burja  wrote:
> it is not (in 2011-05-05)
> but there is one difference: even when deletable is enabled, i first get the
> error (when there is an upload field)
>
> Field logo_highres__delete does not belong to the table
>
> andrej


[web2py] Re: Error on python2.4

2011-05-06 Thread pbreit
Ca we see some code? The lines around line 72 in default.py

[web2py] Re: Cloud Database

2011-05-06 Thread howesc
google big table is used in conjunction with the Google App Engine.  there 
are several known web2py applications that are successfully deployed on 
Google App Engine.  Google provides hosting for all app engine applications, 
and it's free up to certain daily usage limits.


[web2py] Re: automate web2py startup and shutdown via the command line in linux, OS X and unix etc.

2011-05-06 Thread Christopher Steel
I found an interesting discussion on this here:

http://groups.google.com/group/web2py/browse_thread/thread/1c3621393c7f0a33

It includes a nice one for starting and stopping Web2py from the
command line that Jonathan Lundell made from a script in scripts/

Seems to work great on OS X.

C.

On May 6, 2:14 pm, Christopher Steel  wrote:
> If you are running OS X or some other nix like OS you can use the GUI
> in which case you need to type your administrative password or you can
> go without the GUI in which case you need to manually point your
> browser to the correct location.
>
> You can have both with these two collections of commands run at the
> command line. The first is to start up, the second to shut down.
>
> # STARTUP
> # First we launch web2py, assign password "test" and run on port 8000
> # Then we save our PID (process ID) to a text file to use later when
> we want to shut down
> # Next we take a short snooze for dramatic effect and to make sure
> Web2py is up and running (2 seconds, not bad my friends)
> # Finally we launch a new tab in Firefox with our website. The example
> here works for OS X, you can figure out what it is for your OS
>
> python web2py.py -a test -p 8000&   # launch web2py as process in
> background
> echo $! > PID.TXT&                  # use $! var to get last PID
> started, save to file PID.TXT
> sleep 2                             # take a short nap ...z
> open -a 
> /Applications/Firefox.app/Contents/MacOS/firefox-binhttp://127.0.0.1:8000/&   
>                 # open firefox tab
>
> # SHUTDOWN
> # first we cat the contents of our PID.TXT file and send the output
> the the variable called "pid"
> # Next we run the kill command using the var containing our PID
>
> pid=`cat PID.TXT`                   # grab our web2py PID
> kill -KILL $pid                          # kill the PID


Re: [web2py] Re: python 2.4 support

2011-05-06 Thread Tito Garrido
Same problem to me :(

On Wed, Jul 28, 2010 at 8:27 PM, Cory Coager  wrote:

> Sorry for my delay in testing.  The gluon/tools.py seems to be
> compatible now and the rocket patch seems to work also.  However, the
> hashlib issue still exists as I'm still getting this error:
>
> AttributeError: 'builtin_function_or_method' object has no attribute
> 'new'
>



-- 

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


Re: [web2py] Re: a chance to vote for web2py

2011-05-06 Thread Bruno Rocha
I hope people from "other frameworks" do not come to argue against. I know
people who would do anything not to devalue the money they has
investment in python frameworks.


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Fri, May 6, 2011 at 4:20 PM, cyber  wrote:

> top 8
>
> On 6 май, 23:17, cyber  wrote:
> > *
> > Voted! Top 9!
> > *
> >
> > On 6 май, 21:53, Ovidio Marinho  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > top 9 voted.
> >
> > > Ovidio Marinho Falcao Neto
> > >  ovidio...@gmail.com
> > >  88269088
> > >Paraiba-Brasil
> >
> > > 2011/5/6 Robert Kooij 
> >
> > > > Voted! :)
>


[web2py] Error on python2.4

2011-05-06 Thread Tito Garrido
Folks,

I'm using kinghost.com.br as hosting and I got the following error when I
try to login as a user on web2py:
Traceback (most recent call last):\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/restricted.py", line 181, in
restricted\nexec ccode in environment\n  File
"/home/falavalmir/apps_wsgi/falavalmir/applications/init/controllers/default.py",
line 72, in ?\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/globals.py", line 133, in
\nself._caller = lambda f: f()\n  File
"/home/falavalmir/apps_wsgi/falavalmir/applications/init/controllers/default.py",
line 34, in user\nreturn dict(form=auth())\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/tools.py", line 1038, in
__call__\nreturn self.login()\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/tools.py", line 1450, in
login\nhideerror=self.settings.hideerror):\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/sqlhtml.py", line 1031, in
accepts\nhideerror=hideerror,\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 1720, in
accepts\nstatus = self._traverse(status,hideerror)\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 716, in
_traverse\nnewstatus = c._traverse(status,hideerror) and newstatus\n
File "/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 716, in
_traverse\nnewstatus = c._traverse(status,hideerror) and newstatus\n
File "/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 716, in
_traverse\nnewstatus = c._traverse(status,hideerror) and newstatus\n
File "/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 716, in
_traverse\nnewstatus = c._traverse(status,hideerror) and newstatus\n
File "/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 723, in
_traverse\nnewstatus = self._validate()\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/html.py", line 1493, in
_validate\n(value, errors) = validator(value)\n  File
"/home/falavalmir/apps_wsgi/falavalmir/gluon/validators.py", line 2432, in
__call__\nreturn (hmac.new(self.key, value, alg).hexdigest(), None)\n
File "/usr/lib/python2.4/hmac.py", line 107, in new\nreturn HMAC(key,
msg, digestmod)\n  File "/usr/lib/python2.4/hmac.py", line 42, in
__init__\nself.outer = digestmod.new()\nAttributeError:
\'builtin_function_or_method\' object has no attribute \'new\'


Sorry for this mess but I couldn't get it formated...

Any clue? It uses python 2.4...

-- 

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


[web2py] Re: skinning a cat ...

2011-05-06 Thread Niphlod
go for raw sql if you need to, but be aware that that article was
written in 2007, testing only MS SQL Server behaviour  we are in
2011, MS SQL Server 2008 is on the run (and that article could be
referring only to the 2000 or 2005 version)...

Hopefully MS ingeneers have found (or will find) how to optimize
different queries that lead to the same dataset in the exact same
amount of time.

I don't have the time to test right now, but at work I have to deal
with MS SQL every day...if you want I can do some tests. right now
I wonder also if it will be faster (I'm thinking exclusively to MS
SQL) to do the same query again but using a different approach: left
outer join and checking NULLs.

Web2py implements a way to filter the data as you want (and give you a
chance to use whatever raw query you want to)... it's database's
engineers work to deal with this kind of optimization (or it's on you
to use raw SQL, or to pick another database at all :-P)



On 6 Mag, 18:12, pbreit  wrote:
> I didn't see EXISTS in 
> dal.py:http://code.google.com/p/web2py/source/browse/gluon/dal.py
>
> That seems like it might be a tricky optimization to program but perhaps
> it's possible.
>
> You could also use raw sql:http://web2py.com/book/default/chapter/06#Raw-SQL


[web2py] Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table

2011-05-06 Thread andrej burja
it is not (in 2011-05-05)
but there is one difference: even when deletable is enabled, i first get the 
error (when there is an upload field)

Field logo_highres__delete does not belong to the table

andrej






[web2py] Re: Problem with Mail.Attachment

2011-05-06 Thread pbreit
attachment = Mail.Attachment(filename)

"is not callable" usually means there is something in () that should not 
bet.


[web2py] Re: Multiuser mode issues with uploading project

2011-05-06 Thread Massimo Di Pierro
The point of multi-user model is to allow a teacher to setup an
environment for students. Each student gets one app. There is no
security, nothing to prevent one student to mess up web2py and/or
other students projects.

On May 6, 2:38 pm, ADE  wrote:
> Hello I am trying to figure out Multiuser mode. The issue I am having is
> when a user uploads a project it doesn't appear in there workspace
>
> Another issue is if I upload a project as admin its not editable and in this
> case the project had an error and I could not see those errors, I received
> the message "the project may not exist or you do not have permission" or
> something along those lines
>
> How do I fix this?
>
> I am running debian squeeze apache etc
>
> Any ideas *cheers
>
> Andrew


[web2py] Re: Cloud Database

2011-05-06 Thread pbreit
Google App Engine or MySQL are fine so go with what you are most comfortable 
with. As you get going you'll gain a better understanding of what your needs 
are and what solutions are most appropriate. You can even use both if 
necessary.

[web2py] Multiuser mode issues with uploading project

2011-05-06 Thread ADE
Hello I am trying to figure out Multiuser mode. The issue I am having is
when a user uploads a project it doesn't appear in there workspace

Another issue is if I upload a project as admin its not editable and in this
case the project had an error and I could not see those errors, I received
the message "the project may not exist or you do not have permission" or
something along those lines

How do I fix this?

I am running debian squeeze apache etc

Any ideas *cheers

Andrew


[web2py] sessions2trash.py improved

2011-05-06 Thread Jim Karsten
Ross Peoples and I created a new version of sessions2trash.py. Features 
include: 

   - Deletes expired sessions files only based on sessions actual expiration 
   value. 


   - An option to delete sessions files once, then exit. 


   - An option to set the expiration time, overriding the default 60 
   minutes. 


   - An option to modify the sleep time between executions. 


   - Ability to delete all sessions files regardless of expiration time. 

For help: 
python web2py.py -S app -M -R scripts/sessions2trash.py -A --help 

Examples of typical usage are incuded in the script comments. This script 
works with session files only. 

Everyone is welcome to it. 

Regards 
Jim Karsten #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sessions2trash.py

Run this script in a web2py environment shell e.g. python web2py.py -S app
If models are loaded (-M option) auth.settings.expiration is assumed
for sessions without an expiration. If models are not loaded, sessions older
than 60 minutes are removed. Use the --expiration option to override these
values.

Typical usage:

# Delete expired sessions every 5 minutes
nohup python web2py.py -S app -M -R scripts/sessions2trash.py &

# Delete sessions older than 60 minutes regardless of expiration,
# with verbose output, then exit.
python web2py.py -S app -M -R scripts/sessions2trash.py -A -o -x 3600 -f -v

# Delete all sessions regardless of expiry and exit.
python web2py.py -S app -M -R scripts/sessions2trash.py -A -o -x 0
"""

from gluon.storage import Storage
from optparse import OptionParser
import cPickle
import datetime
import os
import stat
import time

EXPIRATION_MINUTES = 60
SLEEP_MINUTES = 5
VERSION = 0.3


def main():
"""Main processing."""

usage = '%prog [options]' + '\nVersion: %s' % VERSION
parser = OptionParser(usage=usage)

parser.add_option('-o', '--once',
action='store_true', dest='once', default=False,
help='Delete sessions, then exit.',
)
parser.add_option('-s', '--sleep',
dest='sleep', default=SLEEP_MINUTES * 60, type="int",
help='Number of seconds to sleep between executions. Default 300.',
)
parser.add_option('-x', '--expiration',
dest='expiration', default=None, type="int",
help='Expiration value for sessions without expiration (in seconds)',
)
parser.add_option('-f', '--force',
action='store_true', dest='force', default=False,
help=('Ignore session expiration. '
'Force expiry based on -x option or auth.settings.expiration.')
)
parser.add_option('-v', '--verbose',
action='store_true', dest='verbose', default=False,
help='Print verbose output.',
)

(options, unused_args) = parser.parse_args()

expiration = options.expiration
if expiration is None:
try:
expiration = auth.settings.expiration
except:
expiration = EXPIRATION_MINUTES * 60

while True:
trash_session_files(expiration, options.force, options.verbose)

if options.once:
break
else:
time.sleep(options.sleep)


def trash_session_files(expiration, force=False, verbose=False):
"""
Trashes expired session files.

Arguments::
expiration: integer, expiration value to use for sessions without one.
force: If True, ignores session expiration and use value of
expiration argument.
verbose: If True, print names of sessions trashed.
"""
now = datetime.datetime.now()

path = os.path.join(request.folder, 'sessions')
for file in os.listdir(path):
filename = os.path.join(path, file)
last_visit = datetime.datetime.fromtimestamp(
os.stat(filename)[stat.ST_MTIME])

if expiration > 0:
try:
f = open(filename, 'rb+')
session = Storage()
session.update(cPickle.load(f))
f.close()

if session.auth:
if session.auth.expiration and not force:
expiration = session.auth.expiration
if session.auth.last_visit:
last_visit = session.auth.last_visit
except:
pass

if expiration == 0 or \
total_seconds(now - last_visit) > expiration:
os.unlink(filename)
if verbose:
print('Session trashed: %s' % file)


def total_seconds(delta):
"""
Adapted from Python 2.7's timedelta.total_seconds() method.

Args:
delta: datetime.timedelta instance.
"""
return (delta.microseconds + (delta.seconds + (delta.days * 24 * 3600)) * \
10 ** 6) / 10 ** 6

main()


[web2py] Re: a chance to vote for web2py

2011-05-06 Thread cyber
top 8

On 6 май, 23:17, cyber  wrote:
> *
> Voted! Top 9!
> *
>
> On 6 май, 21:53, Ovidio Marinho  wrote:
>
>
>
>
>
>
>
> > top 9 voted.
>
> >         Ovidio Marinho Falcao Neto
> >              ovidio...@gmail.com
> >                      88269088
> >                    Paraiba-Brasil
>
> > 2011/5/6 Robert Kooij 
>
> > > Voted! :)


[web2py] Re: a chance to vote for web2py

2011-05-06 Thread cyber
*
Voted! Top 9!
*

On 6 май, 21:53, Ovidio Marinho  wrote:
> top 9 voted.
>
>         Ovidio Marinho Falcao Neto
>              ovidio...@gmail.com
>                      88269088
>                    Paraiba-Brasil
>
> 2011/5/6 Robert Kooij 
>
>
>
>
>
>
>
> > Voted! :)

[web2py] Problem with Mail.Attachment

2011-05-06 Thread Ross Peoples
Updated web2py from trunk this morning. Something changed in tools.py in the 
last few days that caused the following code to fail:

attachment = (Mail.Attachment(filename))

The error that results:

File "/media/psf/Python/web2py/gluon/tools.py", line 139, in __init__
content_type = contenttype(filename)
TypeError: 'module' object is not callable


[web2py] Re: Compile Error

2011-05-06 Thread Ross Peoples
I think you have an {{include 'file'}} somewhere in one of your templates, 
and it can't find the filename.

[web2py] Re: Cloud Database

2011-05-06 Thread stargate
Can Google BigTable work with web2py and can it be hosted on
http://www.dotcloud.com/ ?

On May 6, 2:16 pm, Bruno Rocha  wrote:
> Google BigTable except for the joins..
>
> On Fri, May 6, 2011 at 3:06 PM, stargate  wrote:
> > If you are starting out a new social site is it better to do it in
> > mySQL first then move to a cloud database.  Which cloud database is
> > better and similar to mySQL slect statements?


Re: [web2py] Re: python/javascript

2011-05-06 Thread TÅ®å ßrown
smiles... thats perfectly ok.. and i understand trust me i do lol..


-- 
Live Laugh Love || Strength, Courage and Wisdom 


Re: [web2py] Re: some new cool stuff in trunk under testing

2011-05-06 Thread Ross Peoples
That would be nice. Also might I suggest a way to import 
gluon.storage.Storage when doing 'from gluon import *'. I find myself using 
Storage a lot, so having that load as a part of 'from gluon import *' would 
be awesome.

Re: [web2py] Cloud Database

2011-05-06 Thread Bruno Rocha
Google BigTable except for the joins..

On Fri, May 6, 2011 at 3:06 PM, stargate  wrote:

> If you are starting out a new social site is it better to do it in
> mySQL first then move to a cloud database.  Which cloud database is
> better and similar to mySQL slect statements?


[web2py] automate web2py startup and shutdown via the command line in linux, OS X and unix etc.

2011-05-06 Thread Christopher Steel
If you are running OS X or some other nix like OS you can use the GUI
in which case you need to type your administrative password or you can
go without the GUI in which case you need to manually point your
browser to the correct location.

You can have both with these two collections of commands run at the
command line. The first is to start up, the second to shut down.

# STARTUP
# First we launch web2py, assign password "test" and run on port 8000
# Then we save our PID (process ID) to a text file to use later when
we want to shut down
# Next we take a short snooze for dramatic effect and to make sure
Web2py is up and running (2 seconds, not bad my friends)
# Finally we launch a new tab in Firefox with our website. The example
here works for OS X, you can figure out what it is for your OS

python web2py.py -a test -p 8000&   # launch web2py as process in
background
echo $! > PID.TXT&  # use $! var to get last PID
started, save to file PID.TXT
sleep 2 # take a short nap ...z
open -a /Applications/Firefox.app/Contents/MacOS/firefox-bin
http://127.0.0.1:8000/&;# open firefox tab


# SHUTDOWN
# first we cat the contents of our PID.TXT file and send the output
the the variable called "pid"
# Next we run the kill command using the var containing our PID

pid=`cat PID.TXT`   # grab our web2py PID
kill -KILL $pid  # kill the PID




[web2py] Compile Error

2011-05-06 Thread Deepan
Hi All,

I am relatively new to web2py. I built a small application it works
perfectly fine, but when I try to compile the applications it results
in an error. It would be great if some one could let me know where i
am going wrong !!!

Here is the trace:

Traceback (most recent call last):
  File "/cube/apps/web2py/gluon/admin.py", line 143, in app_compile
compile_application(folder)
  File "/cube/apps/web2py/gluon/compileapp.py", line 498, in
compile_application
compile_views(folder)
  File "/cube/apps/web2py/gluon/compileapp.py", line 272, in
compile_views
data = parse_template(file, path)
  File "/cube/apps/web2py/gluon/template.py", line 820, in
parse_template
return str(TemplateParser(text, context=context, path=path,
lexers=lexers, delimiters=delimiters))
  File "/cube/apps/web2py/gluon/template.py", line 309, in __init__
self.parse(text)
  File "/cube/apps/web2py/gluon/template.py", line 793, in parse
self.extend(extend)
  File "/cube/apps/web2py/gluon/template.py", line 464, in extend
text = self._get_file_text(filename)
  File "/cube/apps/web2py/gluon/template.py", line 440, in
_get_file_text
self._raise_error('Unable to open included view file: ' +
filepath)
  File "/cube/apps/web2py/gluon/template.py", line 412, in
_raise_error
raise restricted.RestrictedError(self.name, self.text, message)
RestrictedError

Thanks


Re: [web2py] Re: some new cool stuff in trunk under testing

2011-05-06 Thread Jonathan Lundell
On May 6, 2011, at 10:56 AM, Ross Peoples wrote:
> Ignore the part about 'from gluon import current' not working in the models. 
> Restarting the web2py server fixed the problem. I may have forgotten to do 
> that after updating from trunk.
> 
> But out of curiosity, is there a reason other model variables (auth, db, etc) 
> are showing up in current?

Only globals created in gluon are included, nothing from the model.

Suggestion: let's create an empty current.application of type Storage that apps 
can store auth, db, etc in.

Re: [web2py] Re: webfaction python2.5 -> python2.6

2011-05-06 Thread Vasile Ermicioi
I guess you can use nginx 1.0.1, but I send you what I did and I know that
it works

[nginx]
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar xvxf nginx-0.8.54.tar.gz
cd nginx-0.8.54
./configure \
  --prefix=/home/yourusername/nginx \
  --sbin-path=/home/yourusername/nginx/sbin/nginx \
  --conf-path=/home/yourusername/nginx/nginx.conf \
  --error-log-path=/home/yourusername/nginx/log/nginx/error.log \
  --pid-path=/home/yourusername/nginx/run/nginx/nginx.pid  \
  --lock-path=/home/yourusername/nginx/lock/nginx.lock \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --http-log-path=/home/yourusername/nginx/log/nginx/access.log \
  --http-client-body-temp-path=/home/yourusername/nginx/tmp/nginx/client/ \
  --http-proxy-temp-path=/home/yourusername/nginx/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/home/yourusername/nginx/tmp/nginx/fcgi/

[web2py]
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
python2.7 web2py.py #seems needed before using it


[uwsgi]
wget http://projects.unbit.it/downloads/uwsgi-0.9.7.tar.gz
tar xvzf uwsgi-0.9.7.tar.gz
cd uwsgi-0.9.7
make -f Makefile.Py27
mv uwsgi /home/yourusername/bin

#start uwsgi
uwsgi -s /home/yourusername/tmp/uwsgi.sock --pythonpath
/home/yourusername/web2py --module wsgihandler -d
/home/yourusername/tmp/uwsgi.log -t 20 --async 51 --ugreen --limit-as 64 -r
--no-orphans

[memory usage]
ps -u yourusername -o rss,command


nginx_webfaction.conf
Description: Binary data


[web2py] Cloud Database

2011-05-06 Thread stargate
If you are starting out a new social site is it better to do it in
mySQL first then move to a cloud database.  Which cloud database is
better and similar to mySQL slect statements?


[web2py] Re: some new cool stuff in trunk under testing

2011-05-06 Thread Ross Peoples
Ignore the part about 'from gluon import current' not working in the models. 
Restarting the web2py server fixed the problem. I may have forgotten to do 
that after updating from trunk.

But out of curiosity, is there a reason other model variables (auth, db, 
etc) are showing up in current?


Re: [web2py] Re: a chance to vote for web2py

2011-05-06 Thread Ovidio Marinho
top 9 voted.


Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 88269088
   Paraiba-Brasil



2011/5/6 Robert Kooij 

> Voted! :)
>
>


[web2py] Re: webfaction python2.5 -> python2.6

2011-05-06 Thread robsan
I'd appreciate if you could share your insight on that configuration,
as I'm currently using Apache and would like to slim down the setup.

On May 6, 5:29 pm, Vasile Ermicioi  wrote:
> I also use webfaction : python2.7 + uwsgi + nginx
>
> if you like and need help with that configuration...


Re: [web2py] Re: Confusion using experts4solutions

2011-05-06 Thread Jason Brower
Awww... Massimo... is that a tear? I knew you had made a good product, 
but I didn't know you were man enough to cry about it. :)


:P
On 05/06/2011 08:15 PM, Massimo Di Pierro wrote:

:-)


On May 6, 11:15 am, GoldenTiger  wrote:

*>>Massimo Di Pierro*:
*>>  I did not know Ross (or I did not remember). That means there are even

   >>  more people doing experts4solution work than I thought
*
Me too.
My current job is because web2py. It is a high-paying job, no schedules, and
I work from home.
The job requirements were "an expert programmer with extensive demonstrable
knowledge of Python for Network Administration and Web Development"
They had never heard of web2py, but they really liked it when I showed.
I am developing an intranet application for an official organization in my
area.*
*




Re: [web2py] PowerTable editable callback

2011-05-06 Thread Bruno Rocha
Hi Thiago,

from where are you getting the cariable 'value'? can you see an error ticket
on admin?

BTW: PowerTable is in 'alfa' version, I have to finish this plugin (any
volunteer to help?)

The editable functionality is experimental but it works for some cases, let
me explain how it works.

It uses Jquery library JEditable to turn table cells in to text inputs ( in
the future this should handle combo boxes and another widgets), when buiding
a powertable you might specify if it is editable.

tb = plugins.powerTable
tb.datasource = db.table.id>0
tb.extra =
dict(editable={'editablecallback':'URL('default','editablefunction')}
return tb.create()

At this point you have a powerTable with editable cells wich will fire via
Ajax call the function 'editablefunction' passing some values as post
arguments which is 'row_id' and 'column' and 'value'

so you can do something like:
- default.py -
def editablefunction():
 id = request.vars.row_id
 column = request.vars.column
 db(db.table.id==id).update(column=value)


Now with the new stuff in trunk it could be changed, I guess the plugin
needs to be rewriten using thread locals and making some parts better.








--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Fri, May 6, 2011 at 7:37 AM, Tiago Moutinho  wrote:

> Hello,
> I'm using PowerTable and I love it!
> But I have an issue:
>
> I want to edit a column named status, but only that column.
> And i want to alter de value of that column (status) on the databse,
> with an update.
>
> I've made an editable function, but something is missing, i guess,
> because it does not work.
>
> def editablefunction():
>db(db.report.id == row_id).update(status = value)


[web2py] Re: some new cool stuff in trunk under testing

2011-05-06 Thread Ross Peoples
I am still in the process of rewriting my modules and I've run into a 
problem. First, I noticed that auth is not part of current. Only cache, 
session, request, response, and T are a part of current. I have 
z_import_modules.py model that I used to use to import modules using 
local_import(). However, trying to set current.auth = auth in this model 
file tells me that current is not defined. I tried 'from gluon import *' and 
it produced the same result. Also, I tried 'from gluon import current', but 
I get 'ImportError: cannot import name current.'

So it seems you can't touch current within models. And current doesn't store 
auth or db. Is there a problem here or am I doing something wrong?


[web2py] Re: After login bringing up a page link

2011-05-06 Thread Massimo Di Pierro
This may work, but I have not tred it

auth.settings.login_onaccept = lambda form:
session.update(dict(flash=A('click me',_href=URL('index'



On May 6, 11:40 am, JagChris  wrote:
> After logging in, i want a user to see a link popping up on the screen
> so that when they click this link they go straight to a different page?


[web2py] Re: Update application without deleting tables

2011-05-06 Thread Massimo Di Pierro
I think you are using auth but are not running

auth.define_tables()

On May 6, 11:03 am, Marcelo Martinez  wrote:
> reason to remove the tables is because I get the following error:
>
>  ('NoneType' object has no attribute 'insert
> ')
>
> an attachment is the picture with the error.
>
> Once you remove the tables above solves this problem.
>
> 2011/5/6 Kenneth Lundström 
>
>
>
>
>
>
>
> > Hello,
>
> > why do you have to remove the tables?
>
> > What kind of changes are you making to the code?
>
> > Kenneth
>
> >  The problem I have is when I update an application, when loading the
> >> application with the changes I have to remove the tables auth_event,
> >> auth_group, auth_membership, auth_permission.
>
> >> My question is I have to do to avoid having to delete these tables, I
> >> am working with postgresql.
>
>
>
>  error.jpg
> 80KViewDownload


[web2py] Re: Confusion using experts4solutions

2011-05-06 Thread Massimo Di Pierro
:-)


On May 6, 11:15 am, GoldenTiger  wrote:
> *  >>  Massimo Di Pierro*:
> *  >> I did not know Ross (or I did not remember). That means there are even
>
>   >> more people doing experts4solution work than I thought
> *
> Me too.
> My current job is because web2py. It is a high-paying job, no schedules, and
> I work from home.
> The job requirements were "an expert programmer with extensive demonstrable
> knowledge of Python for Network Administration and Web Development"
> They had never heard of web2py, but they really liked it when I showed.
> I am developing an intranet application for an official organization in my
> area.*
> *


[web2py] After login bringing up a page link

2011-05-06 Thread JagChris
After logging in, i want a user to see a link popping up on the screen
so that when they click this link they go straight to a different page?


[web2py] Re: CRUD.search sorting order

2011-05-06 Thread Massimo Di Pierro
Please open an issue in google code


-- Forwarded message --
From: villas 
Date: May 6, 10:56 am
Subject: CRUD.search sorting order
To: web2py-users


Hi Niknok

I have looked at this in a little more detail now.  The main problem
seems to be that web2py does not accept the orderby argument for
crud.search.

** I believe this is a bug **

I think it should be possible to fix this easily enough in tools.py
but it is best if someone with more experience confirms this issue.

Best regards,  D

On May 6, 2:00 pm, niknok  wrote:







> Thanks for the response Villas.

> Do note that my use of
>    fields=['id','last_name','first_name', ...
> is based on examples in the book . I tried your suggestions, sadly,
> I'm getting a KeyError error message. W2P complaining about the
> "db.auth_user" table names... Have you tried this out yourself and is
> it working in your system?

> As for orderby, the use of built-in python functions (i.e.
> orderby=db.auth_user.last_name.lower() ...) are documented in the
> book.

> So I suppose the issue is something else?

> /r

> On May 4, 11:45 pm, villas  wrote:

> > I should have also said that I think the fields should be fields and
> > not strings:
> > i.e.
> > fields = [db.auth_user.id, db.auth_user.last_name, ]

> > On May 4, 2:47 pm, niknok  wrote:

> > > I'm using v1.94.6 and retrieving ordered search results from crud.search
> > > always produces a list sorted by id

> > > Tried various combinations:

> > >     orderby=db.auth_user.last_name
> > >     orderby=db.auth_user.birth_date
> > >     orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()

> > > Attached is a screenshot with orderby set to last entry above.

> > > The code I use is:

> > > form,rows = crud.search(db.auth_user
> > >     ,query=(db.auth_user.account_type==0)&(db.auth_user.id!=auth.user.id)
> > >     ,fields=['id','last_name','first_name','middle_name','birth_date']
> > >     
> > > ,orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()
> > >     ,queries=['equals','contains','starts with','ends with','greater 
> > > than','less than'])

> > > Did I miss anything or doing something wrong here?

> > > /r
> > > Nik

> > >  crud.search-sorting.png
> > > 103KViewDownload


[web2py] Re: Gluon contrib json encoder

2011-05-06 Thread omicron
Yes. But my problem is with jsonrpc service. There is a bug in
tools.py, line 3554 :
replace "return simplejson.dumps(..."
by "return serializers.json(..."


On 6 mai, 18:49, Mathew Grabau  wrote:
> For me to overcome the issues specified by this I switched to using:
>
> return response.json(...stuff to return...)
>
> The datetime encoder is not in there anymore and it was causing me
> trouble. This corrected the issue.
>
> On May 6, 8:20 am, omicron  wrote:
>
>
>
> > Before, the encoder have :
>
> > """Implementation of JSONEncoder
> > Modified by Massimo Di Pierro to handle datetime
> > """
>
> > and now it's not the case in the last stable version ?


[web2py] Re: Gluon contrib json encoder

2011-05-06 Thread Mathew Grabau
For me to overcome the issues specified by this I switched to using:

return response.json(...stuff to return...)

The datetime encoder is not in there anymore and it was causing me
trouble. This corrected the issue.

On May 6, 8:20 am, omicron  wrote:
> Before, the encoder have :
>
> """Implementation of JSONEncoder
> Modified by Massimo Di Pierro to handle datetime
> """
>
> and now it's not the case in the last stable version ?


[web2py] Re: Web2py MySql Tables coming empty

2011-05-06 Thread pbreit
What is line 5 in db.py?

[web2py] Re: ajax:whats wrong with this

2011-05-06 Thread pbreit
I'd like to help but am extremely confused by your code and what you are 
trying to do. I would reiterate trying to start simply, get it to work and 
then add more complexity.

And try to make your code look like code found in the book. It makes it a 
lot easier for us to understand.
http://web2py.com/book/default/chapter/10


Re: [web2py] Re: webfaction python2.5 -> python2.6

2011-05-06 Thread Vasile Ermicioi
I also use webfaction : python2.7 + uwsgi + nginx

if you like and need help with that configuration...


Re: [web2py] Update application without deleting tables

2011-05-06 Thread pbreit
I would suggest trying to figure out the root cause instead of deleting 
tables because that should not be happening.

Re: [web2py] Update application without deleting tables

2011-05-06 Thread pbreit
That's odd. And odd that deleting the tables fixes it. Do you have 
a settings.table_event or settings.table_event_name in any of your models?

You might also try updating to a more current version of Web2py (but this 
should not be necessary).


[web2py] Re: Confusion using experts4solutions

2011-05-06 Thread GoldenTiger
*  >>  Massimo Di Pierro*:
*  >> I did not know Ross (or I did not remember). That means there are even 

  >> more people doing experts4solution work than I thought
*
Me too. 
My current job is because web2py. It is a high-paying job, no schedules, and 
I work from home.
The job requirements were "an expert programmer with extensive demonstrable 
knowledge of Python for Network Administration and Web Development"
They had never heard of web2py, but they really liked it when I showed.
I am developing an intranet application for an official organization in my 
area.*
*

[web2py] Re: skinning a cat ...

2011-05-06 Thread pbreit
I didn't see EXISTS in dal.py:
http://code.google.com/p/web2py/source/browse/gluon/dal.py

That seems like it might be a tricky optimization to program but perhaps 
it's possible.

You could also use raw sql:
http://web2py.com/book/default/chapter/06#Raw-SQL


[web2py] Re: python/javascript

2011-05-06 Thread ron_m
Please don't multiple post the same question. I have seen this question 
posed 3 times in the last day and it has been answered by several people in 
the different instances of the question. If you don't get an answer right 
away it is because:

1) Everyone that might want to answer is getting 3 or 4 hours of sleep
2) Nobody understands the question
3) Most (all) of the people on this message board are volunteers and have 
other jobs, some very demanding.

Thanks for your consideration of us, I think I can speak collectively for 
all on the group, we really do try to help.
Not intended to scare you away.

Ron


[web2py] Re: requires questions

2011-05-06 Thread pbreit
Maybe the IS_EXPR() validator?

IS_EXPR
IS_EXPR

Its first argument is a string containing a logical expression in terms of a 
variable value. It validates a field value if the expression evaluates to 
True. For example:

1.
2.

requires = IS_EXPR 
('int(value)%3==0',
   error_message=T 
('not divisible by 3'))



[web2py] Re: spatial page load by ajax

2011-05-06 Thread Anthony
On Friday, May 6, 2011 1:19:55 AM UTC-4, 黄祥 wrote: 
>
> 

[web2py] Re: CRUD.search sorting order

2011-05-06 Thread villas
Hi Niknok

I have looked at this in a little more detail now.  The main problem
seems to be that web2py does not accept the orderby argument for
crud.search.

** I believe this is a bug **

I think it should be possible to fix this easily enough in tools.py
but it is best if someone with more experience confirms this issue.

Best regards,  D


On May 6, 2:00 pm, niknok  wrote:
> Thanks for the response Villas.
>
> Do note that my use of
>    fields=['id','last_name','first_name', ...
> is based on examples in the book . I tried your suggestions, sadly,
> I'm getting a KeyError error message. W2P complaining about the
> "db.auth_user" table names... Have you tried this out yourself and is
> it working in your system?
>
> As for orderby, the use of built-in python functions (i.e.
> orderby=db.auth_user.last_name.lower() ...) are documented in the
> book.
>
> So I suppose the issue is something else?
>
> /r
>
> On May 4, 11:45 pm, villas  wrote:
>
> > I should have also said that I think the fields should be fields and
> > not strings:
> > i.e.
> > fields = [db.auth_user.id, db.auth_user.last_name, ]
>
> > On May 4, 2:47 pm, niknok  wrote:
>
> > > I'm using v1.94.6 and retrieving ordered search results from crud.search
> > > always produces a list sorted by id
>
> > > Tried various combinations:
>
> > >     orderby=db.auth_user.last_name
> > >     orderby=db.auth_user.birth_date
> > >     orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()
>
> > > Attached is a screenshot with orderby set to last entry above.
>
> > > The code I use is:
>
> > > form,rows = crud.search(db.auth_user
> > >     ,query=(db.auth_user.account_type==0)&(db.auth_user.id!=auth.user.id)
> > >     ,fields=['id','last_name','first_name','middle_name','birth_date']
> > >     
> > > ,orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()
> > >     ,queries=['equals','contains','starts with','ends with','greater 
> > > than','less than'])
>
> > > Did I miss anything or doing something wrong here?
>
> > > /r
> > > Nik
>
> > >  crud.search-sorting.png
> > > 103KViewDownload
>
>


[web2py] Re: validator for self-join

2011-05-06 Thread pbreit
I think this might be what you want:

crud.settings.create_onvalidation.mytablename.append(lambda form:)

http://web2py.com/book/default/chapter/07#Settings


[web2py] Re: python/javascript

2011-05-06 Thread Massimo Di Pierro
No. You have to send h to the server via ajax. The "message: variable
lives in the server, not the client.

On May 6, 6:13 am, Resa  wrote:
> how can i put javascript in a python variable eg
>
> var h-"hello"
> {{message}}=h
> can this work and if not how can i do it?


[web2py] Re: Chunked downloads and corrupt files with Internet Explorer 8 (IE8)

2011-05-06 Thread Massimo Di Pierro
Can you try 1.95.1

On May 6, 6:03 am, Stefan Scholl  wrote:
> The classic download function:
>
> def download():
>     return response.download(request, db)
>
> I'm developing on localhost (127.0.0.1, no SSL) and one strange thing
> happened: Downloads in IE8 (Windows XP) were all corrupt/broken if
> they weren't below 64KiB in size. Very easy to see with large images.
>
> Using a higher value for the argument 'chunk_size' solves this
> problem, up to this new maximum.
>
> web2py 1.91.6


[web2py] Re: Gluon contrib json encoder

2011-05-06 Thread pbreit
Looks like the whole package was updated March 1:
http://code.google.com/p/web2py/source/detail?r=8b84ce8b08ebe4af15778d54dc3fc898d159055e&path=/gluon/contrib/simplejson/encoder.py


[web2py] Re: 1.95.1 - Field delete_this_record does not belong to the table

2011-05-06 Thread Massimo Di Pierro
I believe this is fixed in trunk. Can you confirm?

On May 6, 4:05 am, andrej burja  wrote:
> After upgrading to 1.95.1 (on windows, from source) get error:
>
> Traceback (most recent call last):
>   File "...\gluon\restricted.py", line 181, in restricted
>     exec ccode in environment
>   File ".../controllers/racun.py" 
> , line 
> 65, in 
>   File "...\gluon\globals.py", line 133, in 
>     self._caller = lambda f: f()
>   File "...\gluon\tools.py", line 2335, in f
>     return action(*a, **b)
>   File ".../controllers/racun.py", line 26, in racun_uredi
>     if form.accepts(request.vars, session):
>   File "...\gluon\sqlhtml.py", line 1200, in accepts
>     self.table._db(self.table.id == self.record.id).update(**fields)
>   File "...\gluon\dal.py", line 5173, in update
>     fields = self.db[tablename]._listify(update_fields,update=True)
>   File "...\gluon\dal.py", line 4464, in _listify
>     raise SyntaxError, 'Field %s does not belong to the table' % name
> SyntaxError: Field delete_this_record does not belong to the table
>
> in controller i change
> crud.update()
> to
> crud.update( ,deletable=False)
> and the error is gone
>
> but in the form with upload fields i now get:
>
> Traceback (most recent call last):
>   File "...\gluon\restricted.py", line 181, in restricted
>     exec ccode in environment
>   File ".../controllers/izobrazevanje.py", line 98, in 
>   File "...\gluon\globals.py", line 133, in 
>     self._caller = lambda f: f()
>   File "...\gluon\tools.py", line 2335, in f
>     return action(*a, **b)
>   File ".../controllers/izobrazevanje.py", line 15, in izobrazevanje_uredi
>     if form.accepts(request.vars, session):
>   File "...\gluon\sqlhtml.py", line 1200, in accepts
>     self.table._db(self.table.id == self.record.id).update(**fields)
>   File "...\web2py\gluon\dal.py", line 5173, in update
>     fields = self.db[tablename]._listify(update_fields,update=True)
>   File "...\gluon\dal.py", line 4464, in _listify
>     raise SyntaxError, 'Field %s does not belong to the table' % name
> SyntaxError: Field logo_highres__delete does not belong to the table
>
> logo_highres is upload filed
>
> this was not a problem in previous version (1.94)


[web2py] PowerTable editable callback

2011-05-06 Thread Tiago Moutinho
Hello,
I'm using PowerTable and I love it!
But I have an issue:

I want to edit a column named status, but only that column.
And i want to alter de value of that column (status) on the databse,
with an update.

I've made an editable function, but something is missing, i guess,
because it does not work.

def editablefunction():
db(db.report.id == row_id).update(status = value)


[web2py] PowerTable editable callback

2011-05-06 Thread Tiago Moutinho
Hello,
I'm using PowerTable and I love it!
But I have an issue:

I want to edit a column named status, but only that column.
And i want to alter de value of that column (status) on the databse,
with an update.

I've made an editable function, but something is missing, i guess,
because it does not work.

def editablefunction():
db(db.report.id == row_id).update(status = value)


[web2py] Web2py MySql Tables coming empty

2011-05-06 Thread vrathore
Hello There,

I am connecting to my existing Mysql DB, i am able to connect, but i
am getting tables empty.
Here is the Sample Code
db=SQLDB('mysql://varun:VaruN@192.168.0.240:3306/test')
print db
print "gettables" ,db.tables

I get the following respose on the console
database  , 'che
ck_reserved': None, '_uri': 'mysql://varun:VaruN@192.168.0.240:3306/
test_ytk', '
tables': [], '_fake_migrate_enabled': False, '_migrate': True,
'_pool_size': 0}>

"gettables"[]

On the Ticket Response on admin i see this error
Traceback (most recent call last):
  File "gluon/restricted.py", line 181, in restricted
  File "E:/Projects/Web2Pye/web2py_win/web2py/applications/TSearch/
models/db.py", line 5, in 
  File "gluon/dal.py", line 4042, in __getitem__
KeyError: 'person'


[web2py] crud update weirdness

2011-05-06 Thread Mike
I'm trying to utilize crud update but for some reason the submission
is not working right. I'm trying to send the page to a crud update
page using this logic:

VIEW:
{{=FORM(INPUT(_type='submit',_value = 'Edit'),
hidden=dict(Record=row.id),_action='hostname_modify')}}

CONTROLLER FOR CRUD:
def hostname_modify():
 
form=crud.update(db.vstk_hostnames,request.vars.Record,deletable=False,next=URL('default','licmgmt'))
return dict(form=form)

That seems to get me to the form, and I even added some debugging to
make sure the Record variable is passing through. The problem is I
fill out that form and hit submit, the page refreshes and I just see
the same page again (except the debugging code indicates the Record
variable is now 'None'). After the second time I get 'Record Updated'
and am redirected. When I check the database I see a new Row has been
created but I was really trying to update the existing row that has
the id of the Record variable.


I know it's something silly I am missing here - let me know if anyone
can provide some pointers or advice.

Thanks!
Mike


[web2py] Re: webfaction python2.5 -> python2.6

2011-05-06 Thread pbreit
Is this what you want?

http://docs.webfaction.com/software/python.html


   1. Open an SSH session.
   2. Open ~/.bash_profile in a text editor.
   3. On a new line, add alias python=python*X.Y* where *X.Y* is the Python 
   version number. For example, to use Python 2.6 by default, add a new line 
   containing alias python=python2.6.
   4. Save and close the file.
   5. Reload ~/.bash_profile. Enter source ~/.bash_profile and press Enter


I always like to start from scratch if I can!




Re: [web2py] Update application without deleting tables

2011-05-06 Thread Kenneth Lundström

Hello,

why do you have to remove the tables?

What kind of changes are you making to the code?


Kenneth


The problem I have is when I update an application, when loading the
application with the changes I have to remove the tables auth_event,
auth_group, auth_membership, auth_permission.

My question is I have to do to avoid having to delete these tables, I
am working with postgresql.




[web2py] Re: Update application without deleting tables

2011-05-06 Thread pbreit
I believe this will do it although I have not tested:

# ## if none, they will be created
settings.table_group = True
settings.table_membership = True
settings.table_permission = True
settings.table_event = True

I usually just ignore them. One thing I do is turn off automatic group 
creation for each user: settings.create_user_groups = False


[web2py] Re: represented fields and jqgrid

2011-05-06 Thread pbreit
I'm not sure this is a valid function: config.member_status.get(i)

Where did you get that?


[web2py] Re: represented fields and jqgrid

2011-05-06 Thread Ross Peoples
I had similar issues with computed fields. I don't know if this helps or 
not, but it looks like you are using member_status as a selection of hard 
coded options. This is what I do:

db.member_statuses = {
  1: 'Active',
  2: 'Inactive',
}
db.define_table('auth_user_extended',
  Field('auth_user', db.auth_user),
  Field('member_status', 'int', requires=IS_IN_SET(db.member_statuses), 
default=1),
  ...
)

Then when the field is represented, it should use the values from dictionary 
('Active' or 'Inactive') automatically without having to set represent. I 
hope this helps, as it's worked for me pretty well so far.


[web2py] Re: how do you put a JavaScript variable in a python variable

2011-05-06 Thread pbreit
I suppose you could do this but I'm not really sure why you'd want to. What 
are you trying to do?

{{js = XML("alert('Hello.');")}}
{{=js}}


Re: [web2py] Re: a chance to vote for web2py

2011-05-06 Thread Robert Kooij
Voted! :)



[web2py] Update application without deleting tables

2011-05-06 Thread mmartinez
The problem I have is when I update an application, when loading the
application with the changes I have to remove the tables auth_event,
auth_group, auth_membership, auth_permission.

My question is I have to do to avoid having to delete these tables, I
am working with postgresql.


[web2py] Re: how do you put a JavaScript variable in a python variable

2011-05-06 Thread ron_m
In a typical view file you have to think about where the execution will 
occur.

The Python code in the view will run on the server as part of the page 
generation process, the page is shipped out to the user's browser as the 
response and will be HTML and Javascript and the Javascript that possibly is 
embedded in that page is run by the user's browser. Given that situation 
there is no longer any Python code for the Javascript to assign a variable 
into.

Your only hope is to generate an AJAX request from the Javascript which will 
send a new request to the server as a way to interact back with the Python 
code on the server.


[web2py] Re: Component's non-ascii response.flash does not show well in IE and Firefox

2011-05-06 Thread Iceberg
You did not see them, because I did not mail them. :-)

Well, nice to see two fixes are in. But your fix to issue 260 breaks
all response.js feature. I've write some comment in the code review.
Read the "line-by-line comment" here please.
http://code.google.com/p/web2py/source/detail?r=01fc4d0b7feb669f3804e1fb1c94d3d1f01619de


Regards,
Ray Luo

On May 6, 11:14 am, Massimo Di Pierro 
wrote:
> I apologize. Missed both patches.
> You did not email them to me and I did not see them. :-)
>
> Massimo
>
>
>
> On May 5, 9:38 pm, Iceberg  wrote:
>
> > Bug fixed. The culprit is exactly the utf8 encoding. Javascript only
> > accepts Unicode string, not utf8. Most browsers stick to this
> > standard, only Chrome can accept utf8 also.
>
> > The fix is mentioned inhttp://code.google.com/p/web2py/issues/detail?id=260
>
> > By the way, my another fix 
> > tohttp://code.google.com/p/web2py/issues/detail?id=221
> > is still not accepted into trunk?
>
> > Regards,
> > Ray Luo (a.k.a. Iceberg)


[web2py] how do you put a JavaScript variable in a python variable

2011-05-06 Thread Resa
how can i put javascript in a python variable eg

var h-"hello"
{{message}}=h
can this work and if not how can i do it?


[web2py] webfaction python2.5 -> python2.6

2011-05-06 Thread olivier
hi there,

I have an old installation of web2py on webfaction.  It is using
mod_wsgi 2.5 and Python 2.5.4
How can I a upgrade to python 2.6? (I need it for some modules I plan
to use)
Should I start a new installation from scratch or is there a simpler
way to migrate to mod_wsgi 3.3 and Python 2.6?

Thanks in advance!


[web2py] Re: vertical submenu width pb

2011-05-06 Thread francois
ok that's good,
yesterday I was not having the right glasses.

thank you

Francois

On 5 mai, 20:20, Anthony  wrote:
> I see a few problems:
>
>    - It should be =MENU(...), not MENU=(...)
>    - The arguments should be separated by commas, not spaces.
>    - _lu_class should be ul_class.
>
> So, try:
>
> {{=MENU(response.menu,_class='sf-menu', ul_class='my-class',
> li_class='my-class')}}
>
> Anthony
>
>
>
>
>
>
>
> On Thursday, May 5, 2011 6:30:15 PM UTC-4, francois wrote:
> > Hi,
>
> > I have a submenu pb width (too small), where is the class web2py-menu-
> > vertical?
> > because if I try to add ul_class = 'my-class' and li_class = 'my-
> > class', they are assigned to top-level menu and
> > submenu remains with li class = "menu-expand-web2py" and ul class =
> > "web2py-menu-vertical "
> > eg in layout.html
> > {{#-- Superfish menu --}}
> > {{MENU = (response.menu, _class = 'sf-menu ' _lu_class = 'my-class'
> > li_class = 'my-class')}}
>
> > the html result
> >  > href="">HomeLunettes > href="">Lentilles > href="">Visage > href="i">Envoyer votre photoRéglages
>
> > in my menu, "Envoyer votre photo"is written on two lines.
>
> > Thanks
>
> > Francois


[web2py] PowerTable editable callback

2011-05-06 Thread Francisco Costa
Hello,
I'm using PowerTable and I love it!
But I have an issue:

I want to edit a column named status, but only that column.
And I want to alter de value of that column (status) on the databse,
with an update.

I've made an editable function, but something is missing, I guess,
because it doesn't work.

def editablefunction():
   db(db.report.id == row_id).update(status = value)


[web2py] Re: validator for self-join

2011-05-06 Thread Dave
I'm having trouble getting a custom validator to work with the crud
form.  Is the is the correct implementation?

def f(form):
#if form.vars.id == form.vars.myfield:
form.errors.myfield = 'cannot be same as id'

...

form = crud.update(db.mytable,myrecord,onvalidation=f)

...


The form still works fine, but this doesn't ever display an error
message even if i remove the if statement in the validator.  Are
custom validators done differently for CRUD and SQLFORM forms?

Thanks!
DR

On May 5, 7:49 am, Massimo Di Pierro 
wrote:
> You will need your own. It may be easier to use the onvalidate
> attribute of the crud.update/crud.create forms
>
> On May 5, 8:29 am, Dave  wrote:
>
> > I'm using aself joinon one of my data tables, and need a validator
> > that makes sure a record isn't joined to itself.   I also need to
> > combine it with 2 other validators, IS_NULL_OR and IS_IN_DB.
> > currently it looks like this:
>
> > db.mytable.myfield.requires=IS_NULL_OR(IS_IN_DB(db,'mytable.id'))
>
> > but i need to add one more check to make sure mytable.myfield does not
> > equal mytable.id.  Is there something like this available or do i need
> > to create a custom validator?
>
> > Thanks,
> > DR
>
>


[web2py] Gluon contrib json encoder

2011-05-06 Thread omicron
Before, the encoder have :

"""Implementation of JSONEncoder
Modified by Massimo Di Pierro to handle datetime
"""

and now it's not the case in the last stable version ?


[web2py] Re: represented fields and jqgrid

2011-05-06 Thread niknok
bump...

Anyone?

On May 5, 8:27 am, niknok  wrote:
> I .represent a field as follows:
>
>         db.auth_user.gender.represent=lambda i: db.aux_gender[i].concept[:1] 
> if i>0 else '?'
>         db.auth_user.member_status.represent=lambda i: 
> config.member_status.get(i)[:1] or '?'
>
> The first one works, and displays data in jqgrid as expected:'M','F'
> or'?'. The second only shows a blank cell in jqgrid.
>
> I tried a DAL select query and crud.search and the data is represented
> correctly.


[web2py] requires questions

2011-05-06 Thread niknok
I'm doing a requires statement so the id number matches a prescribed
format, encrypt it, and then store it in the database (if it isn't a
duplicate number) 


db.card.id_number.requires=[eval(db.agency[int(request.vars.id_number)].regex),CRYPT(),IS_NOT_IN_DB(db,'card.id_number')


Do you use eval() and strings for validation? I've tested eval() in a
Shell for validation like: 

eval(db.agency[id].regex)('')

where regex column is something like: "IS_MATCH('^\\d{3}-\\d{4}-\\d{4}-\
\d{1}?$')" or Null, and it works! The idea, is that every record in the
administrative table comes with the regex needed to validate the id
number.

But when I try it in a requires statement, it complains that
request.vars.id_number is not valid, but I couldn't place an expression
inside eval(). I already have a CRUD form that uses a validation routine
called by onaccept, but I'm wondering if I could replace it instead with
just a requires statement. 

I use it like this in my custom validation:

if (db.agency[int(form.vars.issuer)].regex and\
eval(db.agency[int(form.vars.issuer)].regex)(form.vars.id_number)[1]!= 
None):
form.errors.id_number='Enter id number exactly as shown in your card.'

Looking forward to hear your suggestions. TIA.

/r
Nik 


[web2py] skinning a cat ...

2011-05-06 Thread niknok
this SQL statement :

SELECT agency.card_type FROM agency 
WHERE agency.id NOT IN (select issuer from card where person=1)

is equivalent in DAL:


registered_cards=db(db.card.person==1)(db.card.issuer==db.agency.id)._select(db.card.issuer)
unregistered_cards=db((db.agency.is_active==True) & 
(~db.agency.id.belongs(registered_cards)))


The following SQL statement is functionally the same as above:

SELECT a.card_type FROM agency AS a
WHERE NOT EXISTS (SELECT issuer FROM card as c WHERE c.issuer=a.id AND 
c.person=1)

But according to this page, EXISTS operator (also UNION ALL, LEFT JOIN)
is more efficient and several factors faster than NOT IN:
http://weblogs.sqlteam.com/peterl/archive/2007/09/20/Finding-records-in-one-table-not-present-in-another-table.aspx

I'm curious if there is an EXISTS operator equivalent in DAL?

/r 
Nik


[web2py] Re: CRUD.search sorting order

2011-05-06 Thread niknok
Thanks for the response Villas.

Do note that my use of
   fields=['id','last_name','first_name', ...
is based on examples in the book . I tried your suggestions, sadly,
I'm getting a KeyError error message. W2P complaining about the
"db.auth_user" table names... Have you tried this out yourself and is
it working in your system?

As for orderby, the use of built-in python functions (i.e.
orderby=db.auth_user.last_name.lower() ...) are documented in the
book.

So I suppose the issue is something else?

/r

On May 4, 11:45 pm, villas  wrote:
> I should have also said that I think the fields should be fields and
> not strings:
> i.e.
> fields = [db.auth_user.id, db.auth_user.last_name, ]
>
> On May 4, 2:47 pm, niknok  wrote:
>
>
>
>
>
>
>
> > I'm using v1.94.6 and retrieving ordered search results from crud.search
> > always produces a list sorted by id
>
> > Tried various combinations:
>
> >     orderby=db.auth_user.last_name
> >     orderby=db.auth_user.birth_date
> >     orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()
>
> > Attached is a screenshot with orderby set to last entry above.
>
> > The code I use is:
>
> > form,rows = crud.search(db.auth_user
> >     ,query=(db.auth_user.account_type==0)&(db.auth_user.id!=auth.user.id)
> >     ,fields=['id','last_name','first_name','middle_name','birth_date']
> >     ,orderby=db.auth_user.last_name.lower()|db.auth_user.first_name.lower()
> >     ,queries=['equals','contains','starts with','ends with','greater 
> > than','less than'])
>
> > Did I miss anything or doing something wrong here?
>
> > /r
> > Nik
>
> >  crud.search-sorting.png
> > 103KViewDownload


  1   2   >