[web2py] Re: web2py not using global http_proxy

2011-02-13 Thread whowhywhat
Solved the problem! :) .. wsgi has a option to explicitly pass an
environment variable (given in the commandline).
Once i passed the http_proxy variable by this method web2py works
fine.
 I think the default uwsgi wizzard in cherokee is broken. I had to
define a custom source to get uwsgi + web2py to work.
i finally have cherokee + uwsgi + web2py working absolutely fine (with
proxy etc.)
will document everything and post it. thanks for everything.

On Feb 12, 8:47 pm, whowhywhat  wrote:
> Luis i did use the web2py auto config script to try out apache with
> WSGI.
> I too noticed that apache seems to hog memory (as compared to
> cherokee). I think Cherokee is a great web server as its documentation
> is really good.
> I will surely document how i set up Cherokee + WSGI + web2py and post
> it here or on the web2py wiki.
> i was seeing a total memory consumption of under 150MB with Cherokee,
> WSGI and web2py (4 WSGI processes)
> i have done this on my work machine (running turnkey Linux (based on
> Ubuntu 10.04) in a virtualbox). i will document and post what i have
> done on Monday (14th feb 2010)
>
> On Feb 12, 6:10 pm, Luis Díaz  wrote:
>
> > I'm using a virtualization solution. (Proxmox)
>
> > I have a debian server 5,
> > installed by minimal changes in the script
> > "Setup web2py + apache + ssl + mod_wsgi + postgresql in FEW seconds"
> > I do not use postgresql on this server.
>
> > I have another server with debian virtualized 5 and in this I have
> > configured to allow external connections postgresql
>
> > I noticed a 638Mb memory consumption on the first server without
> > ejecutandoce web2py applications.
>
> > could comment as configurastes web2py and Cherokee
>
> > I want to lose the memory consumption and increase performance.
>
> > 2011/2/12 whowhywhat 
>
> > > Thanks for the quick replies.
> > > As Luis mentions i have used export http_proxy (but in /etc/
> > > environment and in the startup script of cherokee). I will try
> > > defining in /etc/profile
> > > i did some further testing by launching web2py with its own web
> > > server.
> > > by running "python web2py.py -c server.crt -k server.key -a password -
> > > i  -p "
> > > This way web2py uses the proxy seamlessly (It works fine!)
>
> > > but when i deploy using wsgi either in apache or cherokee web2py does
> > > not see the proxy. what could be wrong? where is this problem
> > > occurring?
>
> > > Luis .. which is the web server and cgi setup you are using?
>
> > > i am really impressed with the speed of cherokee + wsgi + web2py, the
> > > memory foot print is small and the whole thing runs like greased
> > > lightning :D .. i just hope to solve this proxy issue.
>
> > > On Feb 11, 10:50 pm, Luis Díaz  wrote:
> > > > I forgot.
> > > > if you need to specify username and password
> > > > then the structure would be something.
>
> > > > export http_proxy =http://username:password@proxy:port/
> > > > export https_proxy =http://username:password@proxy:port/
> > > > export ftp_proxy =http://username:password@proxy:port/
>
> > > > 2011/2/11 Luis Díaz 
>
> > > > > Greetings,
> > > > > web2py I mention that I use in my work.
> > > > > and we have a proxy that we restrict the output
> > > > > by user name and password
>
> > > > > I have solved the problem properly configuring the proxy on the
> > > computer
> > > > > where I have installed debian web2py
>
> > > > > nano /etc/profile
>
> > > > > adding the following lines:
>
> > > > > export http_proxy =http://proxy.uc.edu.ve:5010/
> > > > > export https_proxy =http://proxy.uc.edu.ve:5010/
> > > > > export ftp_proxy =http://proxy.uc.edu.ve:5010/
>
> > > > > 2011/2/11 Massimo Di Pierro 
>
> > > > > Thanks for your comments.
>
> > > > >> WHen you need urllib, and web2py.python makes outbound connections 
> > > > >> you
> > > > >> should not need a proxy server or any proxy configuration as far as I
> > > > >> can tell (and I am not sure about your setup). This looks more of a
> > > > >> firewall issue.
>
> > > > >> On Feb 11, 5:19 am, whowhywhat  wrote:
> > > > >> > web2py is the first framework i actually enjoy using. :) .. been
> > > > >> > advocating it to everyone i meet these days. I sincerely thank the
> > > > >> > entire web2py community for everything.
>
> > > > >> > I have been developing a small web2py application for intranet use
> > > at
> > > > >> > the place where i work. During development i used windows (i carry
> > > > >> > web2py on a thumb drive). At work we use a proxy for net access and
> > > in
> > > > >> > windows i have no problems with web2py accessing the net using the
> > > > >> > proxy.
> > > > >> > I can use urllib to fetch webpages etc.
>
> > > > >> > To deploy the app i am using Ubuntu. I have deployed web2py using
> > > both
> > > > >> > apache as well as Cherokee using WSGI. The application runs fine.
> > > > >> > however the web2py environment is not able to fetch anything from
> > > the
> > > > >> > internet. urllib does not fetch any webpages. I have expl

Re: [web2py] powertable: howto adjust table width

2011-02-13 Thread Bruno Rocha
If you dont like to use CSS you can set it directly to the table.

plugins.powerTable._width='400'


Re: [web2py] powertable: howto adjust table width

2011-02-13 Thread Bruno Rocha
Best way is using CSS

the default will give you:


so in your view

.powerTable{
 width:400px !important;
}



--
Bruno Rocha
http://about.me/rochacbruno/bio


2011/2/14 tomt 

> Hello,
>
> I would like to be able to change the width of the powertable output.
> It seems to be set at a fixed value.  I was able to influence the
> column width by setting
> .dtfeatures['bAutoWidth'] = False but the header and trailer remain
> the same width.  Is this controlled by an option?  Is it set in the
> css?   Any suggestions?
>
> Thanks in advance. - Tom


[web2py] Re: Using comet sockets

2011-02-13 Thread Anthony
On Sunday, February 13, 2011 4:41:18 PM UTC-5, Massimo Di Pierro wrote: 
>
> Right now the only examples are in web2py/gluon/contrib/ 
> comet_messaging.py 

 
Is "Comet" the right terminology for this? It looks like it uses the new 
WebSockets protocol, not traditional Comet. My understanding is that Comet 
refers only to the older HTTP-based long-polling and streaming techniques: 
http://en.wikipedia.org/wiki/Comet_(programming)
 
Also, if I'm not mistaken, this implements WebSocket communications only in 
the server-to-client direction, but not from client to server. Do you plan 
to add capabilities for bi-directional WS communication?
 
Anyway, this is very cool, and I think a nice additional piece of 
functionality for web2py. Would be neat if we could put together some kind 
of chat plugin.
 
Anthony


[web2py] powertable: howto adjust table width

2011-02-13 Thread tomt
Hello,

I would like to be able to change the width of the powertable output.
It seems to be set at a fixed value.  I was able to influence the
column width by setting
.dtfeatures['bAutoWidth'] = False but the header and trailer remain
the same width.  Is this controlled by an option?  Is it set in the
css?   Any suggestions?

Thanks in advance. - Tom


Re: [web2py] URL anchor breaks routes

2011-02-13 Thread Jonathan Lundell
On Feb 13, 2011, at 6:31 PM, Richard Baron Penman wrote:
> I do want to remove the /page/ part.
> Specifying a list of functions would be fine - how is that done?

There's no mechanism for it now; you'll have to use the regex mechanism.

I'll look at adding it to the new version.


> 
> 
> On Mon, Feb 14, 2011 at 1:21 PM, Jonathan Lundell  wrote:
> On Feb 13, 2011, at 5:53 PM, Plumo wrote:
> > In the main routes.py I have:
> >
> > routes_app = ((r'/(?Pcms|admin)\b.*', r'\g'),
> >   (r'(.*)', r'cms'),
> >   (r'/?(.*)', r'cms'))
> 
> The last one is redundant, I think.
> 
> >
> >
> > And in my application specific routes.py I have:
> >
> > routes_in = (
> > ('/', '/cms/plugin_wiki/page/index'),
> > ('/about', '/cms/plugin_wiki/page/about'),
> > ('/faq', '/cms/plugin_wiki/page/faq'),
> > )
> > routes_out = [(x, y) for (y, x) in routes_in]
> >
> >
> > Is there a better way to do this using the new version of routes?
> 
> I don't think so. The closest you can come is to make cms and plugin_wiki the 
> default application and controller, but it won't suppress the function as 
> long as there's an argument. So you'd end up with paths like /page/index, 
> page/about, page/faq.
> 
> I could manage something like what you're doing if you'd be prepared to 
> specify a list of functions in the default controller.
> 




[web2py] Re: broken images

2011-02-13 Thread stargate
When i edit layout.html i can see the following line of code

{{response.files.append(URL(request.application,'static','plugin_layouts/
layouts/Optimism/style.css'))}}

When i search farther down layout.html i can see the following code



Now this image tag should display the image because it exists but in
the plugin layout the file path is this

/applications/template/static/plugin_layouts/layouts/Optimism/images/
img17.jpg

Now when creating a new application is it better to have the
following

static/layout_plugin/

in layout plugin  all the static files will go in the layout_plugin
directory.

Thanks for the help by the way.

On Feb 13, 9:14 pm, Massimo Di Pierro 
wrote:
> Can you tell the layout name, an example of image url that you get and
> what should be?
>
> On Feb 13, 6:50 pm, stargate  wrote:
>
> > I just created a new site with the wizard and the template Optimism.
> > When the wizard is completed and the site generated everything works
> > fine but all the images are broken.  I tried creating another
> > application with the wizard and the same thing all the images are
> > broken what would be the cause of this.


Re: [web2py] URL anchor breaks routes

2011-02-13 Thread Richard Baron Penman
I do want to remove the /page/ part.
Specifying a list of functions would be fine - how is that done?


On Mon, Feb 14, 2011 at 1:21 PM, Jonathan Lundell wrote:

> On Feb 13, 2011, at 5:53 PM, Plumo wrote:
> > In the main routes.py I have:
> >
> > routes_app = ((r'/(?Pcms|admin)\b.*', r'\g'),
> >   (r'(.*)', r'cms'),
> >   (r'/?(.*)', r'cms'))
>
> The last one is redundant, I think.
>
> >
> >
> > And in my application specific routes.py I have:
> >
> > routes_in = (
> > ('/', '/cms/plugin_wiki/page/index'),
> > ('/about', '/cms/plugin_wiki/page/about'),
> > ('/faq', '/cms/plugin_wiki/page/faq'),
> > )
> > routes_out = [(x, y) for (y, x) in routes_in]
> >
> >
> > Is there a better way to do this using the new version of routes?
>
> I don't think so. The closest you can come is to make cms and plugin_wiki
> the default application and controller, but it won't suppress the function
> as long as there's an argument. So you'd end up with paths like /page/index,
> page/about, page/faq.
>
> I could manage something like what you're doing if you'd be prepared to
> specify a list of functions in the default controller.


Re: [web2py] URL anchor breaks routes

2011-02-13 Thread Jonathan Lundell
On Feb 13, 2011, at 5:53 PM, Plumo wrote:
> In the main routes.py I have:
> 
> routes_app = ((r'/(?Pcms|admin)\b.*', r'\g'),
>   (r'(.*)', r'cms'),
>   (r'/?(.*)', r'cms'))

The last one is redundant, I think.

> 
> 
> And in my application specific routes.py I have:
> 
> routes_in = (
> ('/', '/cms/plugin_wiki/page/index'),
> ('/about', '/cms/plugin_wiki/page/about'),
> ('/faq', '/cms/plugin_wiki/page/faq'),
> )
> routes_out = [(x, y) for (y, x) in routes_in]
> 
> 
> Is there a better way to do this using the new version of routes?

I don't think so. The closest you can come is to make cms and plugin_wiki the 
default application and controller, but it won't suppress the function as long 
as there's an argument. So you'd end up with paths like /page/index, 
page/about, page/faq.

I could manage something like what you're doing if you'd be prepared to specify 
a list of functions in the default controller.

[web2py] Re: new support platform for web2py - make money

2011-02-13 Thread Christopher Steel
I would love to see the code...


On Feb 12, 3:08 pm, Ovidio Marinho  wrote:
> sorry for a moment thought I was on the Brazilian list. But I can provide
> you the code?
>
> 2011/2/12 Francisco Costa 
>
>
>
> > Hi Ovideo.. English please :)
> > The coding is not finished yet
>
> > On Feb 12, 11:53 am, Ovidio Marinho  wrote:
> > > Francisco voce pode disponibilizar o codigo para podermos ver as
> > novidades
> > > que vc colocou nesta app, tipo campos arredondados , icones e etc...
>
> > > 2011/2/11 Francisco Costa 
>
> > > > Hello!
> > > > During the past months I'm using a lot web2py.
> > > > I've been asking a few questions here in this group and I've received
> > > > help from people all around the world. Sometimes I really felt like I
> > > > should give back something to those kind souls..
>
> > > > So that's why in the past 2 days I've createdhttp://askvalue.com/
> > > > (using web2py).
> > > > This is alpha version, and I would like your feedback.
>
> > > > AskValue aims to be a social platform of questions and answers where
> > > > you can make money by doing a valuable question/comment or by
> > > > providing quality answers.
>
> > > > How do you win money? You must have a Flattr.com account (optional)
> > > > and create a "thing" with your site profile:
> > > >http://askvalue.com/user/username
>
> > > > If the user gives you credit I believe that you will be flattred (make
> > > > money)
> > > > If you register you can follow your friends, and receive their updates
> > > > (dashboard under construction).. or you can only follow questions of
> > > > your interest.
> > > > You can also vote on your favorite answers!
>
> > > > I'm also planning to implement during the next week email-
> > > > notifications.
>
> > > > I think that this kind of service can encourages users to help more!
> > > > I also believe that Google Groups is very limited and old-fashionable
> > > > for support, and with this you can have a much richer experience.
>
> > > > Please help me by providing me your honest feedback.
> > > > and please don't mock on my design skills.. I need more time for it :)
>
> > > --
> > >         Ovidio Marinho Falcao Neto
> > >              ovidio...@gmail.com
> > >          Tecnologia da Informaçao
> > >          Casa Civil do Governador
> > >          83 3214 7885 - 88269088
> > >                   Paraiba
>
> --
>         Ovidio Marinho Falcao Neto
>              ovidio...@gmail.com
>          Tecnologia da Informaçao
>          Casa Civil do Governador
>          83 3214 7885 - 88269088
>                   Paraiba


[web2py] Re: onvalidation missing id field

2011-02-13 Thread Brian M
Ah, form.record.id that works - Thanks!

[web2py] Re: broken images

2011-02-13 Thread Massimo Di Pierro
Can you tell the layout name, an example of image url that you get and
what should be?

On Feb 13, 6:50 pm, stargate  wrote:
> I just created a new site with the wizard and the template Optimism.
> When the wizard is completed and the site generated everything works
> fine but all the images are broken.  I tried creating another
> application with the wizard and the same thing all the images are
> broken what would be the cause of this.


[web2py] Re: Using comet sockets

2011-02-13 Thread Massimo Di Pierro
I will take a look. There is a fork for tornado that should work on
windows:

http://groups.google.com/group/python-tornado/browse_thread/thread/675779463dec569e/fa623daa06e41fc5

On Feb 13, 6:31 pm, AsmanCom  wrote:
> Why have you chosen Tornado for this "comet sockets" experiment? it´s
> Unix only, right?
>
> I'm currently working on a quite similar comet sockets with web2py
> Project,
> but I attempt to implement this with hookbox.org which could also be
> worth a look.
>
> On 13 Feb., 22:41, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Right now the only examples are in web2py/gluon/contrib/
> > comet_messaging.py
>
> > This must be mode more powerful and it is on my todo list. It uses
> > tornado. It talks to web2py. It is not web2py specific.
>
> > Massimo
>
> > On Feb 13, 3:30 pm, guruyaya  wrote:
>
> > > Every since the demo of EMTE, I'm fascinated by the option of using
> > > comet sockets to do real time processing. Yet I cannot find any
> > > domestication on the usage of comet sockets in web2py.
> > > Can you help direct me to anything that has to do with this issue?
> > > Thanks in advance
> > > Yair


[web2py] Re: onvalidation missing id field

2011-02-13 Thread Massimo Di Pierro
I will look. Anyway for update forms you can use form.record.id

On Feb 13, 4:59 pm, Brian M  wrote:
> OK, so I'm wanting to calculate values for a few fields when a SQLFORM
> record update is accepted. My understanding is that I should use
> onvalidation = calculation_function but I'm finding that within my
> onvalidation function form.vars does not include the id field which I need
> to know in order to do the other db lookups necessary for my calculations.
> Why is the id field missing from the form var that onvalidation passes it to
> my function? Is this some sort of security/data integrity thing to prevent
> me from foolishly changing it? What's the appropriate way to pass the
> record's ID to my onvalidation function?
>
> ~Brian


[web2py] Re: GAE and sending email

2011-02-13 Thread Plumo
I have also experienced problems with the reply to field. Some info here:
http://code.google.com/p/googleappengine/issues/detail?id=2802

Also there are the restrictions on who you can set as the sender which you 
probably already know about:
http://code.google.com/appengine/docs/python/mail/sendingmail.html


Re: [web2py] URL anchor breaks routes

2011-02-13 Thread Plumo
In the main routes.py I have:

routes_app = ((r'/(?Pcms|admin)\b.*', r'\g'),
  (r'(.*)', r'cms'),
  (r'/?(.*)', r'cms'))


And in my application specific routes.py I have:

routes_in = (
('/', '/cms/plugin_wiki/page/index'),
('/about', '/cms/plugin_wiki/page/about'),
('/faq', '/cms/plugin_wiki/page/faq'),
)
routes_out = [(x, y) for (y, x) in routes_in]


Is there a better way to do this using the new version of routes?


[web2py] Re: Problem with import of Site-Packages

2011-02-13 Thread Plumo
what does web2py say the sys.path is?

Re: [web2py] Problem with import of Site-Packages

2011-02-13 Thread Jonathan Lundell
On Feb 12, 2011, at 6:22 PM, Felipe AP wrote:
> 
> Hi. I'm using the tweepy library, for twitter auth. I import it after
> adding its site-packages folder to the sys.path. Last week, I had to
> install tweepy to my python2.6. Now it doesnt work anymore. It says
> 'ImportError: No module named tweepy'. What to I do??
> 
> Ps: I'm also getting an '_sqlite3' error import when I use
> 'python2.6 ./web2py.py' instead of './web2py.py'.

Try running python2.6 at the command line and see if you can import those 
things manually.

It sounds like your multiple Python installations are getting confused somehow, 
independent of web2py.

[web2py] Re: Problem with import of Site-Packages

2011-02-13 Thread Felipe AP
please, help me! it's urgent!


[web2py] Re: Language Wars: Sign Up

2011-02-13 Thread Garrafa Pet 2 Litros
Sorry about the double post,

Just for complete, I'm not part of net.tutsplus.com, but i know it's a
much visited webdesign blog and this competition seems good to assist
in the grouth of the web2py. (well, give a look at the comments...
people are asking for a discussion between python and ruby, python/
web2py should have a bigger participation on that blog, shouldn't?)


[web2py] broken images

2011-02-13 Thread stargate
I just created a new site with the wizard and the template Optimism.
When the wizard is completed and the site generated everything works
fine but all the images are broken.  I tried creating another
application with the wizard and the same thing all the images are
broken what would be the cause of this.



[web2py] Language Wars: Sign Up

2011-02-13 Thread Garrafa Pet 2 Litros
You should know tutsplus.com. Well, those guys are promoting a language
competition for discuss about web development and I belive on web2py
potential to be part of this discussion.
On the other hand I'm not an expert in python or web2py, so I'm posting it
here for who wants to participate.

"""

Language Wars: Sign Up
Hey, guys! I’m launching a new series on Nettuts+ soon, and I need your
help! The series is called “Language Wars,” and will provide two developers
— who have differing views on a particular subject — with a pedestal to
speak their peace.
If this sounds like fun, and you’d like to make some extra money, sign up in
the comments!

I Don’t Get It
Okay, for example, the first entry, “jQuery vs. MooTools” will feature a
die-hard fan from each camp. They’ll then have the opportunity to answer a
handful of questions, and illustrate why they prefer one library over the
other. Future postings could spotlight “CodeIgniter vs. Kohana,” “PHP vs.
Ruby,” etc.

How Do I Submit?
There are a handful of rules and requirements that must be met, in order to
be selected to represent your “team.”
This is all in good fun. We’re not looking for mean-spirited, heated
debates. Respect is key.
In exchange for your opinions, each participant (2 per entry) will receive
$100. Your name and company will also be promoted on the posting, if you
wish.
You must be relatively well established in your field. This should come in
the form of at least 5 years of real-word experience with that particular
language or framework. Please don’t apply within the comments unless you
genuinely feel that you have a high-level understanding of the concepts and
reasoning behind your choice.
No winner will be declared. This isn’t about that; it’s simply a fun way to
discuss your opinion.
So that’s it! Who’s game? This should be fun and educational!

"""
Jeffrey Way on Feb 10th 2011

If anybody liked, please follow the link below:
http://net.tutsplus.com/articles/news/language-wars-sign-up/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+nettuts+(Nettuts%2B)&utm_content=Google+Feedfetcher

-- 
Att,

Garrafa
Lucas Vasconcelos


[web2py] Re: Using comet sockets

2011-02-13 Thread AsmanCom
Why have you chosen Tornado for this "comet sockets" experiment? it´s
Unix only, right?

I'm currently working on a quite similar comet sockets with web2py
Project,
but I attempt to implement this with hookbox.org which could also be
worth a look.


On 13 Feb., 22:41, Massimo Di Pierro 
wrote:
> Right now the only examples are in web2py/gluon/contrib/
> comet_messaging.py
>
> This must be mode more powerful and it is on my todo list. It uses
> tornado. It talks to web2py. It is not web2py specific.
>
> Massimo
>
> On Feb 13, 3:30 pm, guruyaya  wrote:
>
>
>
>
>
>
>
> > Every since the demo of EMTE, I'm fascinated by the option of using
> > comet sockets to do real time processing. Yet I cannot find any
> > domestication on the usage of comet sockets in web2py.
> > Can you help direct me to anything that has to do with this issue?
> > Thanks in advance
> > Yair


[web2py] Re: Authorization for Webhooks

2011-02-13 Thread AsmanCom
I can see the stored data, but I just do not know how  to extract the
required values,

Do I have to unpickle these files somehow, or is there perhaps a more
framework-conform-approach to query these two values?

I would not like to import external libraries for this.

I thought querying user_name/is_logged_in by session_id would be a
basic built in functionality...

THX

Dieter Asman


On 13 Feb., 15:54, Massimo Di Pierro 
wrote:
> The session it is the name of the sessions file under app/sessions. It
> is a pickle. Try open it and see what is inside.
>
> On Feb 13, 6:43 am, AsmanCom  wrote:
>
>
>
>
>
>
>
> > Does nobody know, how to query these two values by the given
> > session_id (session_id_myapp=127.0.0.1-2b77d424-4e72-4d3f-a0de-
> > badbcdbe6a30)?
>
> > 1. is_logged_in (boolean)
> > 2. username or user email (string)
>
> > I looked in the book, i´ve searched this group, i´ve searched the web,
> > but still can´t find any Solution...
>
> > So could anyone, who knows about the auth-process, please take a look
> > at it.
>
> > Thanks in advance.
> > Dieter Asman


[web2py] Re: What user is logged in (or, restricting access based on user)

2011-02-13 Thread Niphlod
Wonderful. Actually never used but I'm totally going to use it! TY for
clarification.

On Feb 13, 3:50 pm, Massimo Di Pierro 
wrote:
> auth.user_id
>
> is defined as
>
> if auth.user: auth.user_id = auth.user.id
> else: auth.user_id = None
>
> On Feb 13, 3:29 am, Niphlod  wrote:
>
> > I think that auth.user_id in example needs to be auth.user.id .
>
> > @pbreit: if you have a table like that and want to show to user "1"
> > all the records with owner_id = 1, decorate the controller with
> > @auth.requires_login() to make sure a registered user is logged.
> > In the controller now you can access to auth.user.* that is all the
> > data associated with the logged in user.
> > auth.user.id is the id of that user.
>
> > e.g. rows = db(db.detail.owner_id==auth.user.id).select()
>
> > On Feb 12, 11:53 am, villas  wrote:
>
> > > You can't give permissions to users,  only to groups.  Therefore the
> > > only way to give permissions to a unique user is through their unique
> > > group. The book gives an example where this is used in the section
> > > Authorization and CRUD.
>
> > > You don't need to use the inidividual user groups. I have never needed
> > > to use them. Just turn them off and do your own thing:
> > > auth.settings.create_user_groups = False
>
> > > On Feb 12, 2:56 am, pbreit  wrote:
>
> > > > I get the concept of groups which is why I was confused that web2py auth
> > > > creates a auth_group.role for each individual user (user_1, user_2 and 
> > > > so
> > > > on).
>
> > > > In all of my apps I have just one class of users. Sometimes, only the
> > > > created_by can view an item. And usually, only the create_by can edit an
> > > > item. And on pretty much every page I have personalizations based on the
> > > > logged in user. Almost every web site I can think of works like this.
>
>


[web2py] onvalidation missing id field

2011-02-13 Thread Brian M
OK, so I'm wanting to calculate values for a few fields when a SQLFORM 
record update is accepted. My understanding is that I should use 
onvalidation = calculation_function but I'm finding that within my 
onvalidation function form.vars does not include the id field which I need 
to know in order to do the other db lookups necessary for my calculations. 
Why is the id field missing from the form var that onvalidation passes it to 
my function? Is this some sort of security/data integrity thing to prevent 
me from foolishly changing it? What's the appropriate way to pass the 
record's ID to my onvalidation function?

~Brian


Re: [web2py] Help using URLLIB instead of PYCURL

2011-02-13 Thread Vasile Ermicioi
you need urllib2
http://docs.python.org/library/urllib2.html#examples


[web2py] Re: Question about powertable error

2011-02-13 Thread tomt
I got the same error when I tried ['task.title'] so I looked a little
closer at my controller and realized the problem started when I set
table.keycolumn = 'tasks.id'

Changing it to 'task.id' fixed the problem. Now table.columns=
['task.title']  works.

Thanks for the quick response.

On Feb 13, 3:57 pm, Bruno Rocha  wrote:
> 2011/2/13 tomt 
>
> >  table.columns = ['tasks.title']
>
> Try with:
>
>   table.columns = ['task.title']
>
> where 'task' is the name of the table, 'title' the name of the field.


Re: [web2py] Question about powertable error

2011-02-13 Thread Bruno Rocha
2011/2/13 tomt 

>  table.columns = ['tasks.title']


Try with:

  table.columns = ['task.title']

where 'task' is the name of the table, 'title' the name of the field.


[web2py] Re: Using comet sockets

2011-02-13 Thread Massimo Di Pierro
Right now the only examples are in web2py/gluon/contrib/
comet_messaging.py

This must be mode more powerful and it is on my todo list. It uses
tornado. It talks to web2py. It is not web2py specific.

Massimo

On Feb 13, 3:30 pm, guruyaya  wrote:
> Every since the demo of EMTE, I'm fascinated by the option of using
> comet sockets to do real time processing. Yet I cannot find any
> domestication on the usage of comet sockets in web2py.
> Can you help direct me to anything that has to do with this issue?
> Thanks in advance
> Yair


[web2py] Using comet sockets

2011-02-13 Thread guruyaya
Every since the demo of EMTE, I'm fascinated by the option of using
comet sockets to do real time processing. Yet I cannot find any
domestication on the usage of comet sockets in web2py.
Can you help direct me to anything that has to do with this issue?
Thanks in advance
Yair


[web2py] Question about powertable error

2011-02-13 Thread tomt
Hi,

I am using powertable to display a subset of a table's rows:
...
id=request.args(0)
tasks=db(db.task.cparef==id).select(db.task.ALL)
table = plugins.powerTable
table.datasource = tasks
...

This works just fine, but when I try to specify the columns
table.columns = ['tasks.title']

I receive the following error:   'something wrong in Rows object'

Any suggestions?


[web2py] Re: Postgresql auth_user_id_seq already exist . Urgent!!!

2011-02-13 Thread Massimo Di Pierro
Most of your problems are solved by:

http://www.web2py.com/examples/static/nightly/web2py_src.zip

Please check it and let us know if you still have a problem.

On Feb 13, 1:44 pm, Ovidio Marinho  wrote:
>             This thread not have with problem related.Also the previous
> problem 'and on postgres, but I reported the problem' and it says that
> different auth_user_id_seq already exists and in fact the databases
> was not created, 'and the creation of the database. So if there
> is already where this correction? i, sorry only detected the problem when I
> removed the database and tried to create again, andthe production is
> working but need to fix it by pressing it.
>
> 2011/2/13 Massimo Di Pierro 
>
>
>
>
>
>
>
>
>
> > Follow up on other thread:
>
> >http://groups.google.com/group/web2py/browse_thread/thread/464c7f3ab4...
>
> > On Feb 13, 9:56 am, Ovidio Marinho  wrote:
> > > Personally, I gave up after many tests, I decided to return the
> > installation
> > > of 189.6 andeverything works normally, a problem with the new DAL in
> > > relation to postgresql.
> > > --
> > >         Ovidio Marinho Falcao Neto
> > >              ovidio...@gmail.com
> > >          Tecnologia da Informaçao
> > >          Casa Civil do Governador
> > >          83 3214 7885 - 88269088
> > >                   Paraiba
>
> --
>         Ovidio Marinho Falcao Neto
>              ovidio...@gmail.com
>          Tecnologia da Informaçao
>          Casa Civil do Governador
>          83 3214 7885 - 88269088
>                   Paraiba


Re: [web2py] Re: include files

2011-02-13 Thread Marin Pranjic
good :)

if you put slash at the beginning of the path, it is evaluated as apsolute
path (from root folder)

without slash or with "./" (dot slash) it is relative path, and that's what
you need.

On Sun, Feb 13, 2011 at 9:45 PM, stargate  wrote:

> That worked
>
> On Feb 13, 3:29 pm, Marin Pranjic  wrote:
> > MAYBE this?
> > {{include 'includes/header.html'}}
> >
> > On Sun, Feb 13, 2011 at 9:25 PM, stargate  wrote:
> > > I am trying to include the following file but it gives me a error
> >
> > > {{include 'includes/header.html'}}
> >
> > > The file and folder exist but it doesn't work what I am doing wrong.
>


[web2py] Re: include files

2011-02-13 Thread stargate
That worked

On Feb 13, 3:29 pm, Marin Pranjic  wrote:
> MAYBE this?
> {{include 'includes/header.html'}}
>
> On Sun, Feb 13, 2011 at 9:25 PM, stargate  wrote:
> > I am trying to include the following file but it gives me a error
>
> > {{include 'includes/header.html'}}
>
> > The file and folder exist but it doesn't work what I am doing wrong.


Re: [web2py] include files

2011-02-13 Thread Marin Pranjic
MAYBE this?
{{include 'includes/header.html'}}

On Sun, Feb 13, 2011 at 9:25 PM, stargate  wrote:

> I am trying to include the following file but it gives me a error
>
> {{include 'includes/header.html'}}
>
> The file and folder exist but it doesn't work what I am doing wrong.
>
>


[web2py] include files

2011-02-13 Thread stargate
I am trying to include the following file but it gives me a error

{{include '/includes/header.html'}}

The file and folder exist but it doesn't work what I am doing wrong.



[web2py] mod_pagespeed

2011-02-13 Thread ma...@rockiger.com
Did somebody of you guys ever uses the mod_pagespeed for Apache?

Did it work well with web2py? How were the speed gains?


Re: [web2py] Re: Postgresql auth_user_id_seq already exist . Urgent!!!

2011-02-13 Thread Ovidio Marinho
This thread not have with problem related.Also the previous
problem 'and on postgres, but I reported the problem' and it says that
different auth_user_id_seq already exists and in fact the databases
was not created, 'and the creation of the database. So if there
is already where this correction? i, sorry only detected the problem when I
removed the database and tried to create again, andthe production is
working but need to fix it by pressing it.



2011/2/13 Massimo Di Pierro 

> Follow up on other thread:
>
>
> http://groups.google.com/group/web2py/browse_thread/thread/464c7f3ab44fb240#
>
> On Feb 13, 9:56 am, Ovidio Marinho  wrote:
> > Personally, I gave up after many tests, I decided to return the
> installation
> > of 189.6 andeverything works normally, a problem with the new DAL in
> > relation to postgresql.
> > --
> > Ovidio Marinho Falcao Neto
> >  ovidio...@gmail.com
> >  Tecnologia da Informaçao
> >  Casa Civil do Governador
> >  83 3214 7885 - 88269088
> >   Paraiba
>



-- 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 Tecnologia da Informaçao
 Casa Civil do Governador
 83 3214 7885 - 88269088
  Paraiba


[web2py] Re: routes.py

2011-02-13 Thread stargate
I renamed my app folder to init and it worked.  But there has to be
another way so that if i create multiple application i can have them
point to them so for example in my windows host file I will have the
following

host file
127.0.0.1   www.domain1.com
127.0.0.1   www.domain2.com
127.0.0.1   www.domain3.com
127.0.0.1   www.domain4.com

The in web2py lets say i have the following applications

domain1
domain2
domain3
domain4

i need a example on how to use routes.py so that this can work

On Feb 13, 2:04 pm, stargate  wrote:
> I creating a routes.py with the following
>
> routes_in=(
>   ('mydomain.com','/mydomain/default/index'),
> )
> routes_out=(
>   ('mydomain.com','/mydomain'),
> )
>
> so when i type mydomain.com it should point to that directory that has
> that application installed
>
> On Feb 13, 10:44 am, Bruno Rocha  wrote:
>
> > I use autoroutes in routes.py
>
> > You need routes.confhttp://snipt.net/rochacbruno/routesconf/
>
> > In the above file replace with your domain and your app.
> > 127.0.01.1 /yourapp/default
> > yourdomain.com /yourapp/default
>
> > and 
> > routes.pyhttp://snipt.net/rochacbruno/routespy/
>
> > with the example above you get rid of the app name, so
> > yourapp.com/indexwill call yourapp,com/default/index
>
> > if you just need to your app to be the default, you can simply rename the
> > app folder to "init"
> > 
> > --
> > Bruno Rochahttp://about.me/rochacbruno/bio
>
> > 2011/2/13 stargate 
>
> > > I was wondering how do I configure routes.py so that my application
> > > myapp works like this
>
> > > when i typewww.myapp.comitwill go to that web2py application.  I
> > > know in windows i can edit the host file in windows but I want it to
> > > go directly to my application.  All of my paths are absolute paths
>
>


[web2py] Help using URLLIB instead of PYCURL

2011-02-13 Thread david.waldrop
I am trying to read form the Twitter realtime stream API using URLLIB
instead of PYCURL but am not able to do so.  Belw is the PYCURL
sample.  Anyone have any ideas or samples to get me started on the
right track?

def getTwitter2():
  import pycurl, json, StringIO

  STREAM_URL = "http://chirpstream.twitter.com/2b/user.json";
  REST_URL = "http://api.twitter.com/1/";

  class Client:
def __init__(self):
  self.friends = []
  self.buffer = ""
  self.userid = None
  self.conn = pycurl.Curl()

def authenticate(self, username, password):
  output = StringIO.StringIO()
  self.conn.setopt(pycurl.USERPWD, "%s:%s" % (username, password))
  self.conn.setopt(pycurl.URL, REST_URL + "account/
verify_credentials.json")
  self.conn.setopt(pycurl.WRITEFUNCTION, output.write)
  self.conn.perform()

  data = json.loads(output.getvalue())
  if "error" in data: return False
  self.userid = data["id"]
  return True

def connect(self):
  self.conn.setopt(pycurl.URL, STREAM_URL)
  self.conn.setopt(pycurl.WRITEFUNCTION, self.on_receive)
  self.conn.perform()

def on_receive(self, data):
  self.buffer += data
  if data.endswith("\r\n") and self.buffer.strip():
content = json.loads(self.buffer)
self.buffer = ""

if "friends" in content:
  self.friends = content["friends"]

elif "text" in content:
  to = content["in_reply_to_user_id"]
  if to and to != self.userid and to not in self.friends:
return
  if to == self.userid: print "(REPLY)",
  print u"{0[user][name]}: {0[text]}".format(content)

  client = Client()
  if client.authenticate("dlwatey" "della0308"):
client.connect()
  else:
print "Login credentials aren't valid!"

  return


[web2py] Re: routes.py

2011-02-13 Thread stargate
I creating a routes.py with the following

routes_in=(
  ('mydomain.com','/mydomain/default/index'),
)
routes_out=(
  ('mydomain.com','/mydomain'),
)


so when i type mydomain.com it should point to that directory that has
that application installed



On Feb 13, 10:44 am, Bruno Rocha  wrote:
> I use autoroutes in routes.py
>
> You need routes.confhttp://snipt.net/rochacbruno/routesconf/
>
> In the above file replace with your domain and your app.
> 127.0.01.1 /yourapp/default
> yourdomain.com /yourapp/default
>
> and 
> routes.pyhttp://snipt.net/rochacbruno/routespy/
>
> with the example above you get rid of the app name, so
> yourapp.com/indexwill call yourapp,com/default/index
>
> if you just need to your app to be the default, you can simply rename the
> app folder to "init"
> 
> --
> Bruno Rochahttp://about.me/rochacbruno/bio
>
> 2011/2/13 stargate 
>
> > I was wondering how do I configure routes.py so that my application
> > myapp works like this
>
> > when i typewww.myapp.comit will go to that web2py application.  I
> > know in windows i can edit the host file in windows but I want it to
> > go directly to my application.  All of my paths are absolute paths
>
>


[web2py] Re: Web2Py Problem

2011-02-13 Thread Massimo Di Pierro
Perhaps something like this?

def index():
return dict(button=TAG.button(_onclick="ajax('%s',[],'output')" %
URL('myprogram')),
area=TEXTAREA(_id='output'))

def myprogram():
return str(run_my_program())

It really depends on whether your program needs to be executed in
background in a different thread/process or not.


On Feb 13, 11:55 am, Jack315  wrote:
> Hey guys, I'm new to this group, and a novice python programmer. In
> web2py, I want to know how to use python to make a simple, clickable
> button that when clicked runs a python program.
>
> Thanks,
>
> Jack


[web2py] Web2Py Problem

2011-02-13 Thread Jack315
Hey guys, I'm new to this group, and a novice python programmer. In
web2py, I want to know how to use python to make a simple, clickable
button that when clicked runs a python program.

Thanks,

Jack


[web2py] Gluon tools.py - form style

2011-02-13 Thread David J
The change password and lost password forms are missing the "formstyle "
attribute.

If you look in gluon tools.py you see both methods call the form_factory,
the last line of these 2 methods should be
.",formstyle=self.settings.formstyle)" this way it maintains consistency
between forms.
Please commit to trunk.

Thx.


[web2py] Re: Postgresql auth_user_id_seq already exist . Urgent!!!

2011-02-13 Thread Massimo Di Pierro
Follow up on other thread:

http://groups.google.com/group/web2py/browse_thread/thread/464c7f3ab44fb240#

On Feb 13, 9:56 am, Ovidio Marinho  wrote:
> Personally, I gave up after many tests, I decided to return the installation
> of 189.6 andeverything works normally, a problem with the new DAL in
> relation to postgresql.
> --
>         Ovidio Marinho Falcao Neto
>              ovidio...@gmail.com
>          Tecnologia da Informaçao
>          Casa Civil do Governador
>          83 3214 7885 - 88269088
>                   Paraiba


[web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-13 Thread Massimo Di Pierro
this problem has been already fixed in trunk some time ago. Check the
nightly build from the download page.

Massimo

On Feb 13, 8:43 am, Ovidio Marinho  wrote:
> Here if I create a new db postgres does not create the tables,already in the
> database sqlite, normally creates.
>
> 2011/2/4 Massimo Di Pierro 
>
>
>
>
>
>
>
>
>
> > You are using web2py trunk right? Did you set a sequence_name
> > manually?
>
> > On Feb 4, 7:22 am, Tom Atkins  wrote:
> > > I am getting the same error as reported by Carlos and cannot fix it.
>
> > > I have just set up a new server (Ubuntu 10.04 - postgres 8.4, Python
> > 2.6.5)
> > > and have web2py trunk up and running fine.  I have an unmodified
> > 'welcome'
> > > app which runs perfectly with sqlite.
>
> > > I then delete all the files in databases, cache and  sessions.  Next I
> > > create a postgresql database and grant permissions to the appropriate
> > user.
> > >  I have double checked this and the user can create tables on the
> > database.
>
> > > Next change the connection details in the welcome app db.py to:
>
> > > db = DAL('postgres://myuser:mypasswordlocalhost/mydb')
>
> > > Then visit the URL and I get the ticket below.
>
> > > Any help gratefully appreciated.  (I had this running fine on a previous
> > > server)
>
> > > 
>
> > > Traceback (most recent call last):
> > >   File "/home/www-data/web2py/gluon/restricted.py", line 188, in
> > restricted
> > >     exec ccode in environment
> > >   File "/home/www-data/web2py/applications/welcome/models/db.py", line
> > 32,
> > > in 
> > >     auth.define_tables()                           # creates all needed
> > > tables
> > >   File "/home/www-data/web2py/gluon/tools.py", line 1177, in
> > define_tables
> > >     format='%(first_name)s %(last_name)s (%(id)s)')
> > >   File "/home/www-data/web2py/gluon/dal.py", line 3489, in define_table
> > >     polymodel=polymodel)
> > >   File "/home/www-data/web2py/gluon/dal.py", line 531, in create_table
> > >     self.create_sequence_and_triggers(query,table)
> > >   File "/home/www-data/web2py/gluon/dal.py", line 1512, in
> > > create_sequence_and_triggers
> > >     self.execute('CREATE SEQUENCE %s;' % sequence_name)
> > >   File "/home/www-data/web2py/gluon/dal.py", line 1078, in execute
> > >     return self.log_execute(*a, **b)
> > >   File "/home/www-data/web2py/gluon/dal.py", line 1075, in log_execute
> > >     return self.cursor.execute(*a,**b)
> > > ProgrammingError: relation "auth_user_id_seq" already exists
>
> > > ERROR SNAPSHOT
> > > (relation "auth_user_id_seq" already
> > > exists
>
> > > Frames
>
> > > File /home/www-data/web2py/gluon/restricted.py in restricted at line
> > > 188 code arguments variables
>
> > > File /home/www-data/web2py/applications/welcome/models/db.py in 
> > at
> > > line 32 code arguments variables
>
> > > File /home/www-data/web2py/gluon/tools.py in define_tables at line
> > > 1177 code arguments variables
>
> > > File /home/www-data/web2py/gluon/dal.py in define_table at line
> > > 3489 code arguments variables
>
> > > File /home/www-data/web2py/gluon/dal.py in create_table at line
> > > 531 code arguments variables
>
> > > File /home/www-data/web2py/gluon/dal.py in create_sequence_and_triggers
> > at
> > > line 1512 code arguments variables
>
> > > File /home/www-data/web2py/gluon/dal.py in execute at line
> > > 1078 code arguments variables
>
> > > File /home/www-data/web2py/gluon/dal.py in log_execute at line
> > > 1075 code arguments variables
>
> > > Function argument list
>
> > > (self=, *a=('CREATE SEQUENCE
> > > auth_user_id_Seq;',), **b={})
>
> > > Code listing
>
> > > 1070.
> > > 1071.
> > > 1072.
> > > 1073.
> > > 1074.
> > > 1075.
> > > 1076.
> > > 1077.
> > > 1078.
> > > 1079.
>
> > > def create_sequence_and_triggers(self, query, table, **args):
> > > self.execute(query)
>
> > > def log_execute(self,*a,**b):
> > > self.db._lastsql = a[0]
> > > return self.cursor.execute(*a,**b)
>
> > > def execute(self,*a,**b):
> > > return self.log_execute(*a, **b)
>
> > > Variables
>
> > > a('CREATE SEQUENCE auth_user_id_Seq;',)
> > > self.cursor
> > > self
> > > b{}
> > > self.cursor.execute > > object>
>
> --
>         Ovidio Marinho Falcao Neto
>              ovidio...@gmail.com
>          Tecnologia da Informaçao
>          Casa Civil do Governador
>          83 3214 7885 - 88269088
>                   Paraiba


[web2py] Re: Bugs - javascript includes oddities in the plugin_wiki

2011-02-13 Thread Bogdan Hlevca
I think so, it will bring the plugin_wiki to the current versions of
the underlying  3rd party technologies and will save some time for
other people.
I spent half day figuring out what was wrong.  I love the plugin_wiki
and I use it everywhere

You can see the  rss aggregator at work at http://www.hlevca.com.
Click on the New tab and hover the mouse over the  links .
The dialog/tooltip follows the mouse. Without that include  ( I
mentioned in the web2pyslices ) the dialog will be always in the top
left corner of the browser window.

I think that we should make the themes jquery-ui JS lib to be last in
the path to have precedence over  Elrte, so that will be no dependece
on that version. In addition an upgrade of elrte would be desirable.

Bogdan

On Feb 13, 9:55 am, Massimo Di Pierro 
wrote:
> Do you think this should be incided in the "official" plugin-wiki?
>
> On Feb 12, 7:14 pm, Bogdan Hlevca  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I just created a widget to display aggregated feeds on a page using
> > the plugin_wiki.
> > You can find the code at:
> >  http://web2pyslices.com/main/slices/take_slice/120
>
> > It can be noticed that I had to include (again) the jquery-ui JS lib
> > in order to ensure that the 'dialog` feature used to mimic a tool-tip
> > over the links follows the position of the mouse pointer.
>
> > Doing a search on the directory it came out that Elrte ( the embedded
> > editor ) is using jquery-ui, but it has its own version and probably
> > obsolete. I tried with jquery-ui 1.7.9 and the position feature for
> > the dialog does not work, newer versions like 1.8.4 position the
> > dialog properly. This points to the fact that elrte uses an older
> > jquery-ui library.
>
> > I believe that elrte is the problem because is quite old at 1.0rc4 and
> > the latest version is at 1.2. Probably plugin_wiki should be updated
> > to the latest version.
> > Irrespective of whether elrte will be upgraded or not, I think that
> > the plugin_wiki should be made independent of the elrte library and
> > have the included jquery-ui library in the themes directory to take
> > priority.
>
> > It is possible that not elrte is at fault, but in this case there is
> > another interference from somewhere else. In any case the include
> > works for now, but this is just a hack and I would prefer a cleaner
> > way.
>
> > Bogdan


[web2py] Postgresql auth_user_id_seq already exist . Urgent!!!

2011-02-13 Thread Ovidio Marinho
Personally, I gave up after many tests, I decided to return the installation
of 189.6 andeverything works normally, a problem with the new DAL in
relation to postgresql.
-- 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 Tecnologia da Informaçao
 Casa Civil do Governador
 83 3214 7885 - 88269088
  Paraiba


Re: [web2py] routes.py

2011-02-13 Thread Bruno Rocha
I use autoroutes in routes.py

You need routes.conf
http://snipt.net/rochacbruno/routesconf/

In the above file replace with your domain and your app.
127.0.01.1 /yourapp/default
yourdomain.com /yourapp/default

and routes.py
http://snipt.net/rochacbruno/routespy/

with the example above you get rid of the app name, so
yourapp.com/indexwill call yourapp,com/default/index

if you just need to your app to be the default, you can simply rename the
app folder to "init"

--
Bruno Rocha
http://about.me/rochacbruno/bio


2011/2/13 stargate 

> I was wondering how do I configure routes.py so that my application
> myapp works like this
>
> when i type www.myapp.com it will go to that web2py application.  I
> know in windows i can edit the host file in windows but I want it to
> go directly to my application.  All of my paths are absolute paths
>
>
>


[web2py] routes.py

2011-02-13 Thread stargate
I was wondering how do I configure routes.py so that my application
myapp works like this

when i type www.myapp.com it will go to that web2py application.  I
know in windows i can edit the host file in windows but I want it to
go directly to my application.  All of my paths are absolute paths




Re: [web2py] Re: Application logging

2011-02-13 Thread Jonathan Lundell
On Feb 13, 2011, at 5:41 AM, Michael McGinnis wrote:
> 
> I can't find documentation in the book for this, either by searching
> for logging.conf, logger.app or web2py.app. Maybe I'm lazy or
> ignorant. But I love the usability consulting part of my job: anytime
> something isn't extremely easy for me to find on a website, I can
> claim that it's not my fault, that the site should be made more usable
> for lazy, ignorant people.

It's a feature that was added since the book was written. 

It's a standard configuration file for standard Python logging. The example 
configuration file is intended as a starter for those of us who aren't familiar 
with Python logging to begin with. 

You're right; a book section would be nice.

> 
> On Feb 13, 12:03 am, Jonathan Lundell  wrote:
>> On Feb 12, 2011, at 9:44 PM, pbreit wrote:
>> 
>>> What is current recommendation for app logging?
>> 
>> You can start by copying logging.example.conf to logging.conf, and then 
>> editing it to suit your requirements.
>> 
>> Either log with web2py.app (logger_app) or create a new logger specific to 
>> your own application.




[web2py] Re: Bugs - javascript includes oddities in the plugin_wiki

2011-02-13 Thread Massimo Di Pierro
Do you think this should be incided in the "official" plugin-wiki?

On Feb 12, 7:14 pm, Bogdan Hlevca  wrote:
> Hi,
>
> I just created a widget to display aggregated feeds on a page using
> the plugin_wiki.
> You can find the code at:
>  http://web2pyslices.com/main/slices/take_slice/120
>
> It can be noticed that I had to include (again) the jquery-ui JS lib
> in order to ensure that the 'dialog` feature used to mimic a tool-tip
> over the links follows the position of the mouse pointer.
>
> Doing a search on the directory it came out that Elrte ( the embedded
> editor ) is using jquery-ui, but it has its own version and probably
> obsolete. I tried with jquery-ui 1.7.9 and the position feature for
> the dialog does not work, newer versions like 1.8.4 position the
> dialog properly. This points to the fact that elrte uses an older
> jquery-ui library.
>
> I believe that elrte is the problem because is quite old at 1.0rc4 and
> the latest version is at 1.2. Probably plugin_wiki should be updated
> to the latest version.
> Irrespective of whether elrte will be upgraded or not, I think that
> the plugin_wiki should be made independent of the elrte library and
> have the included jquery-ui library in the themes directory to take
> priority.
>
> It is possible that not elrte is at fault, but in this case there is
> another interference from somewhere else. In any case the include
> works for now, but this is just a hack and I would prefer a cleaner
> way.
>
> Bogdan


[web2py] Re: Authorization for Webhooks

2011-02-13 Thread Massimo Di Pierro
The session it is the name of the sessions file under app/sessions. It
is a pickle. Try open it and see what is inside.

On Feb 13, 6:43 am, AsmanCom  wrote:
> Does nobody know, how to query these two values by the given
> session_id (session_id_myapp=127.0.0.1-2b77d424-4e72-4d3f-a0de-
> badbcdbe6a30)?
>
> 1. is_logged_in (boolean)
> 2. username or user email (string)
>
> I looked in the book, i´ve searched this group, i´ve searched the web,
> but still can´t find any Solution...
>
> So could anyone, who knows about the auth-process, please take a look
> at it.
>
> Thanks in advance.
> Dieter Asman


[web2py] Re: auth.signature

2011-02-13 Thread Massimo Di Pierro
Done and I apologize for the original inconsistency

On Feb 13, 3:30 am, Niphlod  wrote:
> +1 for the latter
>
> On Feb 11, 11:01 pm, villas  wrote:
>
>
>
>
>
>
>
> > Yes, it does seem strange to have 'modified_on','updated_by'. They
> > should be the same.
> > In the plugin_wiki it is modified_on, modified_by -- at least that's
> > consistent.
>
> > On Feb 11, 12:29 am, Vinicius Assef  wrote:
>
> > > If you have 'created_on' and 'created_by', what about 'updated_on' and
> > > 'updated_by'?
> > > Vinicius Assef.
>
> > > On Tue, Feb 8, 2011 at 6:39 PM, villas  wrote:
> > > > For those intrigued and cannot update to trunk right now, it creates
> > > > some extra fields...
>
> > > > ['id', 'whatever', 'created_on', 'created_by', 'modified_on',
> > > > 'updated_by']
>
> > > > Nice shortcut, but I never guessed from the name 'auth.signature' what
> > > > it would do.
> > > > Maybe a different name would be clearer?  e.g. 'auth.rectimestamp'


[web2py] Re: What user is logged in (or, restricting access based on user)

2011-02-13 Thread Massimo Di Pierro
auth.user_id

is defined as

if auth.user: auth.user_id = auth.user.id
else: auth.user_id = None


On Feb 13, 3:29 am, Niphlod  wrote:
> I think that auth.user_id in example needs to be auth.user.id .
>
> @pbreit: if you have a table like that and want to show to user "1"
> all the records with owner_id = 1, decorate the controller with
> @auth.requires_login() to make sure a registered user is logged.
> In the controller now you can access to auth.user.* that is all the
> data associated with the logged in user.
> auth.user.id is the id of that user.
>
> e.g. rows = db(db.detail.owner_id==auth.user.id).select()
>
> On Feb 12, 11:53 am, villas  wrote:
>
>
>
>
>
>
>
> > You can't give permissions to users,  only to groups.  Therefore the
> > only way to give permissions to a unique user is through their unique
> > group. The book gives an example where this is used in the section
> > Authorization and CRUD.
>
> > You don't need to use the inidividual user groups. I have never needed
> > to use them. Just turn them off and do your own thing:
> > auth.settings.create_user_groups = False
>
> > On Feb 12, 2:56 am, pbreit  wrote:
>
> > > I get the concept of groups which is why I was confused that web2py auth
> > > creates a auth_group.role for each individual user (user_1, user_2 and so
> > > on).
>
> > > In all of my apps I have just one class of users. Sometimes, only the
> > > created_by can view an item. And usually, only the create_by can edit an
> > > item. And on pretty much every page I have personalizations based on the
> > > logged in user. Almost every web site I can think of works like this.


Re: [web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-13 Thread Ovidio Marinho
Here if I create a new db postgres does not create the tables,already in the
database sqlite, normally creates.

2011/2/4 Massimo Di Pierro 

> You are using web2py trunk right? Did you set a sequence_name
> manually?
>
> On Feb 4, 7:22 am, Tom Atkins  wrote:
> > I am getting the same error as reported by Carlos and cannot fix it.
> >
> > I have just set up a new server (Ubuntu 10.04 - postgres 8.4, Python
> 2.6.5)
> > and have web2py trunk up and running fine.  I have an unmodified
> 'welcome'
> > app which runs perfectly with sqlite.
> >
> > I then delete all the files in databases, cache and  sessions.  Next I
> > create a postgresql database and grant permissions to the appropriate
> user.
> >  I have double checked this and the user can create tables on the
> database.
> >
> > Next change the connection details in the welcome app db.py to:
> >
> > db = DAL('postgres://myuser:mypasswordlocalhost/mydb')
> >
> > Then visit the URL and I get the ticket below.
> >
> > Any help gratefully appreciated.  (I had this running fine on a previous
> > server)
> >
> > 
> >
> > Traceback (most recent call last):
> >   File "/home/www-data/web2py/gluon/restricted.py", line 188, in
> restricted
> > exec ccode in environment
> >   File "/home/www-data/web2py/applications/welcome/models/db.py", line
> 32,
> > in 
> > auth.define_tables()   # creates all needed
> > tables
> >   File "/home/www-data/web2py/gluon/tools.py", line 1177, in
> define_tables
> > format='%(first_name)s %(last_name)s (%(id)s)')
> >   File "/home/www-data/web2py/gluon/dal.py", line 3489, in define_table
> > polymodel=polymodel)
> >   File "/home/www-data/web2py/gluon/dal.py", line 531, in create_table
> > self.create_sequence_and_triggers(query,table)
> >   File "/home/www-data/web2py/gluon/dal.py", line 1512, in
> > create_sequence_and_triggers
> > self.execute('CREATE SEQUENCE %s;' % sequence_name)
> >   File "/home/www-data/web2py/gluon/dal.py", line 1078, in execute
> > return self.log_execute(*a, **b)
> >   File "/home/www-data/web2py/gluon/dal.py", line 1075, in log_execute
> > return self.cursor.execute(*a,**b)
> > ProgrammingError: relation "auth_user_id_seq" already exists
> >
> > ERROR SNAPSHOT
> > (relation "auth_user_id_seq" already
> > exists
> >
> > Frames
> >
> > File /home/www-data/web2py/gluon/restricted.py in restricted at line
> > 188 code arguments variables
> >
> > File /home/www-data/web2py/applications/welcome/models/db.py in 
> at
> > line 32 code arguments variables
> >
> > File /home/www-data/web2py/gluon/tools.py in define_tables at line
> > 1177 code arguments variables
> >
> > File /home/www-data/web2py/gluon/dal.py in define_table at line
> > 3489 code arguments variables
> >
> > File /home/www-data/web2py/gluon/dal.py in create_table at line
> > 531 code arguments variables
> >
> > File /home/www-data/web2py/gluon/dal.py in create_sequence_and_triggers
> at
> > line 1512 code arguments variables
> >
> > File /home/www-data/web2py/gluon/dal.py in execute at line
> > 1078 code arguments variables
> >
> > File /home/www-data/web2py/gluon/dal.py in log_execute at line
> > 1075 code arguments variables
> >
> > Function argument list
> >
> > (self=, *a=('CREATE SEQUENCE
> > auth_user_id_Seq;',), **b={})
> >
> > Code listing
> >
> > 1070.
> > 1071.
> > 1072.
> > 1073.
> > 1074.
> > 1075.
> > 1076.
> > 1077.
> > 1078.
> > 1079.
> >
> > def create_sequence_and_triggers(self, query, table, **args):
> > self.execute(query)
> >
> > def log_execute(self,*a,**b):
> > self.db._lastsql = a[0]
> > return self.cursor.execute(*a,**b)
> >
> > def execute(self,*a,**b):
> > return self.log_execute(*a, **b)
> >
> > Variables
> >
> > a('CREATE SEQUENCE auth_user_id_Seq;',)
> > self.cursor
> > self
> > b{}
> > self.cursor.execute > object>
>



-- 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 Tecnologia da Informaçao
 Casa Civil do Governador
 83 3214 7885 - 88269088
  Paraiba


Re: [web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-13 Thread Ovidio Marinho
I have the same problem, already found the solution?TRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

Traceback (most recent call last):
  File "c:\web2py\gluon\restricted.py", line 188, in restricted
exec ccode in environment
  File "c:/web2py/applications/demanda/models/db.py"
, line
39, in 
auth.define_tables() # creates all needed tables
  File "c:\web2py\gluon\tools.py", line 1177, in define_tables
format='%(first_name)s %(last_name)s (%(id)s)')
  File "c:\web2py\gluon\dal.py", line 3490, in define_table
polymodel=polymodel)
  File "c:\web2py\gluon\dal.py", line 531, in create_table
self.create_sequence_and_triggers(query,table)
  File "c:\web2py\gluon\dal.py", line 1513, in create_sequence_and_triggers
self.execute('CREATE SEQUENCE %s;' % sequence_name)
  File "c:\web2py\gluon\dal.py", line 1079, in execute
return self.log_execute(*a, **b)
  File "c:\web2py\gluon\dal.py", line 1076, in log_execute
return self.cursor.execute(*a,**b)
ProgrammingError: ERRO:  relação "auth_user_id_seq" já existe




2011/2/6 Massimo Di Pierro 

> The least comment in the issue thread says it is fixed after deleting
> the pyc. Is that not correct?
>
> On Feb 6, 7:26 am, Tom Atkins  wrote:
> > Thanks for looking into this Massimo.  I just pulled the most recent
> version
> > and still get the same error as originally described.  I added a comment
> > here:
> >
> > http://code.google.com/p/web2py/issues/detail?id=173&can=1&sort=-id
> >
> > Let
> me
> > know if you need any more info.  I definitely have the latest version.
> >
> > On 4 February 2011 19:49, Massimo Di Pierro  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > This is a trunk bug. The problem does should be there in stable. I
> > > will fix this tonight.
> >
> > > On Feb 4, 12:50 pm, Tom Atkins  wrote:
> > > > On 4 February 2011 14:33, Massimo Di Pierro <
> massimo.dipie...@gmail.com
> > > >wrote:
> >
> > > > > You are using web2py trunk right?
> >
> > > > Yes - just a clean version of web2py pulled by Hg from Google code.
> >
> > > > > Did you set a sequence_name
> > > > > manually?
> >
> > > > No (not even sure what sequence_name is!) -  I tried another app of
> my
> > > own
> > > > and get the same result.
>



-- 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 Tecnologia da Informaçao
 Casa Civil do Governador
 83 3214 7885 - 88269088
  Paraiba


[web2py] Problem with import of Site-Packages

2011-02-13 Thread Felipe AP
Hi. I'm using the tweepy library, for twitter auth. I import it after
adding its site-packages folder to the sys.path. Last week, I had to
install tweepy to my python2.6. Now it doesnt work anymore. It says
'ImportError: No module named tweepy'. What to I do??

Ps: I'm also getting an '_sqlite3' error import when I use
'python2.6 ./web2py.py' instead of './web2py.py'.


[web2py] Bugs - javascript includes oddities in the plugin_wiki

2011-02-13 Thread Bogdan Hlevca
Hi,

I just created a widget to display aggregated feeds on a page using
the plugin_wiki.
You can find the code at:
  http://web2pyslices.com/main/slices/take_slice/120

It can be noticed that I had to include (again) the jquery-ui JS lib
in order to ensure that the 'dialog` feature used to mimic a tool-tip
over the links follows the position of the mouse pointer.

Doing a search on the directory it came out that Elrte ( the embedded
editor ) is using jquery-ui, but it has its own version and probably
obsolete. I tried with jquery-ui 1.7.9 and the position feature for
the dialog does not work, newer versions like 1.8.4 position the
dialog properly. This points to the fact that elrte uses an older
jquery-ui library.

I believe that elrte is the problem because is quite old at 1.0rc4 and
the latest version is at 1.2. Probably plugin_wiki should be updated
to the latest version.
Irrespective of whether elrte will be upgraded or not, I think that
the plugin_wiki should be made independent of the elrte library and
have the included jquery-ui library in the themes directory to take
priority.

It is possible that not elrte is at fault, but in this case there is
another interference from somewhere else. In any case the include
works for now, but this is just a hack and I would prefer a cleaner
way.

Bogdan


[web2py] Re: Web2py in combination with mod_python

2011-02-13 Thread cjrh
On Feb 13, 12:17 am, Grezly  wrote:
> I'm trying now for a few days to get web2py working with mod_python
> (on a shared hosting). Because i have no other options of configuring
> apache or anything else.

The procedure using FastCGI works well.   Does your host provide any
access FastCGI?


[web2py] Re: Application logging

2011-02-13 Thread Michael McGinnis
I can't find documentation in the book for this, either by searching
for logging.conf, logger.app or web2py.app. Maybe I'm lazy or
ignorant. But I love the usability consulting part of my job: anytime
something isn't extremely easy for me to find on a website, I can
claim that it's not my fault, that the site should be made more usable
for lazy, ignorant people.

On Feb 13, 12:03 am, Jonathan Lundell  wrote:
> On Feb 12, 2011, at 9:44 PM, pbreit wrote:
>
> > What is current recommendation for app logging?
>
> You can start by copying logging.example.conf to logging.conf, and then 
> editing it to suit your requirements.
>
> Either log with web2py.app (logger_app) or create a new logger specific to 
> your own application.


[web2py] Re: form.accepts() with reference to other table

2011-02-13 Thread Oskari
Uncommenting that did the trick. Perhaps there was something wrong
with that =)

Anyways, thanks!

On Feb 13, 3:17 am, villas  wrote:
> Try commenting out the line 'custom_auth_table.accountID.requires...'
> If that doesn't give you any progress, post all your auth model. I'm
> sure someone should be able to spot something  obvious -- these bugs
> can be right under our noses sometimes :)
> -D
>
> On Feb 12, 11:03 pm, Oskari  wrote:
>
>
>
>
>
>
>
> > Thank you for your answer villas!
>
> > I don't think that is the problem. I am able to make inserts through
> > the appadmin-site, but somehow it fails with form.accepts().
> > I also tried what you suggested, but could not quite get it working.
>
> > On Feb 12, 8:45 pm, villas  wrote:
>
> > > Not sure, but the 3rd attrib of 'IS_IN_DB' doesn't look right?
>
> > > Maybe if you tried something like this, e.g.
> > > custom_auth_table.accountID.requires = IS_IN_DB(db,db.accounts.id,'%
> > > (name)s')
>
> > > On Feb 12, 1:28 pm, Oskari  wrote:
>
> > > > Hi!
>
> > > > I'm having trouble making an insert with form.accepts()
>
> > > > Currently I have a custom auth_user that has one extra field:
> > > > Field('accountID', db.accounts) with
> > > > custom_auth_table.accountID.requires = IS_IN_DB(db,db.accounts.id,id)
>
> > > > While trying to modify variables it fails with "not found in db"
>
> > > > def func():
> > > >     form=SQLFORM(db.auth_user)
> > > >     request.vars.accountID = 1
> > > >     if form.accepts(request.vars,session):
> > > >         response.flash = "Succesfully created user"
> > > >     return dict(form=form)
>
> > > > Why does not form.accepts() recognize and accept my accountID?


[web2py] Re: Authorization for Webhooks

2011-02-13 Thread AsmanCom
Does nobody know, how to query these two values by the given
session_id (session_id_myapp=127.0.0.1-2b77d424-4e72-4d3f-a0de-
badbcdbe6a30)?

1. is_logged_in (boolean)
2. username or user email (string)

I looked in the book, i´ve searched this group, i´ve searched the web,
but still can´t find any Solution...

So could anyone, who knows about the auth-process, please take a look
at it.

Thanks in advance.
Dieter Asman


[web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-02-13 Thread Carl


On Feb 12, 4:03 pm, Jonathan Lundell  wrote:
> On Feb 12, 2011, at 3:12 AM, Carl wrote:
>
> > I've avoided editing oauth10a_account.py by moving the directory
> > oauth2 to web2py (and keeping httplib2 inside oauth2.
>
> > Not happy that I've put this in Web2py's root but I've avoided editing
> > the framework source and don't need to worry about overwriting files
> > when I upgrade Web2py.
>
> > On Feb 11, 1:46 pm, Carl  wrote:
> >> I'm using OAuth/LinkedIn on GAE.
>
> >> To get oauth/LinkedIn to run on dev_appserver/GAE I had to copy
> >> directory oauth2 from web2py/site-packages to web2py/gluon/contrib and
> >> httplib2 from site-packages to web2py/gluon/contrib/oauth2
>
> >> Then in oauth10a_account.py change "import oauth2 as oauth" to "import
> >> gluon.contrib.oauth2 as oauth".
>
> >> Bingo.
>
> >> But.. is there a convention that will make web2py upgrades
> >> straightforward?
>
> Two questions:
>
> 1. What web2py version are you using?
>
> B. What happens when oauth2 is in site-packages?
>
> 3. Where is your import? (OK, three questions.)
>
> Recently (and I'll have to do some research to find out exactly when), we 
> made some changes in this area. It used to be that the handling of web2py's 
> additions to sys.path were somewhat erratic, and dependent on which handler 
> was in use. The changes were to make it consistent across handlers. In 
> particular (at least in the trunk), both the web2py root and site-packages 
> should be at the beginning of sys.path by the time you do your import.
>
> Could you please log sys.path at the time you do your import (or save a copy 
> and display it later)? Thanks.

1. I'm using Web2py 1.89.1. Have I been caught out by recent changes?
In any case, I'll update to the latest (so much recent activity!)

2. dev_appserver reports that there is an invalid character in 'site-
packages'. I took that to be the hyphen.

3. I have 2 imports.
gluon/contrib/login_methods/oauth10a_account.py line 15 import oauth2
as oauth
applications/init/modules/user.py (my own file) import oauth2 as oauth
So I need a solution that works from these two locations


[web2py] Re: auth.signature

2011-02-13 Thread Niphlod
+1 for the latter

On Feb 11, 11:01 pm, villas  wrote:
> Yes, it does seem strange to have 'modified_on','updated_by'. They
> should be the same.
> In the plugin_wiki it is modified_on, modified_by -- at least that's
> consistent.
>
> On Feb 11, 12:29 am, Vinicius Assef  wrote:
>
> > If you have 'created_on' and 'created_by', what about 'updated_on' and
> > 'updated_by'?
> > Vinicius Assef.
>
> > On Tue, Feb 8, 2011 at 6:39 PM, villas  wrote:
> > > For those intrigued and cannot update to trunk right now, it creates
> > > some extra fields...
>
> > > ['id', 'whatever', 'created_on', 'created_by', 'modified_on',
> > > 'updated_by']
>
> > > Nice shortcut, but I never guessed from the name 'auth.signature' what
> > > it would do.
> > > Maybe a different name would be clearer?  e.g. 'auth.rectimestamp'
>
>


[web2py] Re: What user is logged in (or, restricting access based on user)

2011-02-13 Thread Niphlod
I think that auth.user_id in example needs to be auth.user.id .

@pbreit: if you have a table like that and want to show to user "1"
all the records with owner_id = 1, decorate the controller with
@auth.requires_login() to make sure a registered user is logged.
In the controller now you can access to auth.user.* that is all the
data associated with the logged in user.
auth.user.id is the id of that user.

e.g. rows = db(db.detail.owner_id==auth.user.id).select()

On Feb 12, 11:53 am, villas  wrote:
> You can't give permissions to users,  only to groups.  Therefore the
> only way to give permissions to a unique user is through their unique
> group. The book gives an example where this is used in the section
> Authorization and CRUD.
>
> You don't need to use the inidividual user groups. I have never needed
> to use them. Just turn them off and do your own thing:
> auth.settings.create_user_groups = False
>
> On Feb 12, 2:56 am, pbreit  wrote:
>
> > I get the concept of groups which is why I was confused that web2py auth
> > creates a auth_group.role for each individual user (user_1, user_2 and so
> > on).
>
> > In all of my apps I have just one class of users. Sometimes, only the
> > created_by can view an item. And usually, only the create_by can edit an
> > item. And on pretty much every page I have personalizations based on the
> > logged in user. Almost every web site I can think of works like this.
>
>