[web2py] Slow queries or how to determine if cache is working?

2012-02-24 Thread pbreit
I'm struggling to figure out if caching is working. I insert a list of 
categories on pages where I show a bunch of items for sale. First, I only 
have 400 items in the DB and it takes quite a bit longer than I would 
expect to display the first time. Second, I am trying to cache the query 
and it doesn't appear to speed up at all. Does this mean my problem might 
be elsewhere? Is there any way to tell that caching is working?

Here is my page:
http://pricetack.com/items

The component (I've tried cache.disk as well):

def item_groupings():
seller = db(db.auth_user.name==request.vars.seller).select().first()
if seller:
groupings = db((db.item.status=='active') &
(db.item.seller==seller) &
(db.item.grouping!='test')).select(db.item.grouping,
orderby=db.item.grouping, distinct=True)
else:
groupings = db((db.item.status=='active') &
(db.item.grouping!='test')).select(db.item.grouping,
orderby=db.item.grouping, distinct=True, cache=(cache.ram, 
360))
return dict(groupings=groupings)

Maybe I should try to generate the HTML in the controller?


[web2py] Re: BELONGS is not supported on GAE?

2012-02-24 Thread Peter G.
BrendanC: Thanks for those resources! I ended up gutting that
functionality for now, but those are some great read :)! The non-
relational database backend requires some "unlearning" of SQL database
practices... New challenge for a new environment.

I also have not gotten a local shell working with GAE; it would be
really helpful for interactive development if it existed!

howesc: I'm using the latest stable version (1.99.4). While your
method works as a work around of sorts, it's far too crippled by GAE's
non-relational nature. I would potentially need dozens of queries in
order to fetch all possible mootGroups since GAE limits IN to only 30
items per query! So I simply had to de-normalize the database and gut
the feature I was working on from before.

Thank you both for your helpful replies, I'll definitely be asking
more questions as I hobble along ;)!


Re: [web2py] Re: [w2py-dev] model less apps (a blog example)

2012-02-24 Thread Johann Spies
On 10 February 2012 08:37, Bruce Wade  wrote:

> Ok so I came up with a little bit of a different approach then you have,
> it seems to be working for me. I did this pretty fast so it will require
> some improvements.
>

I have adapted your method ...

>
> First create a module:
> test.py
> #!/usr/bin/env python
> # coding: utf8
> from gluon import *
>
> class TestMe(object):
>
> def __init__(self, db):
> self.db = db
> self.T = current.T
> self.auth = current.session.auth
> self.tablename = "test_me"
>
> self.define_tables()
>
> def define_tables(self):
> if self.tablename not in self.db.tables:
> table = self.db.define_table(self.tablename,
> Field('secret'),
> Field('answer')
> )
> ...
>
> To fix this edit appadmin.py:
> from test import TestMe
> testme = TestMe(db)
>
> Now the database table is only ever created if it isn't in the db.tables
> object, and you can use it per action, and in appadmin.
>
>
The tables show up in appadmin but not the content and  I cannot do csv
import or export:

 __call__() got an unexpected keyword argument
'ignore_common_filters'

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Re: web admin interface doesn't see my app

2012-02-24 Thread Jake Richter
I just have my git repos on Dropbox, I set up as it is
here.Then I went to
web2py/applications and did

git clone ~/Dropbox/git-repos/name-of-app.git

The web interface didn't see it that way so I created the app from the web
interface, deleted all the files and copied and pasted it over.



On Fri, Feb 24, 2012 at 9:37 PM, pbreit  wrote:
> That should work although I would not advise it (it's not clear to me that
> git works properly with identical folders on different machines; that's
not
> really how version control is supposed to be set up). Is your whole web2py
> directory in your Dropbox folder?
>
> I'd recommend getting on Bitbucket or something if possible. It's a little
> more clunky because you have to explicitly push and pull. But might be
> worthwhile in the long run.


[web2py] Re: web admin interface doesn't see my app

2012-02-24 Thread pbreit
That should work although I would not advise it (it's not clear to me that 
git works properly with identical folders on different machines; that's not 
really how version control is supposed to be set up). Is your whole web2py 
directory in your Dropbox folder?

I'd recommend getting on Bitbucket or something if possible. It's a little 
more clunky because you have to explicitly push and pull. But might be 
worthwhile in the long run.


Re: [web2py] web admin interface doesn't see my app

2012-02-24 Thread Jake Richter
I have restarted the server a couple times...

in the meanwhile, I created an app and copied and pasted all the
files, but that was annoying. There has to be an easier way.

--
Jake


On Fri, Feb 24, 2012 at 9:17 PM, Bruce Wade  wrote:
> Did you try restarting the server? I found a few times the admin didn't see
> my application however after I restarted the server I didn't have the issue.
>
>
> On Fri, Feb 24, 2012 at 5:27 PM, Jake Richter  wrote:
>>
>> Hello group,
>>
>> I started working on an app from computer A. Using git with Dropbox, I
>> cloned the repo to computer B. I want to work on it through the web
>> admin interface on computer B, but when I fire up the web2py server
>> and go to admin interface, it doesn't see the app, even though it's
>> living in the same directory as all the other applications, namely
>> web2py/applications/name-of-app .
>>
>> How do I get web admin interface to recognize this app?
>>
>> --
>> Jake
>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com


Re: [web2py] web admin interface doesn't see my app

2012-02-24 Thread Bruce Wade
Did you try restarting the server? I found a few times the admin didn't see
my application however after I restarted the server I didn't have the issue.

On Fri, Feb 24, 2012 at 5:27 PM, Jake Richter  wrote:

> Hello group,
>
> I started working on an app from computer A. Using git with Dropbox, I
> cloned the repo to computer B. I want to work on it through the web
> admin interface on computer B, but when I fire up the web2py server
> and go to admin interface, it doesn't see the app, even though it's
> living in the same directory as all the other applications, namely
> web2py/applications/name-of-app .
>
> How do I get web admin interface to recognize this app?
>
> --
> Jake
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] web admin interface doesn't see my app

2012-02-24 Thread Jake Richter
Hello group,

I started working on an app from computer A. Using git with Dropbox, I
cloned the repo to computer B. I want to work on it through the web
admin interface on computer B, but when I fire up the web2py server
and go to admin interface, it doesn't see the app, even though it's
living in the same directory as all the other applications, namely
web2py/applications/name-of-app .

How do I get web admin interface to recognize this app?

--
Jake


[web2py] Re: I would like to learn Web2py but where do I start?

2012-02-24 Thread BrendanC
Another suggestion for learning is Python Koans - based on Ruby Koans - 
basically an interactive way to learn and test code by writing short lines 
of code.

https://bitbucket.org/gregmalcolm/python_koans/wiki/Home

Check them out!

On Thursday, February 23, 2012 12:34:08 PM UTC-8, newbie wrote:
>
> Hello, 
>
> I would like to learn Web2py but know nothing about programming.  I'm 
> convinced it's the best language out there so I don't want to waste 
> time learning something that would not be applicable if I ended up 
> using Web2py (PHP, etc).  Do I need to learn Javascript first?  Do I 
> need to know HTML?  I would eventually like to learn how to build 
> database driven websites. 
>
> Thanks



[web2py] Re: Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Anthony

>
> Thanks Anthony. I am thrilled to be part of this web2py community. Your 
> suggestion worked and after making the change to just 'amy' the IE 9 edting 
> screen looks perfect.
>

If you don't like the dark background, you can edit the color scheme in the 
bundle_python.js and bundle_markup.js files in the /admin/static/eamy 
folder. 


[web2py] Re: I would like to learn Web2py but where do I start?

2012-02-24 Thread mikech
Hi Newbie,

If you think you'll stick around it would be good to have your real name 
somewhere.  Here is a book 
on Python that has gotten a lot of attention recently.  It starts you from 
the very beginning.

http://learnpythonthehardway.org/ 

On Thursday, February 23, 2012 12:34:08 PM UTC-8, newbie wrote:
>
> Hello, 
>
> I would like to learn Web2py but know nothing about programming.  I'm 
> convinced it's the best language out there so I don't want to waste 
> time learning something that would not be applicable if I ended up 
> using Web2py (PHP, etc).  Do I need to learn Javascript first?  Do I 
> need to know HTML?  I would eventually like to learn how to build 
> database driven websites. 
>
> Thanks



[web2py] Re: Photo Gallery

2012-02-24 Thread peter
To see what the current repository deployed on fluxflex looks like, go
to

kathykuck.fluxflex.com/gallery

When Kathy logs in, using the usual web2py way of doing this, 3 new
headings appear, allowing her to edit images, edit galleries and edit
the personal information. Only the first registered user is allowed to
do this. The second gallery is currently empty.

As flux flex is free for small sites like this, one can give an artist
a free site that they have control over.

Peter



On Feb 24, 10:48 pm, peter  wrote:


[web2py] Re: Photo Gallery

2012-02-24 Thread peter
I have written a web2py application that creates a website for eg an
artist. It has a home page, biography and contact page plus it has
galleries. Each gallery has pictures, pictures can be clicked on and
viewed, and one can go from one picture to the next.

It could be used just for photographs. It works as is, but I am
currently developing it.

You can look at the code here:

https://github.com/hutchi0/web2py-for-fluxflex

To see a working demo of a very similar version go to.

ukjazz.net/gallery.

I will announce it properly later, but it might well help you now.

It does not use lightbox, It is just python and web2py. It does use
PIL

It works on fluxflex. You can just deploy the repository onto fluxflex
and you should have a working gallery. You would probably wise to fork
it, otherwise you will get my changes in the future.

Two things that might be interesting, are building thumbnails
automatically, and using ckeditor, so there is Wysiwyg for editing the
biography and home page.

The idea of this application is tha artist, or photographer or whoever
can manage the site themselves.


Peter


On Feb 24, 8:56 pm, Chris Hawkes  wrote:
> Noobmusic.com uses lightbox with Google app engine.  You probably need to 
> show us the entire page you are trying to get to work.   Your problem is 
> probably something to do with class names or JavaScript includes.
>
> Sent from my Samsung smartphone on AT&T
>
>
>
>
>
>
>
> Anthony  wrote:
> >Lightbox is a client-side Javascript library and doesn't really have
> >anything to do with web2py -- as long as you set it up properly, it should
> >work with web2py (or any backend framework). If you show some code, though,
> >perhaps we can figure out the problem.
>
> >Anthony
>
> >On Friday, February 24, 2012 1:08:23 PM UTC-5, Adriano Almeida wrote:
>
> >> Hi folks,
>
> >> I have been trying to create a image gallery for a website that I´ll
> >> be hosting on GAE. I am trying to use
> >>http://lokeshdhakar.com/projects/lightbox2/
> >> but I cannot make it work.
>
> >> When clicking on the link the would open the box and the fotos nothing
> >> happens.
>
> >> Is there anybody that could make web2py and the lightbox work
> >> together?
>
> >> Thanks in advance


[web2py] Re: Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Alok

On Friday, February 24, 2012 12:08:15 PM UTC-8, Anthony wrote: 
>
> On Friday, February 24, 2012 2:01:07 PM UTC-5, Alok wrote: 
>>
>> Hi Friends,
>> Excuse me if this question has been answered. Also I am new to web2py but 
>> I love, just love what I have seen so far.
>> One issue which is bothering me though is this.
>> When I try and edit a file using the Web based editor in Windows 7 and IE 
>> 9, and bring up the file, the program starts either highlighting or 
>> unhighlighting each and every line. This happens painfully slowly. On top 
>> of thisn when I try to click on a empty line, either the click does not 
>> register or the opposite process starts. If the lines were highlighted, 
>> they start becoming unhighlighted and if they were unhighlighted then they 
>> start becoming highlighted. (Highlighted=Selected)
>>
>
> If you switch to "compatibility mode" (i.e., IE7 mode), the editor will 
> actually work a lot better (still some glitches, but fairly usable). You 
> can also click the "Toggle editor" checkbox below the edit window, and it 
> will revert to a standard textarea (with no syntax highlighting). Another 
> option is to switch from the default EditArea editor to the alternative Amy 
> editor -- to do this, in /web2py/applications/admin/models/0.py, change:
>
> TEXT_EDITOR = 'edit_area' or 'amy'
>
> to
>
> TEXT_EDITOR = 'amy'
>
> Note, the Amy editor works in IE9, but not IE<9.
>
> Anthony
>
 
Thanks Anthony. I am thrilled to be part of this web2py community. Your 
suggestion worked and after making the change to just 'amy' the IE 9 edting 
screen looks perfect.
 


[web2py] Re: Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Alok
Thanks massimo. I was afraid that either the installation did not go as it 
should have or I was not doing something right.

On Friday, February 24, 2012 11:58:14 AM UTC-8, Massimo Di Pierro wrote:

> You are right. There is a glicth in the syntax highlter on some 
> browsers. We have not quite got not the bottom of it. :-( 
>
> On Feb 24, 1:01 pm, Alok  wrote: 
> > Hi Friends, 
> > Excuse me if this question has been answered. Also I am new to web2py 
> but I 
> > love, just love what I have seen so far. 
> > One issue which is bothering me though is this. 
> > When I try and edit a file using the Web based editor in Windows 7 and 
> IE 
> > 9, and bring up the file, the program starts either highlighting or 
> > unhighlighting each and every line. This happens painfully slowly. On 
> top 
> > of thisn when I try to click on a empty line, either the click does not 
> > register or the opposite process starts. If the lines were highlighted, 
> > they start becoming unhighlighted and if they were unhighlighted then 
> they 
> > start becoming highlighted. (Highlighted=Selected) 
> > I can probably use another editor but I found this feature worth trying 
> out 
> > as I saw a video on web2py using Mac to work like this and there the 
> > process was going on very smoothly. (I think the video washttp://
> www.youtube.com/watch?v=53DF4pkeriUby massimo) 
> > Thanks and hope you can help. 
> > Alok



[web2py] Re: * PYTILS *

2012-02-24 Thread howesc
no experience with this package, but if you are on a traditional server 
just install the package and import it.  if you are on GAE or want to 
"sandbox" things, install the module to web2py/site-packages and then 
import it.

On Friday, February 24, 2012 11:43:12 AM UTC-8, cyber wrote:
>
> Hi, guys! 
>
> I just need a tools for processing string in russian for in-words 
> representation of numerals. 
> It seems that PYTILS (http://pypi.python.org/pypi/pytils/0.2.3 or 
> https://github.com/j2a/pytils) is more convinient module. 
> So, is there a way to include PYTILS in my web2py project? 
>
> Perhaps someone has already have a similar experience?!?



Re: [web2py] Re: Photo Gallery

2012-02-24 Thread Chris Hawkes
Noobmusic.com uses lightbox with Google app engine.  You probably need to show 
us the entire page you are trying to get to work.   Your problem is probably 
something to do with class names or JavaScript includes.

Sent from my Samsung smartphone on AT&T

Anthony  wrote:

>Lightbox is a client-side Javascript library and doesn't really have 
>anything to do with web2py -- as long as you set it up properly, it should 
>work with web2py (or any backend framework). If you show some code, though, 
>perhaps we can figure out the problem.
>
>Anthony
>
>On Friday, February 24, 2012 1:08:23 PM UTC-5, Adriano Almeida wrote:
>>
>> Hi folks, 
>>
>> I have been trying to create a image gallery for a website that I´ll 
>> be hosting on GAE. I am trying to use 
>> http://lokeshdhakar.com/projects/lightbox2/ 
>> but I cannot make it work. 
>>
>> When clicking on the link the would open the box and the fotos nothing 
>> happens. 
>>
>> Is there anybody that could make web2py and the lightbox work 
>> together? 
>>
>> Thanks in advance
>


Re: [web2py] Re: Photo Gallery

2012-02-24 Thread Chris Hawkes


Sent from my Samsung smartphone on AT&T

Anthony  wrote:

>Lightbox is a client-side Javascript library and doesn't really have 
>anything to do with web2py -- as long as you set it up properly, it should 
>work with web2py (or any backend framework). If you show some code, though, 
>perhaps we can figure out the problem.
>
>Anthony
>
>On Friday, February 24, 2012 1:08:23 PM UTC-5, Adriano Almeida wrote:
>>
>> Hi folks, 
>>
>> I have been trying to create a image gallery for a website that I´ll 
>> be hosting on GAE. I am trying to use 
>> http://lokeshdhakar.com/projects/lightbox2/ 
>> but I cannot make it work. 
>>
>> When clicking on the link the would open the box and the fotos nothing 
>> happens. 
>>
>> Is there anybody that could make web2py and the lightbox work 
>> together? 
>>
>> Thanks in advance
>


[web2py] Re: Daemon process called 'web2py' cannot be accessed by this WSGI application: /home/www-data/web2py/wsgihandler.py

2012-02-24 Thread Adi
feel horribly stupid for unnecessary post again, yet happy for getting it 
to work... 

rebooted a box, and all works perfectly fine... 

sorry... 

On Friday, February 24, 2012 2:53:13 PM UTC-5, Adi wrote:
>
> I deployed functional application on Ubuntu 11.04 x64, and everything 
> worked fine, including SSL (admin), until I did "do-release-upgrade". 
>
> https stopped working and I found following Apache error:
> Daemon process called 'web2py' cannot be accessed by this WSGI 
> application: /home/www-data/web2py/wsgihandler.py
>
> Could it be due to compiling mod_wsg with Python 2.7? I'm just learning 
> the environment, plus python/w2p. Any advice or suggestion, how to roll it 
> back, or what to look for?
>
> no error:
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
> [GCC 4.4.3] on linux2
>
> https error:
> Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
> [GCC 4.6.1] on linux2
>
> Thanks,
> Adnan
>

On Friday, February 24, 2012 2:53:13 PM UTC-5, Adi wrote:
>
> I deployed functional application on Ubuntu 11.04 x64, and everything 
> worked fine, including SSL (admin), until I did "do-release-upgrade". 
>
> https stopped working and I found following Apache error:
> Daemon process called 'web2py' cannot be accessed by this WSGI 
> application: /home/www-data/web2py/wsgihandler.py
>
> Could it be due to compiling mod_wsg with Python 2.7? I'm just learning 
> the environment, plus python/w2p. Any advice or suggestion, how to roll it 
> back, or what to look for?
>
> no error:
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
> [GCC 4.4.3] on linux2
>
> https error:
> Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
> [GCC 4.6.1] on linux2
>
> Thanks,
> Adnan
>



[web2py] Re: Auth exposes login.html, logout.html..?

2012-02-24 Thread davidkw
Thanks, I misread the epydoc. I think I'm slowly getting an idea of
how auth works.

On Feb 24, 3:17 pm, Anthony  wrote:
> > Hi, not sure if this is a silly question. The documentation says that
> > Auth exposes login.html, logout.html..
>
> Where does it say that? In the Access Control chapter, it says:
>
> The controller above exposes multiple actions:
>
> 1.
> 2.
> 3.
>
> http://.../[app]/default/user/registerhttp://.../[app]/default/user/loginhttp://.../[app]/default/user/logout
>
> etc.
>
> Note, in those URLs, "user" is the function, and the associated view is
> therefore /default/user.html. "register", "login", "logout", etc. are args,
> which are processed by the auth object to produce the appropriate
> form/behavior. The user.html view is designed to display whichever form is
> generated by auth, with some special logic for particular URL args. Note, a
> URL like /default/user/login.html would not work, because the extension
> must be attached to the function, not the arg -- so if you want to add the
> extension, the correct URL would be /default/user.html/login (though that
> is unnecessary, because the extension defaults to "html").
>
> Anthony


[web2py] Re: want to insert the data in database when the user will log-in first time

2012-02-24 Thread Anthony
On Friday, February 24, 2012 12:57:50 PM UTC-5, pbreit wrote:
>
> Is there any way to add captured data or otherwise customize the 
> auth_event auto-logging?


One option might be to add some custom fields to the auth_event table and 
then dynamically set default values for those fields so when the Auth 
system does an insert into the table, the extra fields will be populated 
appropriately.

Anthony 


[web2py] Re: Photo Gallery

2012-02-24 Thread Anthony
Lightbox is a client-side Javascript library and doesn't really have 
anything to do with web2py -- as long as you set it up properly, it should 
work with web2py (or any backend framework). If you show some code, though, 
perhaps we can figure out the problem.

Anthony

On Friday, February 24, 2012 1:08:23 PM UTC-5, Adriano Almeida wrote:
>
> Hi folks, 
>
> I have been trying to create a image gallery for a website that I´ll 
> be hosting on GAE. I am trying to use 
> http://lokeshdhakar.com/projects/lightbox2/ 
> but I cannot make it work. 
>
> When clicking on the link the would open the box and the fotos nothing 
> happens. 
>
> Is there anybody that could make web2py and the lightbox work 
> together? 
>
> Thanks in advance



[web2py] Re: Auth exposes login.html, logout.html..?

2012-02-24 Thread Anthony

>
> Hi, not sure if this is a silly question. The documentation says that 
> Auth exposes login.html, logout.html..
>

Where does it say that? In the Access Control chapter, it says:

The controller above exposes multiple actions:

1.
2.
3.

http://.../[app]/default/user/register
http://.../[app]/default/user/login
http://.../[app]/default/user/logout

etc.

Note, in those URLs, "user" is the function, and the associated view is 
therefore /default/user.html. "register", "login", "logout", etc. are args, 
which are processed by the auth object to produce the appropriate 
form/behavior. The user.html view is designed to display whichever form is 
generated by auth, with some special logic for particular URL args. Note, a 
URL like /default/user/login.html would not work, because the extension 
must be attached to the function, not the arg -- so if you want to add the 
extension, the correct URL would be /default/user.html/login (though that 
is unnecessary, because the extension defaults to "html").

Anthony


[web2py] Re: Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Anthony
On Friday, February 24, 2012 2:01:07 PM UTC-5, Alok wrote:
>
> Hi Friends,
> Excuse me if this question has been answered. Also I am new to web2py but 
> I love, just love what I have seen so far.
> One issue which is bothering me though is this.
> When I try and edit a file using the Web based editor in Windows 7 and IE 
> 9, and bring up the file, the program starts either highlighting or 
> unhighlighting each and every line. This happens painfully slowly. On top 
> of thisn when I try to click on a empty line, either the click does not 
> register or the opposite process starts. If the lines were highlighted, 
> they start becoming unhighlighted and if they were unhighlighted then they 
> start becoming highlighted. (Highlighted=Selected)
>

If you switch to "compatibility mode" (i.e., IE7 mode), the editor will 
actually work a lot better (still some glitches, but fairly usable). You 
can also click the "Toggle editor" checkbox below the edit window, and it 
will revert to a standard textarea (with no syntax highlighting). Another 
option is to switch from the default EditArea editor to the alternative Amy 
editor -- to do this, in /web2py/applications/admin/models/0.py, change:

TEXT_EDITOR = 'edit_area' or 'amy'

to

TEXT_EDITOR = 'amy'

Note, the Amy editor works in IE9, but not IE<9.

Anthony


[web2py] Re: Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Massimo Di Pierro
You are right. There is a glicth in the syntax highlter on some
browsers. We have not quite got not the bottom of it. :-(

On Feb 24, 1:01 pm, Alok  wrote:
> Hi Friends,
> Excuse me if this question has been answered. Also I am new to web2py but I
> love, just love what I have seen so far.
> One issue which is bothering me though is this.
> When I try and edit a file using the Web based editor in Windows 7 and IE
> 9, and bring up the file, the program starts either highlighting or
> unhighlighting each and every line. This happens painfully slowly. On top
> of thisn when I try to click on a empty line, either the click does not
> register or the opposite process starts. If the lines were highlighted,
> they start becoming unhighlighted and if they were unhighlighted then they
> start becoming highlighted. (Highlighted=Selected)
> I can probably use another editor but I found this feature worth trying out
> as I saw a video on web2py using Mac to work like this and there the
> process was going on very smoothly. (I think the video 
> washttp://www.youtube.com/watch?v=53DF4pkeriUby massimo)
> Thanks and hope you can help.
> Alok


[web2py] Auth exposes login.html, logout.html..?

2012-02-24 Thread davidkw
Hi, not sure if this is a silly question. The documentation says that
Auth exposes login.html, logout.html..

What does this mean exactly? I looked through my views, but can't find
a login.html or logout.html. Are these hidden from me?

Thanks


[web2py] Daemon process called 'web2py' cannot be accessed by this WSGI application: /home/www-data/web2py/wsgihandler.py

2012-02-24 Thread Adi
I deployed functional application on Ubuntu 11.04 x64, and everything 
worked fine, including SSL (admin), until I did "do-release-upgrade". 

https stopped working and I found following Apache error:
Daemon process called 'web2py' cannot be accessed by this WSGI application: 
/home/www-data/web2py/wsgihandler.py

Could it be due to compiling mod_wsg with Python 2.7? I'm just learning the 
environment, plus python/w2p. Any advice or suggestion, how to roll it 
back, or what to look for?

no error:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2

https error:
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2

Thanks,
Adnan


[web2py] Photo Gallery

2012-02-24 Thread Adriano Almeida
Hi folks,

I have been trying to create a image gallery for a website that I´ll
be hosting on GAE. I am trying to use 
http://lokeshdhakar.com/projects/lightbox2/
but I cannot make it work.

When clicking on the link the would open the box and the fotos nothing
happens.

Is there anybody that could make web2py and the lightbox work
together?

Thanks in advance


[web2py] Editing Web2Py files using Windows Web Interface

2012-02-24 Thread Alok
Hi Friends,
Excuse me if this question has been answered. Also I am new to web2py but I 
love, just love what I have seen so far.
One issue which is bothering me though is this.
When I try and edit a file using the Web based editor in Windows 7 and IE 
9, and bring up the file, the program starts either highlighting or 
unhighlighting each and every line. This happens painfully slowly. On top 
of thisn when I try to click on a empty line, either the click does not 
register or the opposite process starts. If the lines were highlighted, 
they start becoming unhighlighted and if they were unhighlighted then they 
start becoming highlighted. (Highlighted=Selected)
I can probably use another editor but I found this feature worth trying out 
as I saw a video on web2py using Mac to work like this and there the 
process was going on very smoothly. (I think the video was 
http://www.youtube.com/watch?v=53DF4pkeriU by massimo)
Thanks and hope you can help.
Alok


[web2py] * PYTILS *

2012-02-24 Thread cyber
Hi, guys!

I just need a tools for processing string in russian for in-words
representation of numerals.
It seems that PYTILS (http://pypi.python.org/pypi/pytils/0.2.3 or
https://github.com/j2a/pytils) is more convinient module.
So, is there a way to include PYTILS in my web2py project?

Perhaps someone has already have a similar experience?!?


[web2py] Re: want to insert the data in database when the user will log-in first time

2012-02-24 Thread pbreit
Is there any way to add captured data or otherwise customize the auth_event 
auto-logging?

[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Anthony
On Friday, February 24, 2012 12:24:03 PM UTC-5, JaapP wrote:
>
> Hi Wikus,
>
> Thanks a lot! 
> Adding a db.commit() after an insert causes the database to be updated.
>

The db.commit() shouldn't be needed. Can you show some code?

Anthony 


[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi Wikus,

Thanks a lot! 
Adding a db.commit() after an insert causes the database to be updated.

Bye,

Jaap


[web2py] Re: GAE - Rendering uploaded Blob as jpeg image rather than as a string?

2012-02-24 Thread Wikus van de Merwe
You kind of do :) There is no way to embed streams in HTML directly. You 
need a separate function showing a single image by id (e.g. /show_image/id) 
and build a list with links to that function in the list_image view.

{{for img in images:}}
  
{{= TD(img.title) }}
{{= TD(IMG(_src=URL("show_image", args=img.id), _alt=img.title)) }}
  
{{pass}}



[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Anthony
On Friday, February 24, 2012 12:13:20 PM UTC-5, Wikus van de Merwe wrote:
>
> The code in controllers is wrapped in web2py with a try except clause that 
> automatically commits or rolls back the changes to db. I believe this is 
> not the case for modules and an explicit commit is needed there. Try to add 
> "db.commit" to your module code.
>

You only need to use db.commit (and db.rollback) if using the DAL from 
outside of a web2py application. Ultimately, the module code is called from 
a model or controller, which is executed by web2py in the try/except 
clause, so commits and rollbacks will happen automatically, even for DAL 
operations in modules.

Anthony 


Re: [web2py] using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi Johann,

Thanks for your quick reply! 
I will test the suggestions as made in the previous thread (don't know if 
this works: 
https://groups.google.com/forum/?fromgroups#!topic/web2py/0k0Fvw6fmb8 ). 

bye,

Jaap



[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Wikus van de Merwe
The code in controllers is wrapped in web2py with a try except clause that 
automatically commits or rolls back the changes to db. I believe this is 
not the case for modules and an explicit commit is needed there. Try to add 
"db.commit" to your module code.


[web2py] OFF-TOPIC - Udacity - Educating the 21st Century

2012-02-24 Thread António Ramos
Nice way of teaching.
They teach python and robotics using python

http://www.youtube.com/user/Udacity?feature=watch


[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Anthony
That should work fine. You don't have to use classes in modules.

Anthony

On Friday, February 24, 2012 11:45:13 AM UTC-5, Cliff wrote:
>
> Interesting.  I wonder why my modules are working when I just pass the 
> db to the functions within them? 
>
> On 1.99.2 I have something like this working. 
>
> mymodule.py contains no classes, just some functions.  One looks like 
> this: 
>
> def myfunction(db, request, session, some_value): 
>   query = db[request.controller].somefield==somevalue 
>   rows = db(query).select( 
>db[request.controller].field_1, 
>db[request.controller].field_2, 
>   ) 
>   tbl = TABLE() 
>   for row in rows: 
> tbl.append(row.field_1 
>   return tbl 
>
> Then in the controller I do this: 
>
> def index: 
>   import mymodule 
>   somevalue = 'foo' 
>   return dict(form=mymodule.myfunction(db,request,session,somevalue)) 
>
>
>
>
> On Feb 24, 10:40 am, Johann Spies  wrote: 
> > On 24 February 2012 16:58, JaapP  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Hi All, 
> > 
> > > i've been struggling with the following problem for some time and hope 
> > > anyone can help. 
> > 
> > > When i instantiate a class in a controller (class is in separate file 
> in 
> > > Modules folder) and i want to use the database from within this 
> instance, i 
> > > have to pass the DB to the class. 
> > 
> > > Inside this instance, querying the db works normal. 
> > > But, when i try to insert a new record into the database the database 
> > > (sqlite) is not updated. 
> > 
> > > Debugging shows me that the db object inside the instance is actually 
> > > updated. 
> > 
> > > So my question: how should i use the web2py database connection inside 
> a 
> > > class? As far as i can understand when passing the DB to a class this 
> > > creates a new DB object that is not connected to the file store.. 
> > 
> > > Any help greatly appreciated! 
> > 
> > I have asked a similar question a week or two ago on this list.  If you 
> > search the list, you will find the thread. 
> > 
> > In my module I have 
> > 
> > from gluon import * 
> > 
> > class Univ(object): 
> > 
> > def __init__(self, db,): 
> > self.db = db 
> > 
> > and I create an instance of this class in the controller using 
> > 
> > t = Univ(db) 
> > 
> > also in other modules I use the following inside functions (read the 
> book 
> > about this: you should not use this as a global variable in a module: 
> > 
> > def somefunction(): 
> > 
> >db = current.db 
> > 
> > while I have in models/db.py (after the connection to the database was 
> > defined): 
> > 
> > from gluon import current 
> > current.db = db 
> > 
> > Regards 
> > Johann 
> > 
> > -- 
> > Because experiencing your loyal love is better than life itself, 
> > my lips will praise you.  (Psalm 63:3)



[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Cliff
Interesting.  I wonder why my modules are working when I just pass the
db to the functions within them?

On 1.99.2 I have something like this working.

mymodule.py contains no classes, just some functions.  One looks like
this:

def myfunction(db, request, session, some_value):
  query = db[request.controller].somefield==somevalue
  rows = db(query).select(
   db[request.controller].field_1,
   db[request.controller].field_2,
  )
  tbl = TABLE()
  for row in rows:
tbl.append(row.field_1
  return tbl

Then in the controller I do this:

def index:
  import mymodule
  somevalue = 'foo'
  return dict(form=mymodule.myfunction(db,request,session,somevalue))




On Feb 24, 10:40 am, Johann Spies  wrote:
> On 24 February 2012 16:58, JaapP  wrote:
>
>
>
>
>
>
>
>
>
> > Hi All,
>
> > i've been struggling with the following problem for some time and hope
> > anyone can help.
>
> > When i instantiate a class in a controller (class is in separate file in
> > Modules folder) and i want to use the database from within this instance, i
> > have to pass the DB to the class.
>
> > Inside this instance, querying the db works normal.
> > But, when i try to insert a new record into the database the database
> > (sqlite) is not updated.
>
> > Debugging shows me that the db object inside the instance is actually
> > updated.
>
> > So my question: how should i use the web2py database connection inside a
> > class? As far as i can understand when passing the DB to a class this
> > creates a new DB object that is not connected to the file store..
>
> > Any help greatly appreciated!
>
> I have asked a similar question a week or two ago on this list.  If you
> search the list, you will find the thread.
>
> In my module I have
>
> from gluon import *
>
> class Univ(object):
>
>     def __init__(self, db,):
>         self.db = db
>
> and I create an instance of this class in the controller using
>
> t = Univ(db)
>
> also in other modules I use the following inside functions (read the book
> about this: you should not use this as a global variable in a module:
>
> def somefunction():
>
>    db = current.db
>
> while I have in models/db.py (after the connection to the database was
> defined):
>
> from gluon import current
> current.db = db
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)


[web2py] Re: want to insert the data in database when the user will log-in first time

2012-02-24 Thread weheh
Not to take away from Massimo's answer, which is obviously the right
way to do it, but the thing you're example is trying to do is
basically done for you automatically in the auth_event table.

On Feb 24, 11:53 pm, Massimo Di Pierro 
wrote:
> How about adding this at the bottom of your model:
>
> def do_something(form): 
> auth.settings.login_onaccept = do_something
>
> On Feb 24, 3:47 am, Sanjeet Kumar  wrote:
>
>
>
>
>
>
>
> >  I want to insert the data in database when the user will log-in first time
> > . if the user refresh the index page after login it will again insert the
> > date and time I have the following sample code  i know this code is wrong
> > but i want to insert the data only first time when the user will log-in.
>
> > @auth.requires_login()
> > def index():
> >     #response.flash = c
> >     if auth.is_logged_in():
> >         response.flash='You are logged in'
> >     else:
> >         import datetime
> >         c=datetime.datetime.now()
> >         for row in db(db.auth_user.email ==
> > auth.user.email).select(db.auth_user.first_name):
> >             firstname=row.first_name
> >         db.employee_detail.insert(employee_id = auth.user.email,
> > employee_name=firstname, employee_login_time=c)
> >     return dict(message=T('Hello World'))


[web2py] Re: Using regular expressions in DAL queries

2012-02-24 Thread Omri Har-Shemesh
Hi Massimo,

I already opened an 
issueat Google code, its 
link is in my second e-mail in this discussion.
I will add there a link to this discussion.

Best,
Omri


[web2py] Re: want to insert the data in database when the user will log-in first time

2012-02-24 Thread Massimo Di Pierro
How about adding this at the bottom of your model:

def do_something(form): 
auth.settings.login_onaccept = do_something

On Feb 24, 3:47 am, Sanjeet Kumar  wrote:
>  I want to insert the data in database when the user will log-in first time
> . if the user refresh the index page after login it will again insert the
> date and time I have the following sample code  i know this code is wrong
> but i want to insert the data only first time when the user will log-in.
>
> @auth.requires_login()
> def index():
>     #response.flash = c
>     if auth.is_logged_in():
>         response.flash='You are logged in'
>     else:
>         import datetime
>         c=datetime.datetime.now()
>         for row in db(db.auth_user.email ==
> auth.user.email).select(db.auth_user.first_name):
>             firstname=row.first_name
>         db.employee_detail.insert(employee_id = auth.user.email,
> employee_name=firstname, employee_login_time=c)
>     return dict(message=T('Hello World'))


[web2py] Re: Using regular expressions in DAL queries

2012-02-24 Thread Massimo Di Pierro
Thanks this helps and it should be easy to add this feature. Can you
please open a ticket and add a link to your post?

On Feb 24, 3:36 am, Omri Har-Shemesh  wrote:
> I do not know, but I did some internet research and found the following:
>
> *PostgreSQL*: supports POSIX style regexps, described to great detail 
> in:http://www.postgresql.org/docs/9.0/static/functions-matching.html
> *MySQL*: supports a style "which is aimed at conformance with POSIX
> 1003.2", described here:http://dev.mysql.com/doc/refman/5.1/en/regexp.html
> *Oracle*: supports "IEEE Portable Operating System Interface (POSIX)
> standard draft 1003.2/D11.2", 
> described:http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm
> *MSSQL*: not sure, I think you probably need to define a function on your
> own using CLR language (?).
> *FireBird*: Support RegExp, but didn't specify according to which syntax
> exactly. 
> Details:http://www.firebirdsql.org/rlsnotesh/rlsnotes25.html#rnfb25-dml-regex
> *DB2*: Need to implement a function that does it, 
> details:http://www.ibm.com/developerworks/data/library/techarticle/0301stolze...
> *Informix, Ingres*: Not sure, wasn't able to find something definitive, but
> probably need to extend the language to support regexps.
>
> In addition I found the following article of someone who explored the
> regexp support of popular SQL 
> databases:http://trentrichardson.com/2008/10/23/exploring-various-sql-regex-syn...
>
> All in all, seems that most systems support some version of POSIX standard,
> except when you need to extend the SQL with a user defined function, then I
> guess you can chose the implementation you want.
>
> Hope this help,
> Omri


[web2py] Re: GAE - Rendering uploaded Blob as jpeg image rather than as a string?

2012-02-24 Thread Massimo Di Pierro
You have two actions:

list_image() -> returns an image (always image 1?)
ist_images() -> returns the html page.

In the latter you can do:

View:
  {{extend 'layout.html'}}
  Display Jpeg Images
  

   Image Title
   Image Blob

{{for img in images:}}

{{ =img.title }}
{{=img.image_blob }}/



{{pass}}
  

Anyway, I have the impression you are reinventing the wheel a little.
Did you look into "upload" field and the "download"action? They are
designed to do what you need.

On Feb 23, 11:28 pm, BrendanC  wrote:
> OK - Quick follow up here - I was able to display an blob image using the
> call:
>
> def list_image():
>
>    myid = 1    # test
>     image=db(db.xim.id==myid).select(orderby=db.xim.title)
>     response.headers['Content-Type']='image/jpeg'
>
>     mystream = image.image_blob
>     return mystream
>
> However this renders an image in separate page with no additional info.
> What I really want is to display the stream as part of a template (within
>  a table) with additional related image info (Title, Comments etc). IOW I
> want to embed the stream within an html template, rather than as a
> separate, standalone file.
>
> Am I missing piece of the puzzle here?


Re: [web2py] Re: I would like to learn Web2py but where do I start?

2012-02-24 Thread Carlos Costa
Massimo is a nice guy!

2012/2/24 newbie :
> Thank you all so much for your responses and recommendations.  I will
> give those a try.  Massimo, keep up the great work and thank you for
> taking the time to help.  I look forward to the video tutorial.
>
> On Feb 23, 10:20 pm, pbreit  wrote:
>> W3schools is perfectly fine. That fools thing is a little overblown.



-- 
Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן


[web2py] Re: I would like to learn Web2py but where do I start?

2012-02-24 Thread newbie
Thank you all so much for your responses and recommendations.  I will
give those a try.  Massimo, keep up the great work and thank you for
taking the time to help.  I look forward to the video tutorial.

On Feb 23, 10:20 pm, pbreit  wrote:
> W3schools is perfectly fine. That fools thing is a little overblown.


Re: [web2py] using existing DB connection inside module/class

2012-02-24 Thread Johann Spies
On 24 February 2012 16:58, JaapP  wrote:

> Hi All,
>
> i've been struggling with the following problem for some time and hope
> anyone can help.
>
> When i instantiate a class in a controller (class is in separate file in
> Modules folder) and i want to use the database from within this instance, i
> have to pass the DB to the class.
>
> Inside this instance, querying the db works normal.
> But, when i try to insert a new record into the database the database
> (sqlite) is not updated.
>
> Debugging shows me that the db object inside the instance is actually
> updated.
>
> So my question: how should i use the web2py database connection inside a
> class? As far as i can understand when passing the DB to a class this
> creates a new DB object that is not connected to the file store..
>
> Any help greatly appreciated!
>
>
I have asked a similar question a week or two ago on this list.  If you
search the list, you will find the thread.

In my module I have

from gluon import *

class Univ(object):

def __init__(self, db,):
self.db = db

and I create an instance of this class in the controller using

t = Univ(db)

also in other modules I use the following inside functions (read the book
about this: you should not use this as a global variable in a module:

def somefunction():

   db = current.db

while I have in models/db.py (after the connection to the database was
defined):

from gluon import current
current.db = db

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: web2py with Aptana - optimization required

2012-02-24 Thread Anthony

>
> 1) At default controller Aptana shows me errors at "@auth..." 
> decorators (Undefined variable auth). Also the service() in the call()- 

function is unknown. You see my actual imports at the end of this 
> post. 
>

You'd have to add the following to your list of dummy 
imports/instantiations:

auth = Auth(db)
service = Service()

Also, note that you no longer need all of those import statements -- the 
entire web2py API is now exposed via "from gluon import *". Also, if you're 
using trunk, even the dummy request, response, session, cache, and T 
instantiations are done for you when you import gluon. So, in addition to 
"from gluon import *", you should only need to do the imports and 
instantiations for auth, service, and db.

Anthony


[web2py] Re: Sporadic ImportError with custom module

2012-02-24 Thread Anthony
Note, local_import has been deprecated -- you can now simply do:

import newsblur

Maybe try that and see if the problem goes away.

Anthony

On Friday, February 24, 2012 8:46:54 AM UTC-5, spiffytech wrote:
>
> My web2py app is hosted on Apache with mod_wsgi. Sometimes I'm 
> browsing through it and web2py encounters an error: 
>
> ImportError: No module named mobileblur.modules.newsblur 
>
> Caused by this line in my models file: 
>
> nb_module = local_import("newsblur") 
>
> This only happens occasionally, but on seemingly any page. Funny thing 
> is, if I hit the browser's refresh button the page loads fine. And 
> since nearly every page on the site requires that module, I know the 
> import works most of the time. 
>
> The permissions on the module are -rw-r--r--, apache:apache (the same 
> user:group Apache is configured to use). 
>
> The full source code can be found here[0], and I can provide 
> additional information on the server if needed. 
>
> What could be going wrong? 
>
>
> [0] 
> https://github.com/spiffytech/MobileBlur/tree/master/applications/mobileblur



[web2py] using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi All,

i've been struggling with the following problem for some time and hope 
anyone can help.

When i instantiate a class in a controller (class is in separate file in 
Modules folder) and i want to use the database from within this instance, i 
have to pass the DB to the class. 

Inside this instance, querying the db works normal. 
But, when i try to insert a new record into the database the database 
(sqlite) is not updated.

Debugging shows me that the db object inside the instance is actually 
updated. 

So my question: how should i use the web2py database connection inside a 
class? As far as i can understand when passing the DB to a class this 
creates a new DB object that is not connected to the file store..

Any help greatly appreciated!

Jaap


Re: [web2py] nginx/uwsgi setup on Debian

2012-02-24 Thread Roberto De Ioris

> On 24 February 2012 15:46, Roberto De Ioris  wrote:
>
>>
>> This is a quick sequence you can run on debian too:
>>
>> wget http://projects.unbit.it/downloads/uwsgi-1.0.4.tar.gz
>> tar zxvf uwsgi-1.0.4.tar.gz
>> cd uwsgi-1.0.4
>> make
>>
>> if all goes well run uWSGI
>>
>> ./uwsgi --http-socket :8080 --chdir  --module
>> wsgihandler
>>
>> point your browser to port 8080 on localhost and you should see your app
>>
>> For webfaction substitute :8080 with the assigned port
>>
>
> Thanks for your reply. Webfaction is not my problem as you saw in my
> original message.
>
> Your advice worked.  But as soon as I tried a tcp-socket like '-s
> 192.168.0.1:8080'  I get an error message: "The connection was reset" and
> on the console:
>
> $ uwsgi -x web2py.xml
> [uWSGI] parsing config file web2py.xml
> *** Starting uWSGI 1.0.4 (64bit) on [Fri Feb 24 16:24:10 2012] ***
> compiled with version: 4.6.2 on 24 February 2012 16:11:08
> current working directory: /etc/uwsgi/apps-enabled
> detected binary path: /usr/local/bin/uwsgi
> *** WARNING: you are running uWSGI without its master process manager ***
> your memory page size is 4096 bytes
> uwsgi socket 0 bound to TCP address 192.168.0.1:8080 fd 5
> Python version: 2.7.2+ (default, Nov 30 2011, 22:33:30)  [GCC 4.6.2]
> Python main interpreter initialized at 0x1cf11b0
> your server socket listen backlog is limited to 100 connections
> *** Operational MODE: single process ***
> added /home/www-data/web2py/ to pythonpath.
> WSGI application 0 (mountpoint='/') ready on interpreter 0x1cf11b0 pid:
> 16706 (default app)
> *** uWSGI is running in multiple interpreter mode ***
> spawned uWSGI worker 1 (and the only) (pid: 16706, cores: 1)
> invalid request block size: 21573 (max 4096)...skip
> Fri Feb 24 16:24:26 2012 - error parsing request
>
> I suspect that nginx would be play the role of the 'master process
> manager'.
>

-s means --socket that set the usage of the uwsgi protocol instead of the
HTTP one

In this case you need to point nginx to this socket (as your browser does
not speak uwsgi obviously) via the uwsgi_pass directive
-- 
Roberto De Ioris
http://unbit.it


Re: [web2py] nginx/uwsgi setup on Debian

2012-02-24 Thread Johann Spies
On 24 February 2012 15:46, Roberto De Ioris  wrote:

>
> This is a quick sequence you can run on debian too:
>
> wget http://projects.unbit.it/downloads/uwsgi-1.0.4.tar.gz
> tar zxvf uwsgi-1.0.4.tar.gz
> cd uwsgi-1.0.4
> make
>
> if all goes well run uWSGI
>
> ./uwsgi --http-socket :8080 --chdir  --module wsgihandler
>
> point your browser to port 8080 on localhost and you should see your app
>
> For webfaction substitute :8080 with the assigned port
>

Thanks for your reply. Webfaction is not my problem as you saw in my
original message.

Your advice worked.  But as soon as I tried a tcp-socket like '-s
192.168.0.1:8080'  I get an error message: "The connection was reset" and
on the console:

$ uwsgi -x web2py.xml
[uWSGI] parsing config file web2py.xml
*** Starting uWSGI 1.0.4 (64bit) on [Fri Feb 24 16:24:10 2012] ***
compiled with version: 4.6.2 on 24 February 2012 16:11:08
current working directory: /etc/uwsgi/apps-enabled
detected binary path: /usr/local/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
uwsgi socket 0 bound to TCP address 192.168.0.1:8080 fd 5
Python version: 2.7.2+ (default, Nov 30 2011, 22:33:30)  [GCC 4.6.2]
Python main interpreter initialized at 0x1cf11b0
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
added /home/www-data/web2py/ to pythonpath.
WSGI application 0 (mountpoint='/') ready on interpreter 0x1cf11b0 pid:
16706 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 16706, cores: 1)
invalid request block size: 21573 (max 4096)...skip
Fri Feb 24 16:24:26 2012 - error parsing request

I suspect that nginx would be play the role of the 'master process manager'.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Sporadic ImportError with custom module

2012-02-24 Thread spiffytech
My web2py app is hosted on Apache with mod_wsgi. Sometimes I'm
browsing through it and web2py encounters an error:

ImportError: No module named mobileblur.modules.newsblur

Caused by this line in my models file:

nb_module = local_import("newsblur")

This only happens occasionally, but on seemingly any page. Funny thing
is, if I hit the browser's refresh button the page loads fine. And
since nearly every page on the site requires that module, I know the
import works most of the time.

The permissions on the module are -rw-r--r--, apache:apache (the same
user:group Apache is configured to use).

The full source code can be found here[0], and I can provide
additional information on the server if needed.

What could be going wrong?


[0] https://github.com/spiffytech/MobileBlur/tree/master/applications/mobileblur


Re: [web2py] nginx/uwsgi setup on Debian

2012-02-24 Thread Roberto De Ioris

> I am trying to replace an apache setup with nginx/uwsgi on my home network
> as a pilot project for a more formal setup on a server where I am
> deploying
> an app.
>
> With the help of people on this list I could change my Webfaction
> configuration to nginx/uwsgi but on a plain Debian computer I am making no
> progress.
>
> I am runing Debian unstable on my home computer and Debian stable on the
> server. On both I could get the ubuntu-setup script that comes with web2py
> to set up apache/web2py successfully.  However, the script
> setup-web2py-nginx-ubuntu, modified to use Debian packages and paths and
> not ubuntu ones, only produces an nginx running and answering with *502
> Bad
> Gateway*.
>
> I then purged all the uwsgi and nginx packages from Debian and tried the
> script at
> http://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-nginx.
> That also ended with *502 Bad Gateway*.:(
>
> I have read somewhere that nginx is more simple to set up than Apache, but
> in this case i have spent several hours reading and trying several setup
> scripts and configuration and I got nowhere.
>
> Are there anybody running a nginx/uwsgi/web2py setup on Debian?  If so,
> are
> you willing to share some knowledge that can help me?
>
> Regards
> Johann
>

Having both nginx and uwsgi on webfaction is now useless.

This is a quick sequence you can run on debian too:

wget http://projects.unbit.it/downloads/uwsgi-1.0.4.tar.gz
tar zxvf uwsgi-1.0.4.tar.gz
cd uwsgi-1.0.4
make

if all goes well run uWSGI

./uwsgi --http-socket :8080 --chdir  --module wsgihandler

point your browser to port 8080 on localhost and you should see your app

For webfaction substitute :8080 with the assigned port


-- 
Roberto De Ioris
http://unbit.it


[web2py] nginx/uwsgi setup on Debian

2012-02-24 Thread Johann Spies
I am trying to replace an apache setup with nginx/uwsgi on my home network
as a pilot project for a more formal setup on a server where I am deploying
an app.

With the help of people on this list I could change my Webfaction
configuration to nginx/uwsgi but on a plain Debian computer I am making no
progress.

I am runing Debian unstable on my home computer and Debian stable on the
server. On both I could get the ubuntu-setup script that comes with web2py
to set up apache/web2py successfully.  However, the script
setup-web2py-nginx-ubuntu, modified to use Debian packages and paths and
not ubuntu ones, only produces an nginx running and answering with *502 Bad
Gateway*.

I then purged all the uwsgi and nginx packages from Debian and tried the
script at
http://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-nginx.
That also ended with *502 Bad Gateway*.:(

I have read somewhere that nginx is more simple to set up than Apache, but
in this case i have spent several hours reading and trying several setup
scripts and configuration and I got nowhere.

Are there anybody running a nginx/uwsgi/web2py setup on Debian?  If so, are
you willing to share some knowledge that can help me?

Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] web2py with Aptana - optimization required

2012-02-24 Thread haggis
Hello,
after a couple of hours I finally got web2py development (with
debugging) working in Aptana Studio.

Helpful links for this:
http://pierrethibault.posterous.com/2010/10/web2py-eclipse-pydev-recipe.html
http://code.google.com/p/neo-web2py2eclipse/

However, there a two minor issues I want to resolve:

1) At default controller Aptana shows me errors at "@auth..."
decorators (Undefined variable auth). Also the service() in the call()-
function is unknown. You see my actual imports at the end of this
post.

2) Normally, I'm starting web2py manually from bash with "python2.7
web2py.py". But this way debugging does not work. If I want to start
debugging, I have to stop web2py and let it start from Aptana debug-
mode. Is there a way to make this more comfortable?


Imports in default.py:

if 0:
  None
  from gluon import *
  from gluon.tools import *
  from gluon.globals import *
  from gluon.html import *
  from gluon.validators import *
  from gluon.sql import *
  import gluon.fileutils
  from gluon.contrib.gql import GQLDB
  from gluon.sql import SQLDB
  from gluon.sqlhtml import SQLFORM
  from gluon.sql import SQLField
  from gluon.sqlhtml import SQLTABLE
  from gluon.http import redirect
  import gluon.languages.translator as T
  import gluon.compileapp.local_import_aux as local_import

  global cache; cache = gluon.cache.Cache()
  global request; request = gluon.globals.Request()
  global response; response = gluon.globals.Response()
  global session; session = gluon.globals.Session()
  global DAL; DAL = gluon.dal()
  global HTTP; HTTP = gluon.http()
  global LOAD; LOAD = gluon.compileapp.LoadFactory()
  db = DAL('sqlite://storage.sqlite')

from gluon import *
import sys, datetime


Regards, haggis


[web2py] Re: uploading large file (>15 MB) to blob field

2012-02-24 Thread Fredrik
Hi,

we have the exact same problem, it seems to be a problem with pymysql
(https://github.com/petehunt/PyMySQL/issues/42), however that fix
seems to be integrated in latest web2py but the error remains.

Does anyone have any thoughts on this?


Best regards,
Fredrik

On 20 Feb, 01:25, Matt Grham  wrote:
> Hi All,
>
> When I try to upload a file that is greater than 15 MB to a blob data
> field, I get the following error from pymysql:
>
> (, AssertionError('Result length not
> requested length:\nExpected=21071312.  Actual=16777025.  Position: 190.
>  Data Length: 16777215',))
>
> The error is raised from the peek function in connections.py module:
>
>   def peek(self, size):
>     """Look at the first 'size' bytes in packet without moving cursor."""
>     result = self.__data[self.__position:(self.__position+size)]
>     if len(result) != size:
>       error = ('Result length not requested length:\n'
>                'Expected=%s.  Actual=%s.  Position: %s.  Data Length: %s'
>                % (size, len(result), self.__position, len(self.__data)))
>       if DEBUG:
>         print error
>         self.dump()
>       raise AssertionError(error)
>     return result
>
> How can I resolve this issue? Any help or suggestions appreciated.
>
> web2py version: Version 1.95.1 (2011-04-25 15:04:14)
>
> Regards,
>
> Matt


[web2py] want to insert the data in database when the user will log-in first time

2012-02-24 Thread Sanjeet Kumar
 I want to insert the data in database when the user will log-in first time 
. if the user refresh the index page after login it will again insert the 
date and time I have the following sample code  i know this code is wrong 
but i want to insert the data only first time when the user will log-in.


@auth.requires_login() 
def index(): 
#response.flash = c
if auth.is_logged_in():
response.flash='You are logged in'
else:
import datetime
c=datetime.datetime.now()
for row in db(db.auth_user.email == 
auth.user.email).select(db.auth_user.first_name):
firstname=row.first_name
db.employee_detail.insert(employee_id = auth.user.email, 
employee_name=firstname, employee_login_time=c) 
return dict(message=T('Hello World'))


[web2py] Re: Using regular expressions in DAL queries

2012-02-24 Thread Omri Har-Shemesh
I do not know, but I did some internet research and found the following:

*PostgreSQL*: supports POSIX style regexps, described to great detail in: 
http://www.postgresql.org/docs/9.0/static/functions-matching.html
*MySQL*: supports a style "which is aimed at conformance with POSIX 
1003.2", described here: http://dev.mysql.com/doc/refman/5.1/en/regexp.html
*Oracle*: supports "IEEE Portable Operating System Interface (POSIX) 
standard draft 1003.2/D11.2", described: 
http://docs.oracle.com/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm
*MSSQL*: not sure, I think you probably need to define a function on your 
own using CLR language (?).
*FireBird*: Support RegExp, but didn't specify according to which syntax 
exactly. Details: 
http://www.firebirdsql.org/rlsnotesh/rlsnotes25.html#rnfb25-dml-regex
*DB2*: Need to implement a function that does it, details: 
http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html
*Informix, Ingres*: Not sure, wasn't able to find something definitive, but 
probably need to extend the language to support regexps.

In addition I found the following article of someone who explored the 
regexp support of popular SQL databases: 
http://trentrichardson.com/2008/10/23/exploring-various-sql-regex-syntax/

All in all, seems that most systems support some version of POSIX standard, 
except when you need to extend the SQL with a user defined function, then I 
guess you can chose the implementation you want.

Hope this help,
Omri