[web2py] Re: unable to call ajax url from external javascript.

2013-02-24 Thread zhongliang liang
Emmm I'm not sure you can do this in external js files.

URL(...) and {{ ... }} markup are python helpers defined in web2py, they 
are only visible in python controller files and view files that will be 
rendered by web2py framework. Static external js files are only plain js, 
which wont be rendered by web2py. So the above {{=URL(...)...}} is only a 
plain string to javascript.

However, ajax() is a javascript function defined by web2py.js, so it's 
visible in js files. So just use the direct url instead of the markup. The 
following code in static js files should do what you want:

 ajax(control2/function1, ['name'],'target')

ps: I realized this is an old thread, but the comment may help future users 
who google for similar problems.

On Monday, February 20, 2012 10:08:42 AM UTC-5, Pradeeshnarayan wrote:

 I am new to web2py. 
 form my view i am able to call web2py ajax as  
 ajax({{=URL(r=request,c='control2',f='function1')}}['name'],'target'); 
 . But the same command is not working from an external javascript. 
 How can i call a function (in another control file) using ajax from an 
 external JavaScript. 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: drop table cascade

2013-01-09 Thread Liang Yi Aris
No error shown in the interactive shell after executing the command. But
the tables in the database are still there. I use Postgresql 9.2.

On Wed, Jan 9, 2013 at 1:35 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 What do you get? An error? What error?


 On Friday, January 4, 2013 3:18:32 AM UTC-6, Liang wrote:

 drop('cascade') seems not working.

 On Wednesday, 4 February 2009 14:17:14 UTC+8, mdipierro wrote:

 give this a try. In trunk

 db.table.drop('cascade')

 On Feb 3, 11:40 pm, Baron richar...@gmail.com wrote:
  thanks Massimo.
 
  On Feb 4, 3:28 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 
   sorry, for now you have to do it manually
 
   db.executesql('DROP TABLE tablename CASCADE;')
 
   perhaps I can add an option to drop/truncate.
 
   Massimo
 
   On Feb 3, 9:01 pm, Baron richar...@gmail.com wrote:
 
When I try to drop or truncate a table I get this error:
 
ProgrammingError: cannot drop table dump because other objects
 depend
on it
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
 
Deleting from the table works fine because the deletions cascade.
 Is
there a way to truncate or drop tables through the DAL that have
foreign key dependencies?
 
Baron

  --





-- 





[web2py] Re: drop table cascade

2013-01-04 Thread Liang
drop('cascade') seems not working.

On Wednesday, 4 February 2009 14:17:14 UTC+8, mdipierro wrote:

 give this a try. In trunk 

 db.table.drop('cascade') 

 On Feb 3, 11:40 pm, Baron richar...@gmail.com wrote: 
  thanks Massimo. 
  
  On Feb 4, 3:28 pm, mdipierro mdipie...@cs.depaul.edu wrote: 
  
   sorry, for now you have to do it manually 
  
   db.executesql('DROP TABLE tablename CASCADE;') 
  
   perhaps I can add an option to drop/truncate. 
  
   Massimo 
  
   On Feb 3, 9:01 pm, Baron richar...@gmail.com wrote: 
  
When I try to drop or truncate a table I get this error: 
  
ProgrammingError: cannot drop table dump because other objects 
 depend 
on it 
HINT:  Use DROP ... CASCADE to drop the dependent objects too. 
  
Deleting from the table works fine because the deletions cascade. Is 
there a way to truncate or drop tables through the DAL that have 
foreign key dependencies? 
  
Baron

-- 





[web2py:12538] Re: non-ascii chars URL

2008-11-26 Thread jessinio liang
2008/11/27 mdipierro [EMAIL PROTECTED]


 Thank you Jessinio,

 could you please email me the patch as an attachment? I cannot read it
 properly.

 Does anybody have any objection to this patch?


sorry , i don't know , i know it work well (^_^)

see diff file attachment






-- 
身体是革命的本钱!!
http://jessinio.blogspot.com

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

--- /tmp/web2py-read-only/gluon/main.py	2008-11-27 09:45:52.0 +0800
+++ /home/jessinio/download/web2py/gluon/main.py	2008-11-27 11:35:10.0 +0800
@@ -36,7 +36,7 @@
 
 ### Security Checks: validate URL and session_id here, accept_language is validated in languages
 # pattern to find valid paths in url /application/controller/...
-regex_url=re.compile('(?:^$)|(?:^\w+/?$)|(?:^\w+/\w+/?$)|(?:^(\w+/){2}\w+/?$)|(?:^(\w+/){2}\w+(/[\w\-]+(\.[\w\-]+)*)+$)|(?:^(\w+)/static(/[\w\-]+(\.[\w\-]+)*)+$)')
+regex_url=re.compile('(?:^$)|(?:^\w+/?$)|(?:^\w+/\w+/?$)|(?:^(\w+/){2}\w+/?$)|(?:^(\w+/){2}\w+(/[\w\-]+(\.[\w\-]+)*)+$)|(?:^(\w+)/static(/[\w\-]+(\.[\w\-]+)*)+$)',re.U)
 # patter used to validate client address
 regex_client=re.compile('[\w\-]+(\.[\w\-]+)*\.?')
 
@@ -125,8 +125,10 @@
 if len(items)1: request.env.query_string=items[1]
 else: request.env.query_string=''
 path=request.env.path_info[1:].replace('\\','/')
+path = unicode(path, utf8)
 if not regex_url.match(path):
 raise HTTP(400,error_message,web2py_error='invalid path')
+path = path.encode('utf8')
 items=path.split('/')
 ###
 # serve if a static file