Re: [web2py] Re: Access remote oracle database

2011-11-25 Thread Humberto Ferreira da Luz Junior
I can access the remote database through SQL Developer and also from my
local java applications.

My db.py:
db = DAL("oracle://user/passw...@server.ip:1521/dese")

Then when I try to access the database administration I get the following
error:
(Failure to connect, tried 5 times:
'NoneType' object has no attribute 'connect')

I'll try a simple python script using cx_oracle as you said.

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL


[web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread Gour
On Thu, 24 Nov 2011 20:40:33 +0100
~redShadow~  wrote:

> > Please, take a look at Concrete5.
> 
> I'll have a look at it for knowledge, although for what I understood,
> it isn't very distant from Drupal and what is my idea of CMS.

Just got 2011 Open Source CMS Market Share Report which says:

"Concrete5 had the best 12 month period of any CMS in this survey..."


Sincerely,
Gour

-- 
As a strong wind sweeps away a boat on the water, 
even one of the roaming senses on which the mind 
focuses can carry away a man's intelligence.

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


signature.asc
Description: PGP signature


[web2py] cancel upload, return value

2011-11-25 Thread thodoris
I have a form that has an upload field.
The file can be big and i would like to add a cancel button to cancel
the upload.

If i add a cancel button to the form that for example redirects to
'index' the cancel is stopped but what is the logic behind it. Is some
value returned and the form fails??

I am asking this cause i am uploading a file from an iphone app to the
database but when i cancel that request, there is an entry in the
databade which is a part of the file.

Any thoughts?


Re: [web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread ~redShadow~
On Fri, 2011-11-25 at 01:03 -0200, Bruno Rocha wrote:
> Right now I am developing a Social-CMS. 

That's cool, btw, I was talking with a friend that is doing some
experiments with distributed social networks and was implementing [don't
remember the name] protocol connectors for Python, so we agreed that it
would be cool to try building a DSN on top of the web2py-based CMS, once
stable enough (there's not that much difference between a CMS and a
social network.. it's quite just matter of additional configuration). 
-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread ~redShadow~
On Thu, 2011-11-24 at 18:08 -0800, Plumo wrote:
> an ambitious project!
> 
> 
> What is your motivation? 
> I ask because a number of CMS's have been started and then the sole
> developer moves on. Would be great if some of these efforts could be
> put towards a single killer app.

My goals are:
* To build a content-management layer on top of web2py, on which to
build pretty much every content-management-related stuff I need, by just
adding modules (as I did with drupal since 2006).
* To have such a thing written in a powerful language such as
**Python**, and not PHP
* To have something enterprise-ready, without needs of thousands of
modules extending missing important features from the core, thus
allowing modules to be plugged/unplugged at need, while keeping an eye
on these modules too, in order to avoid development effort
fragmentation, bad practices, etc.


-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread Gour
On Fri, 25 Nov 2011 14:29:50 +0100
~redShadow~  wrote:

> * To build a content-management layer on top of web2py, on which to
> build pretty much every content-management-related stuff I need, by
> just adding modules (as I did with drupal since 2006).

+1

> * To have such a thing written in a powerful language such as
> **Python**, and not PHP

+1

You're definitely much more experienced and knowledgeable than myself,
but one of the things, besides in-context editing, which I like in
Concrete5 is that it's dead-simple to convert HTML/CSS design into
native Concrete5 theme...probably (even) easier than creating Drupal
theme.

Disclaimer: I never really worked with it except installing it few times
in the past, but it was alwasy overkill for my web needs.


Sincerely,
Gour


-- 
The senses are so strong and impetuous, O Arjuna, 
that they forcibly carry away the mind even of a man 
of discrimination who is endeavoring to control them.

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


signature.asc
Description: PGP signature


Re: [web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread ~redShadow~
On Fri, 2011-11-25 at 16:13 +0100, Gour wrote: 
> You're definitely much more experienced and knowledgeable than myself,
> but one of the things, besides in-context editing, which I like in
> Concrete5 is that it's dead-simple to convert HTML/CSS design into
> native Concrete5 theme...probably (even) easier than creating Drupal
> theme.

I didn't work on that part yet, since I preferred to focus on more
"structural" things, and to wait until the CMS functionality is well
defined before writing the theming part.

What I think about that, after I wrote tons of Drupal themes, is that
most of times there's no need to rewrite all the views, but instead,
with a well-done base theme, most of the tweaks can be done by adding
some CSS or, at most, by overwriting views used to render just small
pieces of the page.

So, at the moment I'm using a well-nested set of views that may be
overwritten at different levels, avoiding to touch "the big ones", such
as layout.html, that may contain structural changes required for new
versions of the CMS, etc.

Then, I'll need to find a good way to overwrite views/css files with
other contained in ``themes//*``.

Another nice thing in Drupal, that I think we should implement in
web2cms too, is "re-colorable" themes: through the admin panel, you can
tweak the color palette, that automatically gets applied on theme CSS
and images by recalculating HSV differences, creating gradients in
images, etc.

Anyways, I'll have a look at Concrete5 themes, to see if I can figure
out a way to quickly import and reuse them inside web2cms.

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: My ideas/proposals for the CMS

2011-11-25 Thread newnomad

> My goals are:
> * To build a content-management layer on top of web2py, on which to
> build pretty much every content-management-related stuff I need, by just
> adding modules (as I did with drupal since 2006).
> * To have such a thing written in a powerful language such as
> **Python**, and not PHP
> * To have something enterprise-ready, without needs of thousands of
> modules extending missing important features from the core, thus
> allowing modules to be plugged/unplugged at need, while keeping an eye
> on these modules too, in order to avoid development effort
> fragmentation, bad practices, etc.
>
> --
> Samuele ~redShadow~ Santi
> 
>      redshadow[at]hackzine.org - redshadowhack[at]gmail.com
>
>   Blog:http://hackzine.org
>
>   GPG Key signature:
>        050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
> 
> /me recommends:
>     Squadra Informatica -http://www.squadrainformatica.com
> 
>  - Proud ThinkPad T-Series owner
>  - Registered Linux-User: #440008
>       * GENTOO User since 1199142000 (2008-01-01)
>       * former DEBIAN SID user
> 
>       "Software is like sex: it's better when it's free!"
>                               -- Linus Torvalds
>
>  signature.asc
> < 1KViewDownload

As an example of a very elegant and modular CMS system, you should
really explore symphony
http://symphony-cms.com/explore/
Just download and install, it has some modules installed, and play
around with it to really understand how things are working.


[web2py] Re:

2011-11-25 Thread Sefa Denizoğlu
?? Wasn't that you? :)

On 24 Kasım, 23:17, "massimo.dipie...@gmail.com"
 wrote:
> Who is user web2py on github?From my Android phone on T-Mobile. The first 
> nationwide 4G network.


[web2py] add key to response.headers for remote app?

2011-11-25 Thread thodoris
What do i have to do in order for a remote app to know that a post of
a form was successful?

I tried to add a key to response.headers but when i read the response
from my app i don't see my key there.
Is it correct what i am doing?

if form.accepts(request.vars,session):
response['headers']['success']=True

Thodoris


[web2py] Re: Access remote oracle database

2011-11-25 Thread Massimo Di Pierro
Looks like web2py cannot find cx_Oracle.

At startup, do you see Oracle listed as one of the available database
engines?


On Nov 25, 4:48 am, Humberto Ferreira da Luz Junior
 wrote:
> I can access the remote database through SQL Developer and also from my
> local java applications.
>
> My db.py:
> db = DAL("oracle://user/passw...@server.ip:1521/dese")
>
> Then when I try to access the database administration I get the following
> error:
> (Failure to connect, tried 5 times:
> 'NoneType' object has no attribute 'connect')
>
> I'll try a simple python script using cx_oracle as you said.
>
> Humberto Ferreira da Luz Junior
> Mestrado - Ciência da Computação / UEL
> Analista de Informática - ATI / UEL


[web2py] Re:

2011-11-25 Thread Massimo Di Pierro
No. But I found out.

On Nov 25, 10:16 am, Sefa Denizoğlu  wrote:
> ?? Wasn't that you? :)
>
> On 24 Kasım, 23:17, "massimo.dipie...@gmail.com"
>
>
>
>
>
>
>
>  wrote:
> > Who is user web2py on github?From my Android phone on T-Mobile. The first 
> > nationwide 4G network.


[web2py] Re:

2011-11-25 Thread Massimo Di Pierro
Clarification. I am user mdipierro and created/own project mdipierro/
web2py. I am not user web2py.

On Nov 25, 10:16 am, Sefa Denizoğlu  wrote:
> ?? Wasn't that you? :)
>
> On 24 Kasım, 23:17, "massimo.dipie...@gmail.com"
>
>
>
>
>
>
>
>  wrote:
> > Who is user web2py on github?From my Android phone on T-Mobile. The first 
> > nationwide 4G network.


Re: [web2py] Re: Access remote oracle database

2011-11-25 Thread Humberto Ferreira da Luz Junior
No, oracle is not listed at web2py startup.

I installed python 2.7 and cx_oracle 5.1.1-10g.win-amd64-py2.7.msi. Should
I use an older version?

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL



2011/11/25 Massimo Di Pierro 

> Looks like web2py cannot find cx_Oracle.
>
> At startup, do you see Oracle listed as one of the available database
> engines?
>
>
> On Nov 25, 4:48 am, Humberto Ferreira da Luz Junior
>  wrote:
> > I can access the remote database through SQL Developer and also from my
> > local java applications.
> >
> > My db.py:
> > db = DAL("oracle://user/passw...@server.ip:1521/dese")
> >
> > Then when I try to access the database administration I get the following
> > error:
> > (Failure to connect, tried 5 times:
> > 'NoneType' object has no attribute 'connect')
> >
> > I'll try a simple python script using cx_oracle as you said.
> >
> > Humberto Ferreira da Luz Junior
> > Mestrado - Ciência da Computação / UEL
> > Analista de Informática - ATI / UEL
>


[web2py] PicklingError: Can't pickle

2011-11-25 Thread Constantine Vasil


I am using GAE models directly:


if not request.env.web2py_runtime_gae: 
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite') 
auth = Auth(db, hmac_key=Auth.get_or_create_key()) 
crud, service, plugins = Crud(db), Service(), PluginManager()
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore')
auth = Auth(db, hmac_key=Auth.get_or_create_key()) 
crud, service, plugins = Crud(db), Service(), PluginManager()
 
from gluon.contrib.gae_memcache import MemcacheClient
from gluon.contrib.memdb import MEMDB


cache.memcache = MemcacheClient(request)

class MyRoot(google_db.Model):
   total_users = google_db.IntegerProperty(required=True, default=0)

   def get_profile(self):

   #key
  key = google_db.Key.from_path('MyRoot', 'root')
   #entity
  e = google_db.get(key)


   ##

   #put in cache

   ## 

   #key_cache = 'MyRoot' + 'root'

   #t = cache.memcache(key_cache,lambda:e,CACHE_TIMEOUT)

   ##

   #put in cache

   ## 


   e = MyRoot.get_profile()

   if e:

 e.total_users = 2

 e.put()


This code is working and I can see the data object on the Google AppEngine GAE 
server in DataView.


I have the following issues:


1) When I want to store the entity in a cache,

e.g. when I un-comment the following:


 ##

 #put in cache

 ## 

 key_cache = 'MyRoot' + 'root'

 *t = cache.memcache(key_cache,lambda:e,CACHE_TIMEOUT)*

 ##

 #put in cache

 ## 


PicklingError: Can't pickle : it's not found as 
__builtin__.MyRoot


2) This code is working only when uploaded to the AppEngine GAE server. How to 

make it work locally in order to test it locally first?


Thank in advance,


Regards,

--Constantine







[web2py] Facebook using oAuth2 and Scopes...

2011-11-25 Thread Tito Garrido
Hi Folks,

I've been using facebook auth described on the book:
http://web2py.com/book/default/chapter/08?search=facebook#Other-Login-Methods-and-Login-Forms

Is there a way to increase the scope of the authentication? I'd like to
have email and publish streams...

I was wondering if using "fbconsole" on auth.settings.login_next would
solve the problem... but fbconsole opens a new window using
fbconsole.authenticate()

Anybody knows a better approach?

Regards,

Tito

-- 

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


[web2py] Re: issue with form.process in default/user

2011-11-25 Thread Dave
oops, my email reply didn't go to the list either:

I noticed that  settings.register_onvalidation is a list.  Can a
person have more than one "onvalidation" in a form.process?

On Nov 25, 2:31 am, Massimo Di Pierro 
wrote:
> My answer did not get posted. Trying again...
>
> auth.settings.register_onvalidation = do_my_postvalidation_stuff
> auth.messages.registration_successful =  'Thank you for registering'
> form = auth.register()  #does its own call to form.process()
>
> OR
>
> form = SQLFORM(db.auth_user)
> if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
>    session.flash = 'Thank you for registering'
>
> On Nov 25, 12:22 am, Dave  wrote:
>
>
>
>
>
>
>
> > I'm a bit stumped on this one...
>
> > I need to do some 'stuff' after either a user registeres or updates
> > their profile.  Basically there's a half dozen boolean fields which
> > correspond to mailing lists the user may "opt-in" to.  I tried
> > customizing the default/user controller like so:
>
> > form = auth.register()
>
> > if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
> >    session.flash = 'Thank you for registering'
>
> > It seems that the form.process OR form.accepts(request,session) does
> > not work if I let the form be generated by using form = auth() or form
> > = auth.register().
>
> > Short of writing my own whole registration and profile management
> > controllers, is there an easy work around here?  When I submit the
> > form nothing happens.  I've even tried putting a debug `print 'got
> > here'` type message inside the validation method and if construct
> > above.


[web2py] Re: issue with form.process in default/user

2011-11-25 Thread Dave
Nevermind...  I was misreading the code.  It's just a bound method.

On Nov 25, 1:55 pm, Dave  wrote:
> oops, my email reply didn't go to the list either:
>
> I noticed that  settings.register_onvalidation is a list.  Can a
> person have more than one "onvalidation" in a form.process?
>
> On Nov 25, 2:31 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > My answer did not get posted. Trying again...
>
> > auth.settings.register_onvalidation = do_my_postvalidation_stuff
> > auth.messages.registration_successful =  'Thank you for registering'
> > form = auth.register()  #does its own call to form.process()
>
> > OR
>
> > form = SQLFORM(db.auth_user)
> > if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
> >    session.flash = 'Thank you for registering'
>
> > On Nov 25, 12:22 am, Dave  wrote:
>
> > > I'm a bit stumped on this one...
>
> > > I need to do some 'stuff' after either a user registeres or updates
> > > their profile.  Basically there's a half dozen boolean fields which
> > > correspond to mailing lists the user may "opt-in" to.  I tried
> > > customizing the default/user controller like so:
>
> > > form = auth.register()
>
> > > if form.process(onvalidation=do_my_postvalidation_stuff).accepted:
> > >    session.flash = 'Thank you for registering'
>
> > > It seems that the form.process OR form.accepts(request,session) does
> > > not work if I let the form be generated by using form = auth() or form
> > > = auth.register().
>
> > > Short of writing my own whole registration and profile management
> > > controllers, is there an easy work around here?  When I submit the
> > > form nothing happens.  I've even tried putting a debug `print 'got
> > > here'` type message inside the validation method and if construct
> > > above.


Re: [web2py] Re: Access remote oracle database

2011-11-25 Thread Humberto Ferreira da Luz Junior
I tried python 2.6.6 with cx_oracle 5.1 and I got the same results. The
oracle driver is not listed in the web2py console at startup (running from
the source).

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL


[web2py] Error using LOAD in custom module

2011-11-25 Thread monotasker
I'm adapting the select_or_add widget from web2py slices so that it can be 
packaged as a plugin. In that process I'm moving the business logic from a 
model file into a custom module. But this line is throwing an error that I 
can't fix:

form_loader_div = DIV(LOAD(c = self.controller, f = self.function, args = 
add_args, ajax = True), _id = my_select_id + "_dialog-form", _title = 
self.form_title)

The error reads: 'NoneType object is not callable'.

I've tested each of the variables, and all of them have appropriate string 
content. The DIV helper is also working fine. So I think the problem is the 
LOAD helper. I've imported it like this:

from gluon.rewrite import load
LOAD = load()

But the error persists. Am I importing LOAD improperly? Any other ideas?


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread Bruno Rocha
You can do

from gluon import LOAD

or

in model
from gluon import current
current.LOAD = LOAD

in module

from gluon import current
LOAD = current.LOAD

On Fri, Nov 25, 2011 at 5:15 PM, monotasker  wrote:

> I'm adapting the select_or_add widget from web2py slices so that it can be
> packaged as a plugin. In that process I'm moving the business logic from a
> model file into a custom module. But this line is throwing an error that I
> can't fix:
>
> form_loader_div = DIV(LOAD(c = self.controller, f = self.function, args =
> add_args, ajax = True), _id = my_select_id + "_dialog-form", _title =
> self.form_title)
>
> The error reads: 'NoneType object is not callable'.
>
> I've tested each of the variables, and all of them have appropriate string
> content. The DIV helper is also working fine. So I think the problem is the
> LOAD helper. I've imported it like this:
>
> from gluon.rewrite import load
> LOAD = load()
>
> But the error persists. Am I importing LOAD improperly? Any other ideas?
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: Facebook using oAuth2 and Scopes...

2011-11-25 Thread Tito Garrido
I've tried to do:
def __init__(self, g):
OAuthAccount.__init__(self, g,
  YOUR_CLIENT_ID,
  YOUR_CLIENT_SECRET,
  self.AUTH_URL,
  self.TOKEN_URL,
  args=dict(scope='email'))

But it didn't work either :-/

On Fri, Nov 25, 2011 at 4:50 PM, Tito Garrido  wrote:

> Hi Folks,
>
> I've been using facebook auth described on the book:
> http://web2py.com/book/default/chapter/08?search=facebook#Other-Login-Methods-and-Login-Forms
>
> Is there a way to increase the scope of the authentication? I'd like to
> have email and publish streams...
>
> I was wondering if using "fbconsole" on auth.settings.login_next would
> solve the problem... but fbconsole opens a new window using
> fbconsole.authenticate()
>
> Anybody knows a better approach?
>
> Regards,
>
> Tito
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>



-- 

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


[web2py] Re: Facebook using oAuth2 and Scopes...

2011-11-25 Thread Tito Garrido
Looks like self.args=dict(scope='publish_stream,email,user_hometown')
works! :)

On Fri, Nov 25, 2011 at 5:54 PM, Tito Garrido  wrote:

> I've tried to do:
> def __init__(self, g):
> OAuthAccount.__init__(self, g,
>   YOUR_CLIENT_ID,
>   YOUR_CLIENT_SECRET,
>   self.AUTH_URL,
>   self.TOKEN_URL,
>   args=dict(scope='email'))
>
> But it didn't work either :-/
>
>
> On Fri, Nov 25, 2011 at 4:50 PM, Tito Garrido wrote:
>
>> Hi Folks,
>>
>> I've been using facebook auth described on the book:
>> http://web2py.com/book/default/chapter/08?search=facebook#Other-Login-Methods-and-Login-Forms
>>
>> Is there a way to increase the scope of the authentication? I'd like to
>> have email and publish streams...
>>
>> I was wondering if using "fbconsole" on auth.settings.login_next would
>> solve the problem... but fbconsole opens a new window using
>> fbconsole.authenticate()
>>
>> Anybody knows a better approach?
>>
>> Regards,
>>
>> Tito
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>
>
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>



-- 

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


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread monotasker
Hmmm ... Those don't seem to be working.

from gluon import LOAD

This doesn't seem to import anything. PyDev tells me that there's an 
"unresolved import" Still get the 'NoneType not callable' error.

from gluon import current
LOAD = current.LOAD

I get AttributeError: 'thread._local' object has no attribute 'LOAD'

[web2py] Show only my contacts

2011-11-25 Thread Renato Ramiro
I have two tables: users and contacts.

And i'd like to show only the contacts of that user that it's logged.

It's the same with the 'edit profile'. Only I have access to change my
informations.

How can I implement this?

Thanks!


[web2py] Re: add key to response.headers for remote app?

2011-11-25 Thread Anthony
You can use response.headers instead of response['headers']. Maybe try 
setting the value to a string:

response.headers['success'] = 'True'

Anthony

On Friday, November 25, 2011 11:32:58 AM UTC-5, thodoris wrote:
>
> What do i have to do in order for a remote app to know that a post of
> a form was successful?
>
> I tried to add a key to response.headers but when i read the response
> from my app i don't see my key there.
> Is it correct what i am doing?
>
> if form.accepts(request.vars,session):
> response['headers']['success']=True
>
> Thodoris
>
>

[web2py] Differentiating GET from POST

2011-11-25 Thread chandrakant kumar
I'm going through chapter 3 of the book. In an example of 'images' app, in
the show function, how is the POST and GET methods differentiated?


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread Martín Mulone
try something like this


from gluon.compileapp import LoadFactory
def renderimages(self, page=1, postid=0):
""" Render Images """

curvars = {}
curvars['page']=page
curvars['postid']=postid

environment = {}
environment['request'] = current.request
environment['response'] = current.response
LOAD = LoadFactory(environment)

return LOAD(self.controller_name, 'imageslist.html',
vars=curvars, ajax=True)


2011/11/25 monotasker 

> Hmmm ... Those don't seem to be working.
>
> from gluon import LOAD
>
> This doesn't seem to import anything. PyDev tells me that there's an
> "unresolved import" Still get the 'NoneType not callable' error.
>
>
> from gluon import current
> LOAD = current.LOAD
>
> I get AttributeError: 'thread._local' object has no attribute 'LOAD'




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


[web2py] Re: Access remote oracle database

2011-11-25 Thread Massimo Di Pierro
start python (not web2py) and try

import cx_Oracle

does it work? If no the problem is with the installation of cx_Oracle.
If it works, than make sure you use the same python interpreter with
web2py.

On Nov 25, 1:11 pm, Humberto Ferreira da Luz Junior
 wrote:
> I tried python 2.6.6 with cx_oracle 5.1 and I got the same results. The
> oracle driver is not listed in the web2py console at startup (running from
> the source).
>
> Humberto Ferreira da Luz Junior
> Mestrado - Ciência da Computação / UEL
> Analista de Informática - ATI / UEL


[web2py] Re: Differentiating GET from POST

2011-11-25 Thread Massimo Di Pierro
you can check

request.env.request_method

and

request.get_vars

vs

request.post_vars

On Nov 25, 3:26 pm, chandrakant kumar  wrote:
> I'm going through chapter 3 of the book. In an example of 'images' app, in
> the show function, how is the POST and GET methods differentiated?


[web2py] Python port of MailChimp

2011-11-25 Thread Dave
One of my clients uses MailChimp for their email marketing.  I'm
working on rewriting their online ecommerce site in web2py.  I figured
I'd share this with the community.  "pychimp" is a direct port of the
official PHP-based MailChimp API.  Method names and expected
arguments / return values are identical to reduce learning curve.

http://code.google.com/p/pychimp/

Other python implementations can be found on the mc API page:
http://apidocs.mailchimp.com/api/downloads/#python

If anybody is interested in the web2py module or controller code for
this I can post or privately email it.  For the most part, when the
user registers they may choose to opt in to one of about a half dozen
mailing lists.  Upon registration an updated JSON message needs to be
sent to MailChimp.  Furthermore, at any time the user may unsubscribe
or change their subscriptions.

Note, implementing this requires either changing the form.onvalidate
in the user method of the default controller or implementing your own
registration / profile.  I elected to do the latter.


[web2py] Re: Show only my contacts

2011-11-25 Thread Anthony
The id of the current logged in user is available in auth.user_id (which is 
None if the user isn't logged in).

Does the contacts table have a reference to the auth_user table, like:

db.define_table('contacts', Field('user', db.auth_user), ...)

If so, the query would be something like:

db((db.auth_user.id == auth.user_id) & (db.auth_user.id == 
db.contacts.user)).select()

See http://web2py.com/book/default/chapter/06#One-to-Many-Relation 
and http://web2py.com/book/default/chapter/08#Authentication.

Anthony


On Friday, November 25, 2011 2:32:09 PM UTC-5, Renato Ramiro wrote:
>
> I have two tables: users and contacts.
>
> And i'd like to show only the contacts of that user that it's logged.
>
> It's the same with the 'edit profile'. Only I have access to change my
> informations.
>
> How can I implement this?
>
> Thanks!
>
>

Re: [web2py] Re: Differentiating GET from POST

2011-11-25 Thread chandrakant kumar
I've only been to chapter 3 till now and i'm starting to like it. Best
thing i like is the DAL, and the way it is implemented,  so sql like
syntax, yet database independent. And, the templates so simple. Thank you
for such a nice project.


[web2py] Re: Python port of MailChimp

2011-11-25 Thread Massimo Di Pierro
I am interested.

On Nov 25, 4:25 pm, Dave  wrote:
> One of my clients uses MailChimp for their email marketing.  I'm
> working on rewriting their online ecommerce site in web2py.  I figured
> I'd share this with the community.  "pychimp" is a direct port of the
> official PHP-based MailChimp API.  Method names and expected
> arguments / return values are identical to reduce learning curve.
>
> http://code.google.com/p/pychimp/
>
> Other python implementations can be found on the mc API 
> page:http://apidocs.mailchimp.com/api/downloads/#python
>
> If anybody is interested in the web2py module or controller code for
> this I can post or privately email it.  For the most part, when the
> user registers they may choose to opt in to one of about a half dozen
> mailing lists.  Upon registration an updated JSON message needs to be
> sent to MailChimp.  Furthermore, at any time the user may unsubscribe
> or change their subscriptions.
>
> Note, implementing this requires either changing the form.onvalidate
> in the user method of the default controller or implementing your own
> registration / profile.  I elected to do the latter.


[web2py] Re: Google Authentication on GAE

2011-11-25 Thread howesc
if you want to use google authentication with web2py auth:

from gluon.contrib.login_methods.gae_google_account import 
GaeGoogleAccount
auth.settings.login_form=GaeGoogleAccount()
form = auth.login(next=URL(r=request, c='default', f='index'))
return dict(login_form=form)

i *think* that is all you need to make the magic happen.  it's been a while 
since i have implemented it and may have forgotten a detail or two.


[web2py] Re: GAE Caching and Views

2011-11-25 Thread howesc
hmmm, i've never known GAE to cache selects.  at one point i thought the 
book said as much, now it simply says:

"The results of a select are complex, un-pickleable objects; they cannot be 
stored in a session and cannot be cached in any other way than the one 
explained here."

and i believe that un-pickleable means not memcacheable.

reading dal.py, select() in the GAEAdaptor does not seem to do anything 
with cache.  (maybe i'm mis-reading it)


Re: [web2py] Re: orderby='' on Google App Engine

2011-11-25 Thread howesc
looks like the exception there is because your query has an OR condition in 
it, which is not supported on GAE.  that sort should be in-memory and 
should work fine.


Re: [web2py] Re: orderby='' on Google App Engine

2011-11-25 Thread Bruno Rocha
On Fri, Nov 25, 2011 at 11:46 PM, howesc  wrote:

> looks like the exception there is because your query has an OR condition
> in it, which is not supported on GAE.  that sort should be in-memory and
> should work fine.
>

I found, the error was because of the use of contains() in query


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Re: GAE Caching and Views

2011-11-25 Thread Bruno Rocha
On Tue, Nov 22, 2011 at 8:34 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> . I have never tried it on GAE


I have a select cache on my app, works locally, but fails on GAE. It does
not raise any exception but does not cache anything, and I only realized it
does not works when I see my "clean cache" function raising an error.

My code is:
https://github.com/rochacbruno/Movuca/blob/master/modules/config.py#L41

I have not tried other cache methods for GAE.


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Error using LOAD in custom module

2011-11-25 Thread monotasker
That did it! Thanks Martin. I would never have figured that out on my own. 
Is it documented anywhere in the book?


Re: [web2py] Re: ImportError with AppEngine SDK v1.6.0

2011-11-25 Thread howesc
it seems that global variables are being preserved across requests, but the 
override of __builtins__.__import__ is not.  see proposed patch here:

http://code.google.com/p/web2py/issues/detail?id=537


[web2py] Re: Error using LOAD in custom module

2011-11-25 Thread Massimo Di Pierro
I like Martin's solution. Or shorter:

from gluon.compileapp import LoadFactory
LOAD =
LoadFactory({'request':current.request,'response':current.response})

After this you can do:

form_loader_div = DIV(LOAD(c = self.controller, f = self.function,
args =
add_args, ajax = True), _id = my_select_id + "_dialog-form", _title =
self.form_title)

LOAD should be in gluon as the other helpers. Please open a ticket on
google code. It should be possible to do it.

On Nov 25, 3:29 pm, Martín Mulone  wrote:
> try something like this
>
> from gluon.compileapp import LoadFactory
> def renderimages(self, page=1, postid=0):
>         """ Render Images """
>
>         curvars = {}
>         curvars['page']=page
>         curvars['postid']=postid
>
>         environment = {}
>         environment['request'] = current.request
>         environment['response'] = current.response
>         LOAD = LoadFactory(environment)
>
>         return LOAD(self.controller_name, 'imageslist.html',
> vars=curvars, ajax=True)
>
> 2011/11/25 monotasker 
>
> > Hmmm ... Those don't seem to be working.
>
> > from gluon import LOAD
>
> > This doesn't seem to import anything. PyDev tells me that there's an
> > "unresolved import" Still get the 'NoneType not callable' error.
>
> > from gluon import current
> > LOAD = current.LOAD
>
> > I get AttributeError: 'thread._local' object has no attribute 'LOAD'
>
> --
>  http://martin.tecnodoc.com.ar


[web2py] Re: Error using LOAD in custom module

2011-11-25 Thread Anthony
Just submitted an 
issue: http://code.google.com/p/web2py/issues/detail?id=538

Anthony

On Friday, November 25, 2011 11:47:07 PM UTC-5, Massimo Di Pierro wrote:
>
> I like Martin's solution. Or shorter:
>
> from gluon.compileapp import LoadFactory
> LOAD =
> LoadFactory({'request':current.request,'response':current.response})
>
> After this you can do:
>
> form_loader_div = DIV(LOAD(c = self.controller, f = self.function,
> args =
> add_args, ajax = True), _id = my_select_id + "_dialog-form", _title =
> self.form_title)
>
> LOAD should be in gluon as the other helpers. Please open a ticket on
> google code. It should be possible to do it.
>
> On Nov 25, 3:29 pm, Martín Mulone  wrote:
> > try something like this
> >
> > from gluon.compileapp import LoadFactory
> > def renderimages(self, page=1, postid=0):
> > """ Render Images """
> >
> > curvars = {}
> > curvars['page']=page
> > curvars['postid']=postid
> >
> > environment = {}
> > environment['request'] = current.request
> > environment['response'] = current.response
> > LOAD = LoadFactory(environment)
> >
> > return LOAD(self.controller_name, 'imageslist.html',
> > vars=curvars, ajax=True)
> >
> > 2011/11/25 monotasker 
> >
> > > Hmmm ... Those don't seem to be working.
> >
> > > from gluon import LOAD
> >
> > > This doesn't seem to import anything. PyDev tells me that there's an
> > > "unresolved import" Still get the 'NoneType not callable' error.
> >
> > > from gluon import current
> > > LOAD = current.LOAD
> >
> > > I get AttributeError: 'thread._local' object has no attribute 'LOAD'
> >
> > --
> >  http://martin.tecnodoc.com.ar
>
>

[web2py] Re: Error using LOAD in custom module

2011-11-25 Thread Massimo Di Pierro
I have a possible solution in trunk. Please check it. I do not like
the implementation but it not worse than then current implementation
of LOAD.

In order to make it work I had to store the global execution
environment in current.globalenv
I think there is room for a lot of cleanup since, once globalenv is in
current, we do not need to pass it around too much.

Massimo


On Nov 25, 10:51 pm, Anthony  wrote:
> Just submitted an
> issue:http://code.google.com/p/web2py/issues/detail?id=538
>
> Anthony
>
>
>
>
>
>
>
> On Friday, November 25, 2011 11:47:07 PM UTC-5, Massimo Di Pierro wrote:
>
> > I like Martin's solution. Or shorter:
>
> > from gluon.compileapp import LoadFactory
> > LOAD =
> > LoadFactory({'request':current.request,'response':current.response})
>
> > After this you can do:
>
> > form_loader_div = DIV(LOAD(c = self.controller, f = self.function,
> > args =
> > add_args, ajax = True), _id = my_select_id + "_dialog-form", _title =
> > self.form_title)
>
> > LOAD should be in gluon as the other helpers. Please open a ticket on
> > google code. It should be possible to do it.
>
> > On Nov 25, 3:29 pm, Martín Mulone  wrote:
> > > try something like this
>
> > > from gluon.compileapp import LoadFactory
> > > def renderimages(self, page=1, postid=0):
> > >         """ Render Images """
>
> > >         curvars = {}
> > >         curvars['page']=page
> > >         curvars['postid']=postid
>
> > >         environment = {}
> > >         environment['request'] = current.request
> > >         environment['response'] = current.response
> > >         LOAD = LoadFactory(environment)
>
> > >         return LOAD(self.controller_name, 'imageslist.html',
> > > vars=curvars, ajax=True)
>
> > > 2011/11/25 monotasker 
>
> > > > Hmmm ... Those don't seem to be working.
>
> > > > from gluon import LOAD
>
> > > > This doesn't seem to import anything. PyDev tells me that there's an
> > > > "unresolved import" Still get the 'NoneType not callable' error.
>
> > > > from gluon import current
> > > > LOAD = current.LOAD
>
> > > > I get AttributeError: 'thread._local' object has no attribute 'LOAD'
>
> > > --
> > >  http://martin.tecnodoc.com.ar


[web2py] Re: ImportError with AppEngine SDK v1.6.0

2011-11-25 Thread Massimo Di Pierro
approved but it would be nice to understad better why this happens.

On Nov 25, 9:37 pm, howesc  wrote:
> it seems that global variables are being preserved across requests, but the
> override of __builtins__.__import__ is not.  see proposed patch here:
>
> http://code.google.com/p/web2py/issues/detail?id=537