[web2py] How to make an AJAX crawlable app

2012-04-27 Thread Alexander Cabezas
Hi,

How can I make a AJAX crawlable app with web2py?
https://developers.google.com/webmasters/ajax-crawling/?hl=es-ES

[web2py] Re: Howto change request.uri_language through URL function?

2011-08-31 Thread Alexander Cabezas
Christopher

Did you make this website? http://www.amnesty.org/fr/how-you-can-help

Did you build it with web2py?

How could I do the same thing in my application?

On 29 ago, 23:40, Christopher Steel chris.st...@gmail.com wrote:
 So something like this:

    http://www.amnesty.org/fr/how-you-can-help

 and not this:

    http://voiceofaccess.org/init/default/index?_language=fr-ca

 ?


[web2py] Re: Howto change request.uri_language through URL function?

2011-08-30 Thread Alexander Cabezas
Something like this:

http://www.amnesty.org/fr/how-you-can-help

On 29 ago, 23:40, Christopher Steel chris.st...@gmail.com wrote:
 So something like this:

    http://www.amnesty.org/fr/how-you-can-help

 and not this:

    http://voiceofaccess.org/init/default/index?_language=fr-ca

 ?


[web2py] Howto change request.uri_language through URL function?

2011-08-29 Thread Alexander Cabezas
I want to change the application language through URL function, but
this doesn't expect the lang parameter.

I did some tests with these adresses http://127.0.0.1:8000/es-es/default/index
and http://127.0.0.1:8000/fr-fr/default/index and it changed the
application language due to gluon.rewrite.

But I want to do this with URL function in order to put in the website
a Language Selector (SELECT and A tag).

Massimo or somebody else, any clue?


[web2py] auth.login onaccept web2py-component-command don't work

2011-08-02 Thread Alexander Cabezas
Hello,

I don't get the correct behavior when update response.headers with
onaccept parameter on auth.login function. Here I'm trying to redirect
with Javascript after user logins but it redirect to default/
index.load, below:


# default.py
def login():
nc = request.vars.nc or 'default'
nf = request.vars.nf or 'index'
next = URL(r=request, c=nc, f=nf)
return dict(form=auth.login(onaccept=lambda form:
response.headers.update({'web2py-component-
command':document.location='%s'%next})))


# index.html
{{extend 'layout.html'}}
{{=LOAD(default,login.load,vars={'nc':'editor','nf':'list.html'},ajax=True,ajax_trap=True)}}


# login.load
{{=form.custom.begin}}
Usuario: {{=form.custom.widget.username}}
Clave: {{=form.custom.widget.password}}
{{=form.custom.submit}}
{{=form.custom.end}}


If anyone see something, please tell me.


[web2py] LOAD with indicator in a helper method

2011-08-01 Thread Alexander Cabezas
Hello,

I've been trying to do a helper method but I get an error, below:

#helpers.py
def load(c=None, f='index', args=[], vars={},
 extension=None, target=None,ajax=False,ajax_trap=False,
 url=None, user_signature=False, content='loading...',
**attr):

target = target or 'c'+str(random.random())[2:]
content = DIV(T(loading...),IMG(_src=images/ajax-
loader.gif),_id=target)
a = request.application
r = request
url = URL(a,c,f,r,args=args,vars=vars,extension=extension)
return
LOAD(target,ajax,ajax_trap,user_signature,content,url=url,**attr)

#index.html
{{extend 'layouts.html'}}
{{=helpers.load(c='default',f='login.load',ajax=True,ajax_trap=True)}}

#error:
TypeError: load() got an unexpected keyword argument 'c'

When I try a different call without 'c' and 'f' keys, like:

#index.html
{{=helpers.load('default','login.load',ajax=True,ajax_trap=True)}}

#error:
TypeError: sequence item 1: expected string, instance found

Any clue?


[web2py] Re: LOAD with indicator in a helper method

2011-08-01 Thread Alexander Cabezas
I solved the problem. I'd been making some mistakes.

Solution:

#helpers.py
def load(self, c=None, f='index', args=[], vars={}, extension=None,
target=None, ajax=False, ajax_trap=False,url=None,
user_signature=False, content=None, **attr):

target = target or 'c'+str(random.random())[2:]
content = content or TAG['']
(T(loading...),IMG(_src=URL(request.application,'static','images/
ajax-loader.gif')))
a = request.application
r = request
url = URL(a,c,f,r,args=args,vars=vars,extension=extension)
return
LOAD(url=url,target=target,ajax=ajax,ajax_trap=ajax_trap,user_signature=user_signature,content=content,**attr)

#index.html
{{=helpers.load(default,login.load,ajax=True,ajax_trap=True)}}

If anyone see other bugs tell me please. Thanks.

On 1 ago, 16:23, Alexander Cabezas alexcabez...@gmail.com wrote:
 Hello,

 I've been trying to do a helper method but I get an error, below:

 #helpers.py
     def load(c=None, f='index', args=[], vars={},
              extension=None, target=None,ajax=False,ajax_trap=False,
              url=None, user_signature=False, content='loading...',
 **attr):

         target = target or 'c'+str(random.random())[2:]
         content = DIV(T(loading...),IMG(_src=images/ajax-
 loader.gif),_id=target)
         a = request.application
         r = request
         url = URL(a,c,f,r,args=args,vars=vars,extension=extension)
         return
 LOAD(target,ajax,ajax_trap,user_signature,content,url=url,**attr)

 #index.html
 {{extend 'layouts.html'}}
 {{=helpers.load(c='default',f='login.load',ajax=True,ajax_trap=True)}}

 #error:
 TypeError: load() got an unexpected keyword argument 'c'

 When I try a different call without 'c' and 'f' keys, like:

 #index.html
 {{=helpers.load('default','login.load',ajax=True,ajax_trap=True)}}

 #error:
 TypeError: sequence item 1: expected string, instance found

 Any clue?


[web2py] Table with custom methods

2011-04-18 Thread Alexander Cabezas
I want to create a custom method in a model to query in a polymorphic
association like below:
#table definitions:
db.define_table('contents')
db.define_table('attachments')
db.define_table('attached_to', Field('attachment', db.attachments),
Field('rel_id', 'integer'), Field('created_on', 'datetime'),
Field('rel_type', 'string'))

#a method in contents like:
def attachments():
self.attached_to.rel_id==self.contents.id) 
(self.attached_to.rel_type==contents)

#usage:
db.contents(1).attachments

I've developed in other frameworks and I simply add a method in the
model to accomplish this task. Here I tried with VirtualFields but it
did'nt work and the book says They can be used to simplify the user's
code without using additional storage but they cannot be used for
searching. What are the ways to do the same in this framework?


[web2py:35686] Re: Problem to connect mysql with web2py

2009-11-20 Thread Alexander Cabezas

The python version already installed on my Mac is 2.6.2.

How can I know what version of python the web2py is taking?

On 20 nov, 00:24, Thadeus Burgess thade...@thadeusb.com wrote:
 Are you sure it installed to the right version of python?

 Macs already come with python 2.3(or 2.4) installed, in a way that makes it
 difficult for python applications to make use of it.

 -Thadeus

 On Thu, Nov 19, 2009 at 6:17 PM, Alexander Cabezas 
 i...@mantecao.com.vewrote:



  I have installed the mysql-python on a Leopard 10.5 and when i have
  tryed to run my application, after mody the db.py

  db = DAL('mysql://r...@localhost/database')

  web2py generated a ticket with the following error:

  Traceback (most recent call last):
   File gluon/restricted.py, line 184, in restricted
   File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
  applications/core/models/db.py, line 15, in module
   File gluon/sql.py, line 3580, in DAL
   File gluon/sql.py, line 870, in __init__
   File gluon/sql.py, line 781, in _pool_connection
   File gluon/sql.py, line 870, in lambda
  NameError: global name 'MySQLdb' is not defined

  thank you very much for helping me

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35697] Re: Problem to connect mysql with web2py

2009-11-20 Thread Alexander Cabezas

Very thanks, It works.

Now let me create the models.

On 20 nov, 09:40, mdipierro mdipie...@cs.depaul.edu wrote:
 run web2py with

 python2.6 web2py.py

 On Nov 20, 7:20 am, Alexander Cabezas i...@mantecao.com.ve wrote:

  The python version already installed on my Mac is 2.6.2.

  How can I know what version of python the web2py is taking?

  On 20 nov, 00:24, Thadeus Burgess thade...@thadeusb.com wrote:

   Are you sure it installed to the right version of python?

   Macs already come with python 2.3(or 2.4) installed, in a way that makes 
   it
   difficult for python applications to make use of it.

   -Thadeus

   On Thu, Nov 19, 2009 at 6:17 PM, Alexander Cabezas 
   i...@mantecao.com.vewrote:

I have installed the mysql-python on a Leopard 10.5 and when i have
tryed to run my application, after mody the db.py

db = DAL('mysql://r...@localhost/database')

web2py generated a ticket with the following error:

Traceback (most recent call last):
 File gluon/restricted.py, line 184, in restricted
 File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
applications/core/models/db.py, line 15, in module
 File gluon/sql.py, line 3580, in DAL
 File gluon/sql.py, line 870, in __init__
 File gluon/sql.py, line 781, in _pool_connection
 File gluon/sql.py, line 870, in lambda
NameError: global name 'MySQLdb' is not defined

thank you very much for helping me
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35668] Problem to connect mysql with web2py

2009-11-19 Thread Alexander Cabezas

I have installed the mysql-python on a Leopard 10.5 and when i have
tryed to run my application, after mody the db.py

db = DAL('mysql://r...@localhost/database')

web2py generated a ticket with the following error:

Traceback (most recent call last):
  File gluon/restricted.py, line 184, in restricted
  File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
applications/core/models/db.py, line 15, in module
  File gluon/sql.py, line 3580, in DAL
  File gluon/sql.py, line 870, in __init__
  File gluon/sql.py, line 781, in _pool_connection
  File gluon/sql.py, line 870, in lambda
NameError: global name 'MySQLdb' is not defined

thank you very much for helping me

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---