Re: [web2py] Re: REF: Bare Ajax Login

2014-04-23 Thread Teddy Nyambe
Web2py has excellent backend processing. I think the way Massimo made
web2py to work supports less pure Ajax calls. I would recommend and request
that core functions are made to support pure Ajax say a one page website,
cause users now want to experience web apps as if they are desktop apps. On
the  other hand I have also been developing an app with dhtmlx framework
client based and using web2py calls. Works well but don't use inbuilt cool
features of web2py to process foreinstance forms. It would be cool to see
how a Ajax call can be handled by say form.procesd().

Teddy
On 24 Apr 2014 00:22, select falko.kra...@gmail.com wrote:

 I just wanted to mention that a similar problem exist for
 request_reset_password,
 the call works, passoword is restet the email is send but there is just a
 blank return and I have no idea how to react on that on the client side
 without rewriting the web2py_ajax... routines

 On Thursday, April 24, 2014 12:05:10 AM UTC+2, select wrote:

 Was fighting with the problem in 2011 and still do, how to log in with
 ajax?
 The problem is that I have a one pager app with client site js code that
 needs to register if the user is logged in
 when I login with e.g.
 index.html:
 div id=i-login-form/div


 js code:
 web2py_component(localconfig.baseurl + '/default/user.load/login',
 'i-login-form')

 default.py unchanged from welcome app

 user.load
 {{=form}}

 I have not found a way to register in the js code if the login was a
 success or fail

 I modified web2py_component so that it has a callback that is executed
 every time the ajax call in web2py_ajax_page (via web2py_component) is
 completed

 web2py_component(localconfig.baseurl + '/default/user.load/login',
 'i-login-form', undefined, undefined, function() {
 // do some other ajax call if the login was a success
 });


 But this is far from ideal. The callback code must check if this is the
 first call and if the login was a success. Also if the login failed (e.g.
 an email was provided but no password) no form is returned :(

 Do I really have to write my own server side login methods to make this
 work? Any news on this?


 On Friday, May 24, 2013 6:14:06 AM UTC+2, software.ted wrote:

 In addition, auth.login_bare() seems to check only with auth_user table,
 if my authentication is based on LDAP it may not work. Any progress that
 has been made  on auth.ajax_login()?
 On 24 May 2013 05:58, Teddy Nyambe softwa...@gmail.com wrote:

 Why I asked cause a 2 months or so Massimo contributed to a similar
 thread and this is what he wrote:

 Should we offer something like {{=auth.ajax_login()}} helper which
 submits to /user/login? If would not be difficult to write.
 How should it work?

 The guy who hd asked a question on pure Ajax login had used
 auth.login_bare() and from my assessment he seemed to hv challenges with 
 it.
 On 24 May 2013 05:46, Teddy Nyambe softwa...@gmail.com wrote:

 Of course read the book, auth.login_bare() manages my sessions
 automatically? Will check it out thanx
 On 23 May 2013 20:09, Anthony abas...@gmail.com wrote:

 Basic authentication won't do anything with the session -- it
 requires sending the credentials on every request -- probably not what's
 desired here. Instead, the very next section in the book may help:
 http://www.web2py.com/book/default/chapter/09#Manual-Authentication.
 You can post the login credentials via Ajax and then use 
 auth.login_bare()
 to handle the login.

 Anthony

 On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:

 You did read the book before you asked, yes?

 http://www.web2py.com/book/default/chapter/09#Access-Control
 -and-Basic-Authentication

 On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:

 Is there a way of using a pure Ajax request to web2py
 authentication and create a session for a successfully logged in user?

 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools
 he is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



   --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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

[web2py] REF: Downloading static files with spaces gives an error

2014-03-19 Thread Teddy Nyambe
I have trying to download files stored in static/upload/my file.pdf, it
returns page not found. But when i remove spaces and change the static
file, it works.

Any ideas on why this behaviour or explanation?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: REF: Downloading static files with spaces gives an error

2014-03-19 Thread Teddy Nyambe
Rocket and will eventually deploy on apache. It will be a link pointing to
a file and when someone clicks should prompt a save
On 19 Mar 2014 17:05, LightDot light...@gmail.com wrote:

 Vital parts of information are missing - are the files served by Rocket ,
 Apache, or..? How is the file being downloaded? By a browser request? How
 is the request formulated, are you following a link or entering the URL by
 typing it directly?

 Regards

 On Wednesday, March 19, 2014 3:24:03 PM UTC+1, software.ted wrote:

 I have trying to download files stored in static/upload/my file.pdf, it
 returns page not found. But when i remove spaces and change the static
 file, it works.

 Any ideas on why this behaviour or explanation?

 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.


Re: [web2py] Re: REF: Issue with uploading files with web2py

2014-02-25 Thread Teddy Nyambe
Ok great this is smooth!!! thumbs up to python+web2py!!!


On Tue, Feb 25, 2014 at 8:00 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 $filename = $_FILES[file][name];
 move_uploaded_file($_FILES[file][tmp_name], uploaded/.$filename);

 would be:

 import shutil, os
 filename  = request.post_vars.file.filename
 shutil.copyfileobj(request.post_vars.file.file,
 open(os.path.join(uploaded,filename),'w'))

 This is very UNSAFE (both in python/web2py and in PHP). It can be used by
 the user to overwrite almost any file on the filesystem. The filename has
 to be sanitized.

 On Monday, 24 February 2014 01:35:02 UTC-6, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been working
 with web2py now for over a year and I like its flexibility, I have been
 working on an application that is ajax based using my own file. Now i have
 the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo, upload),
 ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo, ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the upload
 folder, i was thinking web2py will put the physical image in upload folder
 according to documentation but unfortunately folder is empty. The DB hower
 gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
Am using form processing tool. Which has a send method...what it actually
does is make post/get to a url in the form.send({{=URL('c','a')}})

So what happens in the controller is that I can access the form variables
as follows:

def a():
file_name = request.vars.file_name

The framework has code examples of how to access the uploaded file in php
and java

Any ideas?
On 24 Feb 2014 14:27, Anthony abasta...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax file
 upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been working
 with web2py now for over a year and I like its flexibility, I have been
 working on an application that is ajax based using my own file. Now i have
 the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo, upload),
 ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo, ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the upload
 folder, i was thinking web2py will put the physical image in upload folder
 according to documentation but unfortunately folder is empty. The DB hower
 gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
I am using dhtmlx (www.dhtmlx.com) framework. The component am using is
dhtmlxform. I don't understand what you mean by class and attribute.
On 24 Feb 2014 14:45, Anthony abasta...@gmail.com wrote:

 Can you provide information about the form processing tool? What is the
 class and attributes of request.vars.photo?

 Anthony

 On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote:

 Am using form processing tool. Which has a send method...what it actually
 does is make post/get to a url in the form.send({{=URL('c','a')}})

 So what happens in the controller is that I can access the form variables
 as follows:

 def a():
 file_name = request.vars.file_name

 The framework has code examples of how to access the uploaded file in php
 and java

 Any ideas?
 On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax file
 upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been
 working with web2py now for over a year and I like its flexibility, I have
 been working on an application that is ajax based using my own file. Now i
 have the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo,
 upload), ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo, ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the upload
 folder, i was thinking web2py will put the physical image in upload folder
 according to documentation but unfortunately folder is empty. The DB hower
 gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
the output is:

Dir:
 ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
'__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
'__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__',
'_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center',
'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format',
'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace',
'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split',
'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
'upper', 'zfill']

type: type 'str'


On Mon, Feb 24, 2014 at 3:40 PM, Anthony abasta...@gmail.com wrote:

 The output of type(request.vars.photo) and dir(request.vars.photo).


 On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote:

 I am using dhtmlx (www.dhtmlx.com) framework. The component am using is
 dhtmlxform. I don't understand what you mean by class and attribute.
 On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote:

 Can you provide information about the form processing tool? What is the
 class and attributes of request.vars.photo?

 Anthony

 On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote:

 Am using form processing tool. Which has a send method...what it
 actually does is make post/get to a url in the
 form.send({{=URL('c','a')}})

 So what happens in the controller is that I can access the form
 variables as follows:

 def a():
 file_name = request.vars.file_name

 The framework has code examples of how to access the uploaded file in
 php and java

 Any ideas?
 On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax file
 upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been
 working with web2py now for over a year and I like its flexibility, I 
 have
 been working on an application that is ajax based using my own file. Now 
 i
 have the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo,
 upload), ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo, ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the upload
 folder, i was thinking web2py will put the physical image in upload 
 folder
 according to documentation but unfortunately folder is empty. The DB 
 hower
 gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools
 he is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA


Re: [web2py] Re: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
What am supposed to see in dir and type? So that I can debug
On 24 Feb 2014 16:16, Anthony abasta...@gmail.com wrote:

 You'll have the check the JS framework docs to see how/where it is posting
 the file (e.g., maybe via a separate Ajax request).

 On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote:

 the output is:

 Dir:
  ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
 '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
 '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
 '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__',
 '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__',
 '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
 '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center',
 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format',
 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace',
 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split',
 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
 'upper', 'zfill']

 type: type 'str'


 On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote:

 The output of type(request.vars.photo) and dir(request.vars.photo).


 On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote:

 I am using dhtmlx (www.dhtmlx.com) framework. The component am using
 is dhtmlxform. I don't understand what you mean by class and attribute.
 On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote:

 Can you provide information about the form processing tool? What is
 the class and attributes of request.vars.photo?

 Anthony

 On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote:

 Am using form processing tool. Which has a send method...what it
 actually does is make post/get to a url in the
 form.send({{=URL('c','a')}})

 So what happens in the controller is that I can access the form
 variables as follows:

 def a():
 file_name = request.vars.file_name

 The framework has code examples of how to access the uploaded file in
 php and java

 Any ideas?
 On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax file
 upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been
 working with web2py now for over a year and I like its flexibility, I 
 have
 been working on an application that is ajax based using my own file. 
 Now i
 have the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo,
 upload), ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo, ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the upload
 folder, i was thinking web2py will put the physical image in upload 
 folder
 according to documentation but unfortunately folder is empty. The DB 
 hower
 gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools
 he is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To 

Re: [web2py] Re: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
Ok let me check will revert at least you have given me a head start!
On 24 Feb 2014 16:27, Anthony abasta...@gmail.com wrote:

 Well, it's just a string, so that's not the file. You have to figure out
 how the JS library is sending the file to the server.

 On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote:

 What am supposed to see in dir and type? So that I can debug
 On 24 Feb 2014 16:16, Anthony abas...@gmail.com wrote:

 You'll have the check the JS framework docs to see how/where it is
 posting the file (e.g., maybe via a separate Ajax request).

 On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote:

 the output is:

 Dir:
  ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
 '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
 '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
 '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__',
 '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__',
 '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
 '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center',
 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format',
 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace',
 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split',
 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
 'upper', 'zfill']

 type: type 'str'


 On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote:

 The output of type(request.vars.photo) and dir(request.vars.photo).


 On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote:

 I am using dhtmlx (www.dhtmlx.com) framework. The component am using
 is dhtmlxform. I don't understand what you mean by class and attribute.
 On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote:

 Can you provide information about the form processing tool? What is
 the class and attributes of request.vars.photo?

 Anthony

 On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote:

 Am using form processing tool. Which has a send method...what it
 actually does is make post/get to a url in the
 form.send({{=URL('c','a')}})

 So what happens in the controller is that I can access the form
 variables as follows:

 def a():
 file_name = request.vars.file_name

 The framework has code examples of how to access the uploaded file
 in php and java

 Any ideas?
 On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax
 file upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been
 working with web2py now for over a year and I like its flexibility, 
 I have
 been working on an application that is ajax based using my own file. 
 Now i
 have the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo,
 upload), ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo,
 ...)
 except ...:

 return value

 Now my question is how do i move the upaded image to say the
 upload folder, i was thinking web2py will put the physical image in 
 upload
 folder according to documentation but unfortunately folder is empty. 
 The DB
 hower gets updated with a the following: C:\fakepath\.jpg.

 Any ideas?

 Kind regards,



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with
 tools he is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit 

Re: [web2py] Re: REF: Issue with uploading files with web2py

2014-02-24 Thread Teddy Nyambe
Hi again,

I have found out as follows after twiking with the dhtmlx framework. I am
not sure how o access the actual image, i have noticed the file is an
instance of something...not a file per say. i have the following results:


print type(file)

type: type 'instance'

print dir(file)

dir: ['FieldStorageClass', '_FieldStorage__file', '_FieldStorage__write',
'__contains__', '__doc__', '__getattr__', '__getitem__', '__init__',
'__iter__', '__len__', '__module__', '__nonzero__', '__repr__', 'bufsize',
'disposition', 'disposition_options', 'done', 'file', 'filename', 'fp',
'getfirst', 'getlist', 'getvalue', 'has_key', 'headers', 'innerboundary',
'keep_blank_values', 'keys', 'length', 'list', 'make_file', 'name',
'outerboundary', 'qs_on_post', 'read_binary', 'read_lines',
'read_lines_to_eof', 'read_lines_to_outerboundary', 'read_multi',
'read_single', 'read_urlencoded', 'skip_lines', 'strict_parsing', 'type',
'type_options']


print file

file: FieldStorage('file', 'power.gif',
'GIF87a\x1f\x02c\x01w\x00\x00!\xfe\x1aSoftware: Microsoft
Office\x00,\x00\x00\x00\x00\x1f\x02c\x01\x87\xf7\xde{\xff\xef\xa5\xef\xbdZ\xf7\xd6s\xf7\xce{\xff\xe6\x94\xe6\xbdZ\xe6\xb5Z\xef\xc5Z\xde\xbdk\xf7\xe6\x94\xf7\xe6{\xff\xf7\xb5\xf7\xcek\xef\xbdk\xd6\x9cR\xf7\xd6\x8c\xb5{!\xe6\x9cB\xd6\xadZ\xef\xcek\xef\xb5Z\xef\xadJ\xd6\x9c1\xff\.etc...too
long to display

I looked at the PHP implementation which looks as follows:

$filename = $_FILES[file][name];
move_uploaded_file($_FILES[file][tmp_name], uploaded/.$filename);

What would be the equivalent in python?


On Mon, Feb 24, 2014 at 4:41 PM, Teddy Nyambe software@gmail.comwrote:

 Ok let me check will revert at least you have given me a head start!
 On 24 Feb 2014 16:27, Anthony abasta...@gmail.com wrote:

 Well, it's just a string, so that's not the file. You have to figure out
 how the JS library is sending the file to the server.

 On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote:

 What am supposed to see in dir and type? So that I can debug
 On 24 Feb 2014 16:16, Anthony abas...@gmail.com wrote:

 You'll have the check the JS framework docs to see how/where it is
 posting the file (e.g., maybe via a separate Ajax request).

 On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote:

 the output is:

 Dir:
  ['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
 '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
 '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
 '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__',
 '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__',
 '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
 '_formatter_field_name_split', '_formatter_parser', 'capitalize', 
 'center',
 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format',
 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace',
 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split',
 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
 'upper', 'zfill']

 type: type 'str'


 On Mon, Feb 24, 2014 at 3:40 PM, Anthony abas...@gmail.com wrote:

 The output of type(request.vars.photo) and dir(request.vars.photo).


 On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote:

 I am using dhtmlx (www.dhtmlx.com) framework. The component am
 using is dhtmlxform. I don't understand what you mean by class and
 attribute.
 On 24 Feb 2014 14:45, Anthony abas...@gmail.com wrote:

 Can you provide information about the form processing tool? What is
 the class and attributes of request.vars.photo?

 Anthony

 On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote:

 Am using form processing tool. Which has a send method...what it
 actually does is make post/get to a url in the
 form.send({{=URL('c','a')}})

 So what happens in the controller is that I can access the form
 variables as follows:

 def a():
 file_name = request.vars.file_name

 The framework has code examples of how to access the uploaded file
 in php and java

 Any ideas?
 On 24 Feb 2014 14:27, Anthony abas...@gmail.com wrote:

 Ajax doesn't allow file uploads in forms. Are you using an Ajax
 file upload widget on the client side?

 Anthony

 On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote:

 I am extremely stuck on how to manage uploaded file, I have been
 working with web2py now for over a year and I like its flexibility, 
 I have
 been working on an application that is ajax based using my own 
 file. Now i
 have the following scenario i need help with:

 DB
 ===

 db.create_table(person, Field(first_name), Field(photo,
 upload), ...)

 Controller:

 def manage_person():
 try:
 value = db.person.update_or_insert(id == request.vars.id,
 first_name=request.vars.first_name, photo=request.vars.photo,
 ...)
 except

[web2py] REF: Issue with uploading files with web2py

2014-02-23 Thread Teddy Nyambe
I am extremely stuck on how to manage uploaded file, I have been working
with web2py now for over a year and I like its flexibility, I have been
working on an application that is ajax based using my own file. Now i have
the following scenario i need help with:

DB
===

db.create_table(person, Field(first_name), Field(photo, upload),
...)

Controller:

def manage_person():
try:
value = db.person.update_or_insert(id == request.vars.id,
first_name=request.vars.first_name, photo=request.vars.photo, ...)
except ...:

return value

Now my question is how do i move the upaded image to say the upload folder,
i was thinking web2py will put the physical image in upload folder
according to documentation but unfortunately folder is empty. The DB hower
gets updated with a the following: C:\fakepath\.jpg.

Any ideas?

Kind regards,



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] Ref: Handling File Uploads

2014-02-22 Thread Teddy Nyambe
I am trying to find out how I can handle file uploads in web2py if I need
total control of the process. For instance if I am using my own html form
and not the web2py. In controller how do I access the uploaded file so that
I can use python file system to rename the file and move it to a specific
folder and file name saved in the database.

Is it found in the request.vars.*

Any help

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Boolean in MYSQL

2014-02-19 Thread Teddy Nyambe
I have noticed in web2py boolean is represented in mysql as Char(1) when
boolean is defined in the DAL model as follow:

db.define_table(test, Field(latest, boolean))

mysql field shows as follows: latest char(1)

when i test a query in mysql db.executesql(select * from test where latest
is true) is failing.

Any ideas!?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Join query help!

2014-02-16 Thread Teddy Nyambe
Hi,

To makes things easier I have resolved to use db.executesql() it gives a
bit more flexibility were dal object model maybe a bit complex.

Thanx for your help thus far!
On 14 Feb 2014 21:10, Teddy Nyambe software@gmail.com wrote:

 Apologies if I was not clear, when you do a cross join as in the example
 you get Rows now, and your code is as I meant it was just a typo, my need
 is to represent the record set into json object...it works well if there is
 no join, but when another table comes in the picture the way to access
 fields changes

 db.table.field

 So I want a rows to be represented as ['fieldname', 'field value],
 ['fieldname', 'field value], ['fieldname', 'field value], etc

 It's easy with a single table but when your record set has fields from
 another table it becomes a problem...this is my working iteration with
 single table but joint does not apply:

 def get_json(rs):
 json = [
 for row in rd:
  json += {
  for key, value in (row.as_dict()).values:
  json +=  ',key, ':', value,'
 json += },
json += ]


 On 14 Feb 2014 15:11, Leonel Câmara leonelcam...@gmail.com wrote:

 I'm not sure I'm understanding exactly what you're trying to do. You say
 you want to display the value of the foreign key (which would be an
 integer) but in your code you seem to be only interested in the names. So
 this may or may not be what you want.

 I've found a bug here

 rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.owner.name)

 This should be:

 rs = db(db.owner.id==db.dog.owner).select(db.owner.name, 
 db.dog.namehttp://db.owner.name/
 )

 Then you can do:

 for r in rs:
 print r.owner.name + ' : ' + r.dog.name


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Join query help!

2014-02-14 Thread Teddy Nyambe
I have problem, I would like to have achieve a query which displays the
value of the foreign key:

db.define_table(owner, Field(owner_name))
db.define_table(dog, Field(dog_name), Field(owner, reference owner))

rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.owner.name)

what i want to result set to be is:

is a list of dictionaries with {fieldname:value} in this case have

[{owner_name: Paul}, {dog_name, Snoopy}],
[{owner_name: Ben}, {dog_name, Poopy}],
...
...

how do i iterate through my record set rs above cause i am having
challenges if i do it like this:

for row in rs:
for k, v in (row.as_dict()).items():
print '', k,' and ', v

I am getting weird results!

Any help?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Join query help!

2014-02-14 Thread Teddy Nyambe
Apologies if I was not clear, when you do a cross join as in the example
you get Rows now, and your code is as I meant it was just a typo, my need
is to represent the record set into json object...it works well if there is
no join, but when another table comes in the picture the way to access
fields changes

db.table.field

So I want a rows to be represented as ['fieldname', 'field value],
['fieldname', 'field value], ['fieldname', 'field value], etc

It's easy with a single table but when your record set has fields from
another table it becomes a problem...this is my working iteration with
single table but joint does not apply:

def get_json(rs):
json = [
for row in rd:
 json += {
 for key, value in (row.as_dict()).values:
 json +=  ',key, ':', value,'
json += },
   json += ]


On 14 Feb 2014 15:11, Leonel Câmara leonelcam...@gmail.com wrote:

 I'm not sure I'm understanding exactly what you're trying to do. You say
 you want to display the value of the foreign key (which would be an
 integer) but in your code you seem to be only interested in the names. So
 this may or may not be what you want.

 I've found a bug here

 rs = db(db.owner.id==db.dog.owner).select(db.owner.name, db.owner.name)

 This should be:

 rs = db(db.owner.id==db.dog.owner).select(db.owner.name, 
 db.dog.namehttp://db.owner.name/
 )

 Then you can do:

 for r in rs:
 print r.owner.name + ' : ' + r.dog.name


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Finding if a date is between two date fields

2014-02-05 Thread Teddy Nyambe
I would like to find out how to achieve this comparison:

row = db(db.mytable.start_date  today  db.mytable.end_date).select()

I am getting this error:

Traceback (most recent call last):
  File
/Users/teddyl/PycharmProjects/website/web2py/gluon/contrib/shell.py, line
234, in run
exec compiled in statement_module.__dict__
  File string, line 1, in module
TypeError: can't compare datetime.date to Field

But if I try:

row = db(db.mytable.start_date == today).select()

This comparison works, is there another way of doing it?

-- 
...
Teddy Lubasi Nyambe

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Compound Primary

2014-01-31 Thread Teddy Nyambe
I have a table:

db.define_table('mytable', Field('f1'), Field('F2'))

I want to make F1 and F2 together with with the 'invisible id' as a
compound primary key. I want the new records to have unique f1 and f2

Kind regards,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Web2py database issue

2014-01-13 Thread Teddy Nyambe
I have two web2py apps, one updates database the other app should just
read. But i want the readonly app to have its own db to ready from with
selected tables from the main db. Whats the best way to replicate selected
tables and monitor changes to main db. Secondly what would be the
configuration of web2py operate in readonly mode?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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] REF: Web2py database issue

2014-01-13 Thread Teddy Nyambe
Brilliant, am using mural db...have found an inbuilt replication feature in
mysql. So will try out the dam(..., migrate_enabled=False) feature for read
only. And of course will use only select statements in the read only app.

Thanx
On 13 Jan 2014 21:42, Anthony abasta...@gmail.com wrote:

 Also, set DAL(..., migrate_enabled=False) to prevent migrations.

 Anthony

 On Monday, January 13, 2014 2:35:40 PM UTC-5, Richard wrote:

 web2py readonly :
 You implement select only in your app function everywhere :

 db().select()

 SQLFORM(..., readonly=True)

 SQLFORM.grid(..., deletable=False, editable=False, create=Flase,
 details=True, selectable=True)

 Replication :
 An audit trail on your table that received the new data should be what
 you want?


 :)#

 Richard


 On Mon, Jan 13, 2014 at 7:12 AM, Teddy Nyambe softwa...@gmail.comwrote:

 I have two web2py apps, one updates database the other app should just
 read. But i want the readonly app to have its own db to ready from with
 selected tables from the main db. Whats the best way to replicate selected
 tables and monitor changes to main db. Secondly what would be the
 configuration of web2py operate in readonly mode?

 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: DAL Catching errors

2014-01-11 Thread Teddy Nyambe
Thanks exactly what I was looking for, will try it!
On 11 Jan 2014 19:00, Anthony abasta...@gmail.com wrote:

 Good point. web2py normally does a rollback if a request results in an
 exception, but if you catch the exception, you would need to do the
 rollback yourself to prevent web2py from committing the transaction at the
 end of the request.

 Anthony

 On Saturday, January 11, 2014 11:48:08 AM UTC-5, Massimo Di Pierro wrote:

 Depending on the situation it may also be necessary to do:

 try:
 
 except db._adapter.driver.IntegrityError as e:
 db.rollback() # or db.commit()
 return str(e)




 On Saturday, 11 January 2014 09:17:33 UTC-6, Anthony wrote:

 It depends on how the particular exception class is implemented. In
 general, if you do str(error), you get the error message. I think in most
 exception classes, error.args[0] is also typically the error message. This
 is a general Python issue and not specific to web2py.

 try:
 
 except db._adapter.driver.IntegrityError as e:
 return str(e)

 Anthony

 On Saturday, January 11, 2014 1:55:30 AM UTC-5, software.ted wrote:

 Hi Anthony!

 Those gems we need to know!!!, since i have to extract undocumented
 details on this list, I would like to find out how i can then get system
 generated messages cause there are many integrity error
 descriptions...instead of me having one message like this:

 try:
 ...
 except db._adapter.driver.IntegrityError:
 err_msg = Duplicate record in database

 I would like to have a situation were i can get system messages of the
 specific integrity error enountered:

 try:
 ...
 except db._adapter.driver.IntegrityError:
 err_msg = db.[some object].errorMessage


 Any pointers?


 On Sat, Jan 11, 2014 at 8:11 AM, Anthony abas...@gmail.com wrote:

 Another one of our great undocumented gems. :-)

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: DAL Catching errors

2014-01-10 Thread Teddy Nyambe
Tried the example you gave me:

Try:

Except IntegrityError:



I am getting unresolved reference 'IntegrityError'

Kind regards,


On Thu, Jan 9, 2014 at 6:01 PM, Teddy Nyambe software@gmail.com wrote:

 Thanx Anthony,

 I will use [try]
 On 9 Jan 2014 15:52, Anthony abasta...@gmail.com wrote:

 try:
 db.test.insert(...)
 except IntegrityError:
 [return friendly error message]

 Of course, if the inserts are done via form submission, you should
 instead add an IS_NOT_IN_DB validator, in which case, it will automatically
 check for duplicates and return the appropriate error message. Even if not
 using a form, you can make use of the validator by using the
 .validate_and_insert() method.

 Anthony

 On Thursday, January 9, 2014 2:31:00 AM UTC-5, software.ted wrote:

 Hi,

 I am trying to find out the best way to catch errors generated by
 web2py especially those genereted by say DAL. Say forinstance if I
 have a table:

 db.define_table('test', Field('xyz', 'integer', unique=True)

 If i insert a dublicate field will get the exception and ticket:

 IntegrityError: (1062, uDuplicate entry 'X' for key 'xyz')

 Now i want to catch such an error and send a better message to a user,
 not the ticket etc.

 Any ideas?

 --
 ...

 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: DAL Catching errors

2014-01-10 Thread Teddy Nyambe
thanks. it worked. but where is this documented?


On Fri, Jan 10, 2014 at 4:09 PM, Anthony abasta...@gmail.com wrote:

 IntegrityError is defined by the database driver, so needs to be imported.
 Actually, I forgot, we made this easier, so it is not adapter-dependent --
 you can do:

 try:
 ...
 except db._adapter.driver.IntegrityError:
 ...

 Another option is:

 def insert_error_handler(table, fields, error):
 [handle the error]

 db.mytable._on_insert_error = insert_error_handler

 There is also an _on_update_error callback.

 Anthony

 On Friday, January 10, 2014 3:53:17 AM UTC-5, software.ted wrote:

 Tried the example you gave me:

 Try:
 
 Except IntegrityError:
 


 I am getting unresolved reference 'IntegrityError'

 Kind regards,


 On Thu, Jan 9, 2014 at 6:01 PM, Teddy Nyambe softwa...@gmail.com wrote:

 Thanx Anthony,

 I will use [try]
 On 9 Jan 2014 15:52, Anthony abas...@gmail.com wrote:

 try:
 db.test.insert(...)
 except IntegrityError:
 [return friendly error message]

 Of course, if the inserts are done via form submission, you should
 instead add an IS_NOT_IN_DB validator, in which case, it will automatically
 check for duplicates and return the appropriate error message. Even if not
 using a form, you can make use of the validator by using the
 .validate_and_insert() method.

 Anthony

 On Thursday, January 9, 2014 2:31:00 AM UTC-5, software.ted wrote:

 Hi,

 I am trying to find out the best way to catch errors generated by
 web2py especially those genereted by say DAL. Say forinstance if I
 have a table:

 db.define_table('test', Field('xyz', 'integer', unique=True)

 If i insert a dublicate field will get the exception and ticket:

 IntegrityError: (1062, uDuplicate entry 'X' for key 'xyz')

 Now i want to catch such an error and send a better message to a user,
 not the ticket etc.

 Any ideas?

 --
 ...

 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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+un...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.




 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: DAL Catching errors

2014-01-10 Thread Teddy Nyambe
Hi Anthony!

Those gems we need to know!!!, since i have to extract undocumented details
on this list, I would like to find out how i can then get system generated
messages cause there are many integrity error descriptions...instead of me
having one message like this:

try:
...
except db._adapter.driver.IntegrityError:
err_msg = Duplicate record in database

I would like to have a situation were i can get system messages of the
specific integrity error enountered:

try:
...
except db._adapter.driver.IntegrityError:
err_msg = db.[some object].errorMessage


Any pointers?


On Sat, Jan 11, 2014 at 8:11 AM, Anthony abasta...@gmail.com wrote:

 Another one of our great undocumented gems. :-)

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: DAL Catching errors

2014-01-09 Thread Teddy Nyambe
Thanx Anthony,

I will use [try]
On 9 Jan 2014 15:52, Anthony abasta...@gmail.com wrote:

 try:
 db.test.insert(...)
 except IntegrityError:
 [return friendly error message]

 Of course, if the inserts are done via form submission, you should instead
 add an IS_NOT_IN_DB validator, in which case, it will automatically check
 for duplicates and return the appropriate error message. Even if not using
 a form, you can make use of the validator by using the
 .validate_and_insert() method.

 Anthony

 On Thursday, January 9, 2014 2:31:00 AM UTC-5, software.ted wrote:

 Hi,

 I am trying to find out the best way to catch errors generated by
 web2py especially those genereted by say DAL. Say forinstance if I
 have a table:

 db.define_table('test', Field('xyz', 'integer', unique=True)

 If i insert a dublicate field will get the exception and ticket:

 IntegrityError: (1062, uDuplicate entry 'X' for key 'xyz')

 Now i want to catch such an error and send a better message to a user,
 not the ticket etc.

 Any ideas?

 --
 ...

 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: update_or_insert() confirming update

2014-01-09 Thread Teddy Nyambe
Noted, thanx!
On 9 Jan 2014 16:52, Anthony abasta...@gmail.com wrote:

 If it doesn't return an id, that means no new insert was done, which
means it did find a matching record and therefore updated it. Whether or
not any fields in the matching record were actually changed depends on your
inputs. Note, if more than one record matches the criteria, it will only
update the first matching record.

 Anthony


 On Thursday, January 9, 2014 1:23:49 AM UTC-5, software.ted wrote:

 wanted to find out how to confirm that an update really took place
 when using update_or_insert(), insert atleast returns the auto id but
 a successful update seems to return none/null.

 Any ideas?

 --

...

 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: update_or_insert() confirming update

2014-01-08 Thread Teddy Nyambe
wanted to find out how to confirm that an update really took place
when using update_or_insert(), insert atleast returns the auto id but
a successful update seems to return none/null.

Any ideas?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he
is all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: DAL Catching errors

2014-01-08 Thread Teddy Nyambe
Hi,

I am trying to find out the best way to catch errors generated by
web2py especially those genereted by say DAL. Say forinstance if I
have a table:

db.define_table('test', Field('xyz', 'integer', unique=True)

If i insert a dublicate field will get the exception and ticket:

IntegrityError: (1062, uDuplicate entry 'X' for key 'xyz')

Now i want to catch such an error and send a better message to a user,
not the ticket etc.

Any ideas?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he
is all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Date format

2013-12-30 Thread Teddy Nyambe
I have noted that mysql stores its dates as %Y-%m-%d, i would like to
know if the Field() or any DAL method is available to change the date to
%d/%m/%Y when doing a select?



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Date format

2013-12-30 Thread Teddy Nyambe
Hi Niphlod,

Am building a one page Ajax app using dhtmlx and web2py as the backend
engine so for it's working excellent can share the code when done. So most
of the dhtmlx UI elements like talking in json. So I hv represented my
dates as %d/%m/%Y so the UI expects me to give back a date in that format
in json.

My first attempt was this:

json_rs = db(db.mytable).select(datetime.strptime(db.mytable.startDate,
'%Y-%m-%d').strftime('%d/%m/%Y')).as_json()

I was getting Value Error messages and was advised to manipulate dates
outside the query. So my second option was to do just that, I queried as a
list now, parsed through the elements and changed dates format using
strptime and then used json.dumps(listObj) to return to the dhtmlx  UI for
display. It works.

However lost a bit of web2py magic there added 6 or so extra lines of code
mostly the for loops to go through the list to achieve this.

So far dhtmlx and web2py have been working seamless with a few tweaks
though.

Seasons greetings
On 30 Dec 2013 22:09, Niphlod niph...@gmail.com wrote:

 stop right there, I see a lot of confusion going around :-P

 unless in sqlite, where dates are stored as strings and parsed back,
 datetimes in other engines are stored as datetimes (meaning, not strings).
 the %Y-%m-%d notation is the ISO format (i.e. a default way to represent a
 date as a string).
 What you get back using a select() is indeed a datetime object.

 So, what you want to change is the **representation** of that datetime
 object as a string, not the way it's stored.

 BTW, the IS_DATE validator attached to any Field has a default
 represent() function that translates the date into the local format,
 using T(), so e.g. if you're displaying records using SQLTABLE or
 SQLFORM.grid, or a form, those datetimes gets formatted (represent()ed)
 according to the specification of the '%Y-%m-%d' string in your languages
 (and the calendar widget gets translated too).
 So the question is: how are you displaying your data ? If you're not using
 web2py facilities, you can either use strftime or the represent() itself.

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Rendering-rows-using-represent

 On Monday, December 30, 2013 8:27:30 PM UTC+1, software.ted wrote:

 I have noted that mysql stores its dates as %Y-%m-%d, i would like to
 know if the Field() or any DAL method is available to change the date to
 %d/%m/%Y when doing a select?



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Problem with Dates from db query

2013-12-29 Thread Teddy Nyambe
I have a requirement were i  need to convert a date from a query to another
format as follows:

db(db.mytable).select(db.mytable.id,

datetime.strptime(str(db.mytable.startDate),
'%Y-%m-%d').strftime('%d/%m/%Y'))

The problem is am getting an error

ValueError: time data 'mytable.startDate' does not match format '%Y-%m-%d'

When I output the value of str(db.mytable.startDate) i get s string as
follows:

2013-12-04 00:00:00

So what i did was to change the format to include the time part as follows:

db(db.mytable).select(db.mytable.id,

datetime.strptime(str(db.mytable.startDate), '%Y-%m-%d
%H:%M:%S').strftime('%d/%m/%Y'))

But still getting similar error:

ValueError: time data 'mytable.startDate' does not match format
'%Y-%m-%d %H:%M:%S'


On the python console when i try to pass this command its working fine:

 datetime.strptime(2013-12-04 00:00:00, '%Y-%m-%d
%H:%M:%S').strftime('%d/%m/%Y')
'04/12/2013'


What am I missing?
-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Question of Modifying the behaviour of the @auth.requires_login()

2013-12-19 Thread Teddy Nyambe
How do you write decorators?


On Wed, Dec 18, 2013 at 8:44 PM, Cliff Kachinske cjk...@gmail.com wrote:

 My reading of the source code says you are pretty much stuck with the
 behavior you see. The first thing the decorator does is check if the
 request is ajax and returns the message you are receiving.

 You could:
 - check auth.is_logged_in in your controller and take whatever action you
 wish if not true
 - write your own decorator that checks auth.is_logged_in



 On Tuesday, December 17, 2013 1:23:23 AM UTC-5, software.ted wrote:

 I am trying to create an application using web2py backend that is fully
 AJAX. I amusing the jQuery/Javascript to create a client. Now am a bit
 stuck on the customising the behavior @auth.requires_login() decorator.

 I have a jQuery request to an action with a @auth.requires_login()
 decorator:

 Client

 function(){
  $('#div').load('{{default,getPrice}}');
 }


 web2py control

 @auth.requires_login()
 def getPrice():
 ...
 ...
 return locals()

 At the moment when i capture what is returned when not logged in is the
 following text:

 div class=not-authorized alert alert-blockh4NOT
 AUTHORIZED/h4Please a data-w2p_disable_with=default
 href=login/a to view this content./div

 How can I return say forinstance true or false , logged in or logged
 out...or redirect to an action that returns and invokes a jQuery login
 window??

 Thanx in advance





 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: REF: Question of Modifying the behaviour of the @auth.requires_login()

2013-12-19 Thread Teddy Nyambe
Thanks for the head start, will look at those options!


On Thu, Dec 19, 2013 at 5:54 PM, Anthony abasta...@gmail.com wrote:

 You can probably start with the Auth.requires() decorator and modify as
 needed: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L3201

 Anthony


 On Thursday, December 19, 2013 9:07:10 AM UTC-5, Leonel Câmara wrote:

 http://www.artima.com/weblogs/viewpost.jsp?thread=240808

 Terça-feira, 17 de Dezembro de 2013 6:23:23 UTC, software.ted escreveu:

 I am trying to create an application using web2py backend that is fully
 AJAX. I amusing the jQuery/Javascript to create a client. Now am a bit
 stuck on the customising the behavior @auth.requires_login() decorator.

 I have a jQuery request to an action with a @auth.requires_login()
 decorator:

 Client

 function(){
  $('#div').load('{{default,getPrice}}');
 }


 web2py control

 @auth.requires_login()
 def getPrice():
 ...
 ...
 return locals()

 At the moment when i capture what is returned when not logged in is the
 following text:

 div class=not-authorized alert alert-blockh4NOT
 AUTHORIZED/h4Please a data-w2p_disable_with=default
 href=login/a to view this content./div

 How can I return say forinstance true or false , logged in or logged
 out...or redirect to an action that returns and invokes a jQuery login
 window??

 Thanx in advance





 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Question of Modifying the behaviour of the @auth.requires_login()

2013-12-16 Thread Teddy Nyambe
I am trying to create an application using web2py backend that is fully
AJAX. I amusing the jQuery/Javascript to create a client. Now am a bit
stuck on the customising the behavior @auth.requires_login() decorator.

I have a jQuery request to an action with a @auth.requires_login()
decorator:

Client

function(){
 $('#div').load('{{default,getPrice}}');
}


web2py control

@auth.requires_login()
def getPrice():
...
...
return locals()

At the moment when i capture what is returned when not logged in is the
following text:

div class=not-authorized alert alert-blockh4NOT AUTHORIZED/h4Please
a data-w2p_disable_with=default href=login/a to view this
content./div

How can I return say forinstance true or false , logged in or logged
out...or redirect to an action that returns and invokes a jQuery login
window??

Thanx in advance





-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: Ajax Authentication

2013-12-12 Thread Teddy Nyambe
I am trying to develop a one page ajax application using web2py. But the
problem i have is to manage the default redirection of annotated actions in
web2py. For instance:

@auth.requires_login()
def index():
...
return locals()

I have javascript in the main template that makes requests using $.ajax()
to the server. But web2py redirects the user to its defualt pages. How can
i disable this so that i can use my own ajax login/registration forms.

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: Online classes

2013-12-08 Thread Teddy Nyambe
Very helpful videos, but too big for download especially for some of us
with slow connections, downloaded two...three go!
On 8 Dec 2013 16:26, Massimo Di Pierro massimo.dipie...@gmail.com wrote:

 It would be great if you could edit the text and cut it into smaller
 parts. I am not recording it again. ;-)

 On Sunday, 8 December 2013 07:03:10 UTC-6, Mika Sjöman wrote:

 Hi

 Supper happy to see this!

 Two questions:
 1. could you cut them down a bit into smaller sections? 2.5 hour videos
 are a little bit too much to take in one time. 20 - 30 minutes max I would
 say is my personal attention span, preferably shorter.
 2. is it possible to make it more like coursera or udacity? Watch video
 (20 min), Practice with a quiz (write some short code to verify that I know
 the things), Answer a weekly quiz (after finishing 2.5h of video?).

 Cheers!

 On Tuesday, December 3, 2013 7:34:18 AM UTC+1, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with
 Python and I use web2py.
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and
 supported these classes.

 Massimo

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 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.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.


[web2py] REF: auth.login_bare() not working properly

2013-05-24 Thread Teddy Nyambe
I have a complete ajax application am building using DHTMLX client
framework. I am using all the controls from there. I have a login form
define in my app using DHTMLX  as follows:

*View:*
*
*
script
...

function loginForm() {
loginFrmConf = [
{type: settings, position: label-top, inputWidth: 205},
{type: input, name: username, label: Username },
{type: password, name: password, label: Password},
{type: button, name: login, value: Login, offsetTop:
20, align: right}
];
dhxLoginFrm = new dhtmlXForm(auth_details, loginFrmConf);
dhxLoginFrm.attachEvent(onButtonClick, function (id) {
if (id == login) {
dhxLoginFrm.send({{=URL('default', 'login')}},
function (loader, response) {
alert(Test:  + response);
});
}
});


/script

*Controller:*
*
*
def login():
if auth.login_bare(request.vars.username, request.vars.password):
return login success
else:
return Login failed

*Model:*
*
*
auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username']
auth.settings.remember_me_form = False
from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
   #manage_groups=True,
   #manage_user=True,
   #user_lastname_attrib='cn:2',
   db=db,
   #allowed_groups = ['committee_dept','library'],
   group_dn='DC=parliament,DC=gov,DC=zm',
   bind_dn = 'CN=admin,CN=Users,DC=mycompany,DC=org,DC=zm',
   bind_pw = 'password',
   group_name_attrib = 'cn',
   group_member_attrib = 'member',
   group_filterstr = 'objectClass=*',
   server='dc-hostname',
   base_dn='dc=mycomany,dc=org,dc=zm',
   logging_level='debug')]


The controller is able to authenticate to authenticate normally without any
problem, login is going through, but the session was no created. I have
also noticed that the authenticated user was not created in the auth.user
table. Is there something am missing in the use of auth.login_bare() above?



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Flash Message

2013-05-24 Thread Teddy Nyambe
is there a way of calling a flash message defined in web2py when an ajax
call is made...like the way it is in twitter

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Flash Message

2013-05-24 Thread Teddy Nyambe
Thanx
On 24 May 2013 15:38, Anthony abasta...@gmail.com wrote:

 If you are using an ajax component, then just set response.flash, and it
 will work automatically. For other ajax calls, I think you can trick web2py
 into treating it like a component (for flash message purposes) by setting
 request.cid=True (or setting it to any value that won't evaluate to
 False) -- that will cause web2py to add the message in response.flash to
 the web2py-component-flash response header, which will be used on the
 client side to display the message upon successful completion of the ajax
 call. Note, you can also manually set that header:

 import urllib2
 from gluon.html import xmlescape
 response.headers['web2py-component-flash'] = urllib2.quote(xmlescape(
 response.flash).replace('\n',''))

 Anthony

 On Friday, May 24, 2013 9:22:12 AM UTC-4, software.ted wrote:

 is there a way of calling a flash message defined in web2py when an ajax
 call is made...like the way it is in twitter

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.




-- 

--- 
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.




[web2py] REF: Bare Ajax Login

2013-05-23 Thread Teddy Nyambe
Is there a way of using a pure Ajax request to web2py authentication and
create a session for a successfully logged in user?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Bare Ajax Login

2013-05-23 Thread Teddy Nyambe
Of course read the book, auth.login_bare() manages my sessions
automatically? Will check it out thanx
On 23 May 2013 20:09, Anthony abasta...@gmail.com wrote:

 Basic authentication won't do anything with the session -- it requires
 sending the credentials on every request -- probably not what's desired
 here. Instead, the very next section in the book may help:
 http://www.web2py.com/book/default/chapter/09#Manual-Authentication. You
 can post the login credentials via Ajax and then use auth.login_bare() to
 handle the login.

 Anthony

 On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:

 You did read the book before you asked, yes?

 http://www.web2py.com/book/**default/chapter/09#Access-**
 Control-and-Basic-**Authenticationhttp://www.web2py.com/book/default/chapter/09#Access-Control-and-Basic-Authentication

 On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:

 Is there a way of using a pure Ajax request to web2py authentication and
 create a session for a successfully logged in user?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.




-- 

--- 
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: REF: Bare Ajax Login

2013-05-23 Thread Teddy Nyambe
Why I asked cause a 2 months or so Massimo contributed to a similar thread
and this is what he wrote:

Should we offer something like {{=auth.ajax_login()}} helper which submits
to /user/login? If would not be difficult to write.
How should it work?

The guy who hd asked a question on pure Ajax login had used
auth.login_bare() and from my assessment he seemed to hv challenges with it.
On 24 May 2013 05:46, Teddy Nyambe software@gmail.com wrote:

 Of course read the book, auth.login_bare() manages my sessions
 automatically? Will check it out thanx
 On 23 May 2013 20:09, Anthony abasta...@gmail.com wrote:

 Basic authentication won't do anything with the session -- it requires
 sending the credentials on every request -- probably not what's desired
 here. Instead, the very next section in the book may help:
 http://www.web2py.com/book/default/chapter/09#Manual-Authentication. You
 can post the login credentials via Ajax and then use auth.login_bare() to
 handle the login.

 Anthony

 On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:

 You did read the book before you asked, yes?

 http://www.web2py.com/book/**default/chapter/09#Access-**
 Control-and-Basic-**Authenticationhttp://www.web2py.com/book/default/chapter/09#Access-Control-and-Basic-Authentication

 On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:

 Is there a way of using a pure Ajax request to web2py authentication
 and create a session for a successfully logged in user?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.





-- 

--- 
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: REF: Bare Ajax Login

2013-05-23 Thread Teddy Nyambe
In addition, auth.login_bare() seems to check only with auth_user table, if
my authentication is based on LDAP it may not work. Any progress that has
been made  on auth.ajax_login()?
On 24 May 2013 05:58, Teddy Nyambe software@gmail.com wrote:

 Why I asked cause a 2 months or so Massimo contributed to a similar thread
 and this is what he wrote:

 Should we offer something like {{=auth.ajax_login()}} helper which submits
 to /user/login? If would not be difficult to write.
 How should it work?

 The guy who hd asked a question on pure Ajax login had used
 auth.login_bare() and from my assessment he seemed to hv challenges with it.
 On 24 May 2013 05:46, Teddy Nyambe software@gmail.com wrote:

 Of course read the book, auth.login_bare() manages my sessions
 automatically? Will check it out thanx
 On 23 May 2013 20:09, Anthony abasta...@gmail.com wrote:

 Basic authentication won't do anything with the session -- it requires
 sending the credentials on every request -- probably not what's desired
 here. Instead, the very next section in the book may help:
 http://www.web2py.com/book/default/chapter/09#Manual-Authentication.
 You can post the login credentials via Ajax and then use auth.login_bare()
 to handle the login.

 Anthony

 On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:

 You did read the book before you asked, yes?

 http://www.web2py.com/book/**default/chapter/09#Access-**
 Control-and-Basic-**Authenticationhttp://www.web2py.com/book/default/chapter/09#Access-Control-and-Basic-Authentication

 On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:

 Is there a way of using a pure Ajax request to web2py authentication
 and create a session for a successfully logged in user?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.





-- 

--- 
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.




[web2py] REF: Server Error being returned after db insert

2013-05-21 Thread Teddy Nyambe
I have this unusual behavior, this code adds data to the server quiet ok
but returns Server Error am expecting an integer

*#Controller*
*
*
def saveData():
insertID = db.mytable.insert(
field1= request.vars.field1,
field2 = request.vars.field2
)
return insertID

Data gets saved quiet well, but the insertID displays Server Error I was
thinking it returns an ID
-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Server Error being returned after db insert

2013-05-21 Thread Teddy Nyambe
Geish!!! how could i have missed that Thanx!



On Tue, May 21, 2013 at 2:45 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 def saveData():
 insertID = db.mytable.insert(
 field1= request.vars.field1,
 field2 = request.vars.field2
 )
 return str(insertID) ### must return a string not a Reference object.



 On Tuesday, 21 May 2013 07:44:11 UTC-5, software.ted wrote:

 I have this unusual behavior, this code adds data to the server quiet ok
 but returns Server Error am expecting an integer

 *#Controller*
 *
 *
 def saveData():
 insertID = db.mytable.insert(
 field1= request.vars.field1,
 field2 = request.vars.field2
 )
 return insertID

 Data gets saved quiet well, but the insertID displays Server Error I
 was thinking it returns an ID
 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Generate XML/JSON IN WEB2PY

2013-05-15 Thread Teddy Nyambe
Is there a way of generating XML or JSON in web2py say from a database.

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: DHTMLX Support

2013-05-06 Thread Teddy Nyambe
Hi All,

Whats could be the best way of using client DHTMLX framework in
web2py/python? I have noticed they have specific languages they are
supporting. Anyone with experience with it?

Its a pretty neat framework.!!!

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-26 Thread Teddy Nyambe
Thanx buddy!!! its working. I will go through the code and go through
Massimo's book and understand why it does not work when using ajax. I still
dont understand the code, but it works now.

Thanx a lot!


On Thu, Apr 25, 2013 at 5:37 PM, Leonel Câmara leonelcam...@gmail.comwrote:

 It's not working because you're doing something wrong. Probably because
 you're just copy pasting things without thinking.

 Here is an example of a working view using it, you can replace {{=form}}
 with your LOAD.

 {{extend 'layout.html'}}
 {{block head}}
 script src=http://malsup.github.com/jquery.form.js;/script
 script
 function web2py_trap_form(action,target) {
 jQuery('#'+target+' form').each(function(i){
 var form=jQuery(this);
 if(!form.hasClass('no_trap'))
 if(form.find('.upload').length0) {
 form.ajaxForm({
 url: action,
 success: function(data, statusText, xhr) {
 jQuery('#'+target).html(xhr.responseText);
 web2py_trap_form(action,target);
 web2py_ajax_init();
 }
 });
 } else {
 form.submit(function(e){
 jQuery('.flash').hide().html('');
 web2py_ajax_page('post',action,form.serialize(),target);
 e.preventDefault();
 });
 }
 });
 }
 /script
 {{end}}

 {{=form}}

 {{block extrascript}}
 script
 /* hack because jquery.form.js does not properly passes headers */
 jQuery('.flash').hide().html({{=response.flash}}).slideDown();
 eval({{=XML(response.js or '')}});
 /script
 {{end}}



 On Thu, Apr 25, 2013 at 2:16 PM, Teddy Nyambe software@gmail.comwrote:

 This is not cool, its giving me a weird behaviour and its not even
 working.


 On Thu, Apr 25, 2013 at 1:19 PM, Leonel Câmara leonelcam...@gmail.comwrote:

 You need to use some ajax file upload mechanism.

 Here's an example:

 http://www.web2pyslices.com/slice/show/1438/ajax-file-upload-in-loadweb2py-components

 If you follow that example, I recommend you put the javascript directly
 on the webpages that will use it so you don't have to deal with versions of
 web2py_ajax_page, etc. that are different from the regular web2py ones
 elsewhere.

 Quinta-feira, 25 de Abril de 2013 11:23:59 UTC+1, software.ted escreveu:

 I am having a nightmare getting file upload to work when the form is
 loaded using LOAD or component=(URL, tarrget=div). The file fails to be
 uploaded but the record is added to the DB without the file record. It does
 also not appear in the upload folder


 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/ggwmUyp8BEI/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.




  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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

Re: [web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-25 Thread Teddy Nyambe
Hey cheers!!! exactly what am looking for


On Thu, Apr 25, 2013 at 8:40 AM, Johann Spies johann.sp...@gmail.comwrote:

 What about using the keepvalues option:

 From the book:

 form.accepts(vars, session=None, formname='default',
  keepvalues=False, onvalidation=None,
  dbio=True, hideerror=False):

 Change keepvalues to True

 Regards
 Johann


 On 24 April 2013 18:23, Niphlod niph...@gmail.com wrote:

 I think you need to be more clear...either you want to:
 - add a new record -- if you want to preload default values you just
 have to set them beforehand
 - edit an existing record -- it's obvious that what you edit (and
 submit) has the same value of the next attempt to edit the same record


 On Wednesday, April 24, 2013 6:00:11 PM UTC+2, software.ted wrote:

 yah that exactly, but when you add a new record, the saved record does
 not show in the form. I want the fields to remain with saved content. Even
 when i use the example u have givenbut when i click on a button with an
 id with an existing record in the db it shows without any problem...when i
 make changes the record remains in the fields.


 On Wed, Apr 24, 2013 at 5:51 PM, Niphlod nip...@gmail.com wrote:

  you mean an edit form ?
 record = db.table(1)
 form = SQLFORM(db.table, record)



 On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:

 Is there a way to make the form generated by SQLFORM return the
 current fields saved in the DB instead of making the fields blank? What i
 want is to return the record.

 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






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

 --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Teddy Nyambe
I am having a nightmare getting file upload to work when the form is loaded
using LOAD or component=(URL, tarrget=div). The file fails to be uploaded
but the record is added to the DB without the file record. It does also not
appear in the upload folder


-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: File Upload does not work on a component loaded using ajax....

2013-04-25 Thread Teddy Nyambe
Thanx!!! will check it out.


On Thu, Apr 25, 2013 at 2:09 PM, Niphlod niph...@gmail.com wrote:

 http://web2py.com/books/default/chapter/29/12?search=uploads

 *Because Ajax post does not support multipart forms, i.e. file uploads,
 upload fields will not work with the LOAD component. You could be fooled
 into thinking it would work because upload fields will function normally if
 POST is done from the individual component's .load view. Instead, uploadsare 
 done with ajax-compatible 3rd-party widgets and web2py manual upload
 store commands.
 *

 On Thursday, April 25, 2013 5:58:07 AM UTC+2, software.ted wrote:

 I have experimented with this and i think there is something wrong...

 *Controllers*:

 def index():
  return locals()
 def post():
 form = SQLFORM(db.pics, upload=URL('download'))
 if form.process().accepted:
 response.flash = 'Data saved'
 elif form.process().accepted:
 response.flash = 'Error with form'
 return dict(form=form)
 def download():
 return response.download(request, db)

 Views:

 View-
-albums
  + index.html

 {{extend 'layout.html'}}

 {{=A('Upload Picture', component=URL('album','post.**load'),
 target='photo-space', _class='btn')}}
 div id=photo-space/div

 + post.load

 {{=form}}

 The funny thing is when if i access the post normally and not as a
 component the file is being uploaded and but as a component as shown in the
 code above, the image is not being uploaded and the database field for
 image is empty but the name of the picture is added.

 Any thought on this or its by design that its not working!?


 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Teddy Nyambe
This is not cool, its giving me a weird behaviour and its not even working.


On Thu, Apr 25, 2013 at 1:19 PM, Leonel Câmara leonelcam...@gmail.comwrote:

 You need to use some ajax file upload mechanism.

 Here's an example:

 http://www.web2pyslices.com/slice/show/1438/ajax-file-upload-in-loadweb2py-components

 If you follow that example, I recommend you put the javascript directly on
 the webpages that will use it so you don't have to deal with versions of
 web2py_ajax_page, etc. that are different from the regular web2py ones
 elsewhere.

 Quinta-feira, 25 de Abril de 2013 11:23:59 UTC+1, software.ted escreveu:

 I am having a nightmare getting file upload to work when the form is
 loaded using LOAD or component=(URL, tarrget=div). The file fails to be
 uploaded but the record is added to the DB without the file record. It does
 also not appear in the upload folder


 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: File Upload does not work on a component loaded using ajax....

2013-04-25 Thread Teddy Nyambe
Can I have an example looked at a slice it does not work either!


On Thu, Apr 25, 2013 at 2:18 PM, Teddy Nyambe software@gmail.comwrote:

 Thanx!!! will check it out.


 On Thu, Apr 25, 2013 at 2:09 PM, Niphlod niph...@gmail.com wrote:

 http://web2py.com/books/default/chapter/29/12?search=uploads

 *Because Ajax post does not support multipart forms, i.e. file uploads,
 upload fields will not work with the LOAD component. You could be fooled
 into thinking it would work because upload fields will function normally if
 POST is done from the individual component's .load view. Instead, uploadsare 
 done with ajax-compatible 3rd-party widgets and web2py manual upload
 store commands.
 *

 On Thursday, April 25, 2013 5:58:07 AM UTC+2, software.ted wrote:

 I have experimented with this and i think there is something wrong...

 *Controllers*:

 def index():
  return locals()
 def post():
 form = SQLFORM(db.pics, upload=URL('download'))
 if form.process().accepted:
 response.flash = 'Data saved'
 elif form.process().accepted:
 response.flash = 'Error with form'
 return dict(form=form)
 def download():
 return response.download(request, db)

 Views:

 View-
-albums
  + index.html

 {{extend 'layout.html'}}

 {{=A('Upload Picture', component=URL('album','post.**load'),
 target='photo-space', _class='btn')}}
 div id=photo-space/div

 + post.load

 {{=form}}

 The funny thing is when if i access the post normally and not as a
 component the file is being uploaded and but as a component as shown in the
 code above, the image is not being uploaded and the database field for
 image is empty but the name of the picture is added.

 Any thought on this or its by design that its not working!?


 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Teddy Nyambe
Is there a way to make the form generated by SQLFORM return the current
fields saved in the DB instead of making the fields blank? What i want is
to return the record.

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Generated SQLFORM form behavior sought

2013-04-24 Thread Teddy Nyambe
yah that exactly, but when you add a new record, the saved record does not
show in the form. I want the fields to remain with saved content. Even when
i use the example u have givenbut when i click on a button with an id
with an existing record in the db it shows without any problem...when i
make changes the record remains in the fields.


On Wed, Apr 24, 2013 at 5:51 PM, Niphlod niph...@gmail.com wrote:

 you mean an edit form ?
 record = db.table(1)
 form = SQLFORM(db.table, record)



 On Wednesday, April 24, 2013 5:35:18 PM UTC+2, software.ted wrote:

 Is there a way to make the form generated by SQLFORM return the current
 fields saved in the DB instead of making the fields blank? What i want is
 to return the record.

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: File Upload does not work on a component loaded using ajax....

2013-04-24 Thread Teddy Nyambe
I have experimented with this and i think there is something wrong...

*Controllers*:

def index():
 return locals()
def post():
form = SQLFORM(db.pics, upload=URL('download'))
if form.process().accepted:
response.flash = 'Data saved'
elif form.process().accepted:
response.flash = 'Error with form'
return dict(form=form)
def download():
return response.download(request, db)

Views:

View-
   -albums
 + index.html

{{extend 'layout.html'}}

{{=A('Upload Picture', component=URL('album','post.load'),
target='photo-space', _class='btn')}}
div id=photo-space/div

+ post.load

{{=form}}

The funny thing is when if i access the post normally and not as a
component the file is being uploaded and but as a component as shown in the
code above, the image is not being uploaded and the database field for
image is empty but the name of the picture is added.

Any thought on this or its by design that its not working!?


-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] Ref: Calling SQLFORM in modal passing an ID

2013-04-23 Thread Teddy Nyambe
How possible is it to call an SQLFORM in a Twitter bootstrap modal, where a
pressed button passes an ID loading specific data. Tried using LOAD() with
no success.

-- 

--- 
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] SQL Server Web2Py basic question

2013-04-23 Thread Teddy Nyambe
SQL Server u mean? MySql server or MS SQL Server? In web2py if ku use DAL
object all queries r the same
On 23 Apr 2013 18:00, v1s vineeth.vasude...@gmail.com wrote:

 Can someone help me by giving me an example on how to connect to SQL
server using web2py, select records from a table and display it.

 I am not able to get any specific examples with regard to SQL server.
Sorry if my question is very basic/broad..Thanks in advance!


 Thanks


 PS: I think I posted the same question as Ask a question. Sorry for
double posting

 --

 ---
 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.



-- 

--- 
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: REF: Component + Javascript

2013-04-18 Thread Teddy Nyambe
Ok let me start simple see where i get. Will share what i get


On Thu, Apr 18, 2013 at 9:34 AM, Niphlod niph...@gmail.com wrote:

 you can't load a html fragment at wish. The second LOAD is found, it
 triggers the loading: it's not the way to do it.

 Still, until you can't find out why you can't attach an event to your
 button, all the remains of the discussion is useless: let's start simple
 (single button in the page), then go all the way up to your grid, finding
 where your event gets not fired.


 On Thursday, April 18, 2013 7:48:37 AM UTC+2, software.ted wrote:

 The button has a href=#mymodal calling a modal window. What I want is
 to pass an ID to the modal window. I have a LOAD() in the modal window. so
 in essence the situation is i have a grid listing with each row a button,
 then click a button calls a modal window which has a div
 id=mp_xx{{=LOAD('c','a', args='x')}}/div. Now when a user clicks on
 the button i want to change the contents of the div using
 jQuery('#id_xx').html({{=**LOAD('c','a', args=var)}}). Maybe there is
 another way of doing this??? Please advise.


 On Wed, Apr 17, 2013 at 2:18 PM, Niphlod nip...@gmail.com wrote:

 are you sure that the button has not yet an event attached that prevents
 your custom one ?


 On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(**functi**on(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the Text in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id =
 'mp_257', _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
I have a component am loading in a div
div id=test/div
{{=A('Link to comp', component=URL('research', 'mycomponent.load'),
target='setting-content')}}

div class=span8 id=setting-content

 /div

in this same view page i have a javascript

script type=text/javascript
  jQuery('#mp_257').click(function(){
jQuery('#test').html('Test')
//alert(Test)
  })
/script

The component has a button with an id=mp_257, but when i click on it,
jQuery in the view above is not being executed by replacing the Text in
the div...the component has a grid with a custom button created as follows:

links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', _id
= 'mp_257', _class='btn')]

Anything why this is not working? But when I put the button in the view
using:

{{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id = 'mp_257',
_class='btn')}}

All works fine, is there something about loaded component that prevents
running of javascript in the same page?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
No luck, still quiet no activity. How can i debug jQuery?


On Wed, Apr 17, 2013 at 12:20 PM, Niphlod niph...@gmail.com wrote:

 you're attaching a jquery event to an element that when the script is
 executed is not yet present (it's loading...)

 try to rewrite your

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 to

 script type=text/javascript
   jQuery(document).on('click', '#mp_257', function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script



 On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the Text in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'**), 'Personal Details', _id = 'mp_257',
 _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
The button has a href=#mymodal calling a modal window. What I want is to
pass an ID to the modal window. I have a LOAD() in the modal window. so in
essence the situation is i have a grid listing with each row a button, then
click a button calls a modal window which has a div
id=mp_xx{{=LOAD('c','a', args='x')}}/div. Now when a user clicks on
the button i want to change the contents of the div using
jQuery('#id_xx').html({{=LOAD('c','a', args=var)}}). Maybe there is
another way of doing this??? Please advise.


On Wed, Apr 17, 2013 at 2:18 PM, Niphlod niph...@gmail.com wrote:

 are you sure that the button has not yet an event attached that prevents
 your custom one ?


 On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the Text in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'**), 'Personal Details', _id = 'mp_257',
 _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Trying out matplotlib

2013-04-08 Thread Teddy Nyambe
Massimo, maybe to bring this issue to a close for me and others who may be
interested in using matplotlib in the shortest future, since you have
successfully used matplotlib could you post just a few lines of called
addressing challenges:

1. Installation of Matplotlib

On the Mac os x i did sudo pip install matplotlib it seemed to install well
the 1.2.1 version without a problem but import matplotlib is giving an error

2. After successful installation, how is matplot lib used in the web2py
controller modules what is the best practice...one or two lines of code
would surfice.

Kind regards,


On Sat, Apr 6, 2013 at 6:25 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 When you use matplolib you should use the pylab APIs. this is because they
 assume a persistant state to emulate a matlab notebook. This persistance is
 a problem in web applications. First of all you have many concurrent
 requests and they may interere with each other (not sure but I do not know
 how pylab is implemented) and if you use it in a module the state may be
 lost. Use the matplotlib API instead.

 On Thursday, 4 April 2013 10:49:05 UTC-5, software.ted wrote:

 I have installed matplotlib but when i try:

 from pylab import *


 am having this error:

  from pylab import *
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/pylab.**py, line 1, in module
 from matplotlib.pylab import *
   File /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/**matplotlib/pylab.py, line 222, in module
 from matplotlib import mpl  # pulls in most modules
   File /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/**matplotlib/mpl.py, line 1, in module
 from matplotlib import artist
   File /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/**matplotlib/artist.py, line 7, in module
 from transforms import Bbox, IdentityTransform, TransformedBbox, \
   File /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/**matplotlib/transforms.py, line 35, in module
 from matplotlib._path import (affine_transform,
 count_bboxes_overlapping_bbox,
 ImportError: dlopen(/Library/Frameworks/**Python.framework/Versions/2.7/*
 *lib/python2.7/site-packages/**matplotlib/_path.so, 2): no suitable
 image found.  Did find:
 /Library/Frameworks/Python.**framework/Versions/2.7/lib/**
 python2.7/site-packages/**matplotlib/_path.so: no matching architecture
 in universal wrapper


 I am trying to use it to draw a pie chart as in this example

 from pylab import *
 # make a square figure and axesfigure(1, figsize=(6,6))ax = axes([0.1, 0.1, 
 0.8, 0.8])
 # The slices will be ordered and plotted counter-clockwise.labels = 'Frogs', 
 'Hogs', 'Dogs', 'Logs'fracs = [15, 30, 45, 10]explode=(0, 0.05, 0, 0)
 pie(fracs, explode=explode, labels=labels,
 autopct='%1.1f%%', shadow=True, startangle=90)
 # The default startangle is 0, which would start
 # the Frogs slice on the x-axis.  With startangle=90,
 # everything is rotated counter-clockwise by 90 degrees,
 # so the plotting starts on the positive y-axis.
 title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
 show()

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: weired behaviour of matplotlib in web2py

2013-04-06 Thread Teddy Nyambe
Web2py - 2.4.2
Python - 2.7.3
Matplotlib - 1.1.0

Massimo could you post some sample code on how to use matplotlib in web2py
as well.

Teddy L.


On Fri, Apr 5, 2013 at 11:27 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I have been using matplotlib and never seen this. What version of
 web2py/python/matplotlib?


 On Friday, 5 April 2013 05:06:23 UTC-5, software.ted wrote:

 I have this code:

 import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt

 ## Graphs
 fig = plt.figure(1, figsize=(6,6))
 ax = fig.add_axes([0.1,0.1,0.8,0.8]**)

 labels = 'Female', 'Male'

 fracs = [90,10]
 explode=(0,0.05,0,0)

 ax.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)

 fig.savefig('test.png')


 in web2py the generated image keeps being update, when i change the fracs
 the image is not recreated but its just update adding new sectors and
 percentages. But the same code run on the command line when rerun it
 recreates the image anew with new sector percentage...this is weired
 behaviour, is there anything am missing out or i shoudl do in web2py

 This is how the image is being updated in web2py:

 [image: Inline image 1]
 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Matplotlib Image

2013-04-05 Thread Teddy Nyambe
I have the following code:

fig = plt.figure(1, figsize=(6,6))
ax = fig.add_axes([0.1,0.1,0.8,0.8])

labels = 'Female', 'Male'

fracs = [50,50]

ax.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)
 image_folder=os.path.join(request.folder, 'static/tmp/')
fig.savefig('%stest.png' % image_folder)
return dict(mp_list=mp_list, image_folder= '/init/static/tmp/test.png')

The problem is that the image keeps on being overeritten when i change the
fracs. How do i create a new image each time i refresh the page?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Pie/bar Charts

2013-04-04 Thread Teddy Nyambe
whats the easiest way to create a pie/bar chart using web2py/python, i was
attempting to use pycha with cairo/pycairo libraries with very little
success, failed to install pycairo on the mac all the googled exmaples not
working.

Any ideas?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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] REF: Pie/bar Charts

2013-04-04 Thread Teddy Nyambe
pygooglechart looks easy, but have a small issue with web2py.

I did:

easy_install pygooglechart

on the python prompt the module is being imported:

Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type help, copyright, credits or license for more information.
 import pygooglechart
 help(pygooglechart)

Help on module pygooglechart:

NAME
pygooglechart - pygooglechart - A complete Python wrapper for the
Google Chart API

FILE

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygooglechart-0.3.0-py2.7.egg/pygooglechart.py


 but under web2py the import is giving the following error:

In [2] : import pygooglechart
Traceback (most recent call last):
  File /Users/teddyl/Documents/src/web2py/gluon/contrib/shell.py, line
234, in run
exec compiled in statement_module.__dict__
  File string, line 1, in module
  File /Users/teddyl/Documents/src/web2py/gluon/custom_import.py, line
81, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'pygooglechart'


Any ideas!?

On Thu, Apr 4, 2013 at 3:42 PM, Javier Pepe javierp...@gmail.com wrote:

 Hello

 I am use http://pygooglechart.slowchop.com/

 Is very simple, create a file, a use then in the view.




 On Thu, Apr 4, 2013 at 10:37 AM, Teddy Nyambe software@gmail.comwrote:

 whats the easiest way to create a pie/bar chart using web2py/python, i
 was attempting to use pycha with cairo/pycairo libraries with very little
 success, failed to install pycairo on the mac all the googled exmaples not
 working.

 Any ideas?

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 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.




  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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] REF: Pie/bar Charts

2013-04-04 Thread Teddy Nyambe
Ok looks like i needed to restart web2py!! its ok now.


On Thu, Apr 4, 2013 at 4:07 PM, Teddy Nyambe software@gmail.com wrote:

 pygooglechart looks easy, but have a small issue with web2py.

 I did:

 easy_install pygooglechart

 on the python prompt the module is being imported:

 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type help, copyright, credits or license for more information.
  import pygooglechart
  help(pygooglechart)

 Help on module pygooglechart:

 NAME
 pygooglechart - pygooglechart - A complete Python wrapper for the
 Google Chart API

 FILE

 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygooglechart-0.3.0-py2.7.egg/pygooglechart.py


  but under web2py the import is giving the following error:

 In [2] : import pygooglechart
 Traceback (most recent call last):
   File /Users/teddyl/Documents/src/web2py/gluon/contrib/shell.py, line
 234, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
   File /Users/teddyl/Documents/src/web2py/gluon/custom_import.py, line
 81, in custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'pygooglechart'


 Any ideas!?

 On Thu, Apr 4, 2013 at 3:42 PM, Javier Pepe javierp...@gmail.com wrote:

 Hello

 I am use http://pygooglechart.slowchop.com/

 Is very simple, create a file, a use then in the view.




 On Thu, Apr 4, 2013 at 10:37 AM, Teddy Nyambe software@gmail.comwrote:

 whats the easiest way to create a pie/bar chart using web2py/python, i
 was attempting to use pycha with cairo/pycairo libraries with very little
 success, failed to install pycairo on the mac all the googled exmaples not
 working.

 Any ideas?

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 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.




  --

 ---
 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.






 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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] REF: Pie/bar Charts

2013-04-04 Thread Teddy Nyambe
The image is generated at google.com, what if there is no internet? this is
not good will be operating also in off-line modesbut like the
simplicity.


On Thu, Apr 4, 2013 at 4:16 PM, Teddy Nyambe software@gmail.com wrote:

 Ok looks like i needed to restart web2py!! its ok now.


 On Thu, Apr 4, 2013 at 4:07 PM, Teddy Nyambe software@gmail.comwrote:

 pygooglechart looks easy, but have a small issue with web2py.

 I did:

 easy_install pygooglechart

 on the python prompt the module is being imported:

 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type help, copyright, credits or license for more information.
  import pygooglechart
  help(pygooglechart)

 Help on module pygooglechart:

 NAME
 pygooglechart - pygooglechart - A complete Python wrapper for the
 Google Chart API

 FILE

 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygooglechart-0.3.0-py2.7.egg/pygooglechart.py


  but under web2py the import is giving the following error:

 In [2] : import pygooglechart
  Traceback (most recent call last):
   File /Users/teddyl/Documents/src/web2py/gluon/contrib/shell.py, line
 234, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
   File /Users/teddyl/Documents/src/web2py/gluon/custom_import.py, line
 81, in custom_importer
 raise ImportError, 'Cannot import module %s' % str(e)
 ImportError: Cannot import module 'pygooglechart'


 Any ideas!?

 On Thu, Apr 4, 2013 at 3:42 PM, Javier Pepe javierp...@gmail.com wrote:

 Hello

 I am use http://pygooglechart.slowchop.com/

 Is very simple, create a file, a use then in the view.




 On Thu, Apr 4, 2013 at 10:37 AM, Teddy Nyambe software@gmail.comwrote:

 whats the easiest way to create a pie/bar chart using web2py/python, i
 was attempting to use pycha with cairo/pycairo libraries with very little
 success, failed to install pycairo on the mac all the googled exmaples not
 working.

 Any ideas?

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 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.




  --

 ---
 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.






 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~




 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: Database Migration

2013-04-03 Thread Teddy Nyambe
I have this error:

Database db https://192.168.0.251/init/appadmin/index selectTraceback

Traceback (most recent call last):
  File /home/www-data/web2py/applications/init/controllers/appadmin.py,
line 232, in select
limitby=(start, stop))
  File /home/www-data/web2py/gluon/dal.py, line 9769, in select
return adapter.select(self.query,fields,attributes)
  File /home/www-data/web2py/gluon/dal.py, line 1680, in select
return self._select_aux(sql,fields,attributes)
  File /home/www-data/web2py/gluon/dal.py, line 1645, in _select_aux
self.execute(sql)
  File /home/www-data/web2py/gluon/dal.py, line 1758, in execute
return self.log_execute(*a, **b)
  File /home/www-data/web2py/gluon/dal.py, line 1752, in log_execute
ret = self.cursor.execute(*a, **b)
  File /home/www-data/web2py/gluon/contrib/pymysql/cursors.py, line
117, in execute
self.errorhandler(self, exc, value)
  File /home/www-data/web2py/gluon/contrib/pymysql/connections.py,
line 202, in defaulterrorhandler
raise errorclass, errorvalue
InternalError: (1054, uUnknown column 'auth_user.title' in 'field list')




I have tried:

db = DAL(..., fake_migrate_all=True)

I have two copies of web2py running one production the other development. I
have added a title, photo fields to the auth_user table using:

auth.settings.extra_fields['auth_user']= [
  Field('title', requires = IS_IN_SET(['Mr.', 'Dr.', 'Mrs.', 'Ms.',
'Prof.', 'Maj.', 'Rev.', 'Lt.', 'Capt.', 'Col.','Lt. Col.', 'Brig-General',
'Lt-Gen.'])),
  Field('photo', 'upload')]

The development side its working all well but after uninstalling the
production application and installing a new application using the
production database it gives the error above.

Any ideas.
-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Database Migration

2013-04-03 Thread Teddy Nyambe
I have tried both:

auth.define_tables(username=True, signature=False, fake_migrate=True)

and

auth.define_tables(username=True, signature=False, migrate=True)

But the error still persists maybe i delete the table from the db?

Any more ideas?


On Wed, Apr 3, 2013 at 3:29 PM, Niphlod niph...@gmail.com wrote:

 mind that auth.define_tables() takes migrate parameter(s) on its own,
 not respecting some of the DAL(...) ones.


 On Wednesday, April 3, 2013 2:53:02 PM UTC+2, software.ted wrote:

 I have this error:

 Database db https://192.168.0.251/init/appadmin/index select Traceback

 Traceback (most recent call last):
   File 
 /home/www-data/web2py/**applications/init/controllers/**appadmin.py, line 
 232, in select
 limitby=(start, stop))
   File /home/www-data/web2py/gluon/**dal.py, line 9769, in select
 return adapter.select(self.query,**fields,attributes)
   File /home/www-data/web2py/gluon/**dal.py, line 1680, in select
 return self._select_aux(sql,fields,**attributes)
   File /home/www-data/web2py/gluon/**dal.py, line 1645, in _select_aux
 self.execute(sql)
   File /home/www-data/web2py/gluon/**dal.py, line 1758, in execute
 return self.log_execute(*a, **b)
   File /home/www-data/web2py/gluon/**dal.py, line 1752, in log_execute
 ret = self.cursor.execute(*a, **b)
   File /home/www-data/web2py/gluon/**contrib/pymysql/cursors.py, line 117, 
 in execute
 self.errorhandler(self, exc, value)
   File /home/www-data/web2py/gluon/**contrib/pymysql/connections.**py, 
 line 202, in defaulterrorhandler
 raise errorclass, errorvalue
 InternalError: (1054, uUnknown column 'auth_user.title' in 'field list')




 I have tried:

 db = DAL(..., fake_migrate_all=True)

 I have two copies of web2py running one production the other development.
 I have added a title, photo fields to the auth_user table using:

 auth.settings.extra_fields['**auth_user']= [
   Field('title', requires = IS_IN_SET(['Mr.', 'Dr.', 'Mrs.', 'Ms.',
 'Prof.', 'Maj.', 'Rev.', 'Lt.', 'Capt.', 'Col.','Lt. Col.', 'Brig-General',
 'Lt-Gen.'])),
   Field('photo', 'upload')]

 The development side its working all well but after uninstalling the
 production application and installing a new application using the
 production database it gives the error above.

 Any ideas.
 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: Web2Py support on roadmap for pycharm 3

2013-03-25 Thread Teddy Nyambe
Finally this is great news!!!This is one of the missing puzzles of the
treasure of web2py!!!


On Tue, Mar 26, 2013 at 4:43 AM, samuel bonilla pythonn...@gmail.comwrote:

 good news.

 El lunes, 25 de marzo de 2013 14:57:38 UTC-5, Shawn McElroy escribió:

 Just wanted to share, it looks like Web2Py is finally on the pycharm 3
 roadmap. Article was posted today:

 http://confluence.jetbrains.**com/display/PYH/PyCharm+3.0+**Roadmaphttp://confluence.jetbrains.com/display/PYH/PyCharm+3.0+Roadmap

 http://blog.jetbrains.com/**pycharm/2013/03/check-out-the-**
 pycharm-3-0-roadmap/?utm_**source=feedburnerutm_medium=**
 feedutm_campaign=Feed%3A+**Pycharm+%28JetBrains+PyCharm+**Blog%29http://blog.jetbrains.com/pycharm/2013/03/check-out-the-pycharm-3-0-roadmap/?utm_source=feedburnerutm_medium=feedutm_campaign=Feed%3A+Pycharm+%28JetBrains+PyCharm+Blog%29

 This is awesome i think for the web2py community. I think this will help
 people get into it as well. heres to them getting it implemented *cheers*

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Upload of Files

2013-03-22 Thread Teddy Nyambe
Ok great and thanks for all your help, the file is being saved and all
works as expected!!! code that works below:

def index():
form = SQLFORM.factory(Field(first_name),Field(quotes_file,
upload, uploadfolder=os.path.join(request.folder, 'uploads')))
test = ''
first_name = ''
if request.vars.first_name:
first_name = My test
if isinstance(request.vars.quotes_file, cgi.FieldStorage):
test = My File
if form.process().accepted:
response.flash = Data Saved
elif form.errors:
response.flash = Form has error
return locals()


On Fri, Mar 22, 2013 at 1:21 AM, Anthony abasta...@gmail.com wrote:

 Recall that the suggestions to forego calling form.process() and instead
 just check for and directly manipulate request.vars.quotes_file was
 assuming you did not want to permanently store the file. If you do want to
 keep the file, then you should call form.process() (or include code to
 manually save the file). However, it's not clear that you do really need to
 keep the file. Presumably whatever code you plan to use to process and
 store the data would first open the file and then work with the open file
 object -- instead, you should be able to work with the FieldStorage file
 object directly (i.e., request.vars.quotes_file.file).

 Anthony


 On Thursday, March 21, 2013 2:01:01 PM UTC-4, software.ted wrote:

 But the question again is where is the file stored, its not appearing in
 the specified uploads directory for manipulation. What I want to do is
 upload an excel sheet with specific columns of data, then get the data and
 insert into db with similar columns
 On Mar 21, 2013 6:48 PM, Anthony abas...@gmail.com wrote:

 if request.vars.quotes_file:


 Sorry, I didn't realize this, but apparently if you do if
 [cgi.FieldStorage object] you get False rather than True, so instead try:

 if hasattr(request.vars.quotes_**file, file):

 or

 import cgi
 if isinstance(request.vars.quotes**_file, cgi.FieldStorage)



 I have further noticed this error in the page source after making a
 submit:


 var ajax_error_500 = 'An error occured, please a
 href=/testapp/default/index?**f**irst_name=bggfbfgamp;quotes_**f**
 ile=FieldStorage%28%27quotes_**f**ile%27%2C+%27rows+%282%29.**csv%**
 27%2C+%27circular.**circular_no%**2Ccircular.**recipients%**2Ccircular.
 **circular_title%**2Ccircular.**circular_date%5Cr%**5CnNAZ%2F1%**
 2F2013%2CALL+**MEMBERS+OF+STAFF%**2CLunch+to+**be+served+at+the+**
 Motel%2C2013-**03-01%5Cr%5Cn%27%**29reload/**a the page'


 That is not an error -- it is just a Javascript variable that is
 automatically generated by web2py_ajax.html. It is there in case there is
 an Ajax error on the page, in which case it will be used to generate an
 error message. However, I notice there is an error in the code used to
 generate that variable -- it should not be including post_vars in the link
 URL, only get_vars (I have submitted a patch to correct that).

 Anthony

 --

 ---
 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+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .



  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Upload of Files

2013-03-21 Thread Teddy Nyambe
Anthony,

I have noticed an error in the code. I have created a very simple form to
test the upload without using components. The code is as follows:

Controller:
=
def index():
form = SQLFORM.factory(Field(first_name),Field(quotes_file,
upload, uploadfolder=os.path.join(request.folder, 'uploads')))
test = ''
first_name = ''
if request.vars.first_name:
first_name = My test
if request.vars.quotes_file:
test = My File
return locals()

View:
==
{{extend 'layout.html'}}br
File: {{=test}}br

First name: {{=first_name}}
{{=form}}
{{=BEAUTIFY(request.vars)}}

When i submit the form with a file attached the beautify displays the file
content and the value for first_name.

But, the value for test = My File is not being displayed in the view,
while the first_name = My test is being displayed without any problem.

I have further noticed this error in the page source after making a submit:

script type=text/javascript!-- // These variables are used by the
web2py_ajax_init function in web2py_ajax.js (which is loaded below). var
w2p_ajax_confirm_message = Are you sure you want to delete this
object?;var w2p_ajax_date_format = %Y-%m-%d;var
w2p_ajax_datetime_format = %Y-%m-%d %H:%M:%S;var ajax_error_500 =
'An error occured, please a
href=/testapp/default/index?first_name=bggfbfgamp;quotes_file=FieldStorage%28%27quotes_file%27%2C+%27rows+%282%29.csv%27%2C+%27circular.circular_no%2Ccircular.recipients%2Ccircular.circular_title%2Ccircular.circular_date%5Cr%5CnNAZ%2F1%2F2013%2CALL+MEMBERS+OF+STAFF%2CLunch+to+be+served+at+the+Motel%2C2013-03-01%5Cr%5Cn%27%29reload/a
the page' //--/script

any idea on whats going on here?


On Wed, Mar 20, 2013 at 9:01 PM, Teddy Nyambe software@gmail.comwrote:

 Actually this this is how am loading it, please advise:

 {{=A('Quotes', component=URL('quotes','quotes.loadp ),
 target='quote-content')}}

 div id='quote-content'/div

 One funny thing is when I add a simple text field to the SQLFORM.factory
 and submit sample content...its displayed...only for upload is not showing.
 On Mar 20, 2013 4:23 PM, Anthony abasta...@gmail.com wrote:

 Did you set ajax=True or ajax_trap=True in your LOAD() call? If not, the
 form will get posted to the action of the containing page, not the
 component action.

 Anthony

 On Wednesday, March 20, 2013 10:06:28 AM UTC-4, software.ted wrote:

 Anthony,

 Am having a very funny behavior. I am loading a form in a component
 quotes.load in another page of a div.
 When i access the component directly through the URL address the
 {{=BEAUTIFY(request.vars)}} am able to see the uploaded file, but accessing
 it through the component its sending empty quotes upload file note the code:

 controller

 def quotes():
 form = SQLFORM.factory(Field(first_**name), Field(quotes,
 upload, uploadfolder=os.path.join(**request.folder,'uploads')))

 file_name=

 first_name = 

 if request.vars.quotes:
   file_name=test

 if request.vars.first_name:
 first_name = Testing

 return dict(form=form, file_name = file_name, first_name =
 first_name)





 view::

 First name is: {{=file_name}}br

 {{=form}}br

 First name is:{{=first_name}}

 filename is returning empty all the time.


 On Wed, Mar 20, 2013 at 3:21 PM, Anthony abas...@gmail.com wrote:

 As is, your code should generate an error because you haven't specified
 an upload folder, which is required when passing new Field objects to
 SQLFORM.factory. Try:

 import os
 SQLFORM.factory(Field(quotes**, upload, uploadfolder=os.path.
 join(requ**est.folder, 'uploads')))

 If you don't want to save the file at all, though, then don't call
 form.process(). Instead, just check for the uploaded file:

 if request.vars.quotes:
 manage_quotes(request.vars.quo**tes.file)

 Anthony

 On Wednesday, March 20, 2013 8:30:29 AM UTC-4, software.ted wrote:

 I want to upload a file to web2py and then manipulate it. I dont want
 to save it into the database...after manipulating it i want to delete it.
 How do i do that. I have been trying like this but all fails:

 Controller:

 def quotes():
 form = SQLFORM.factory(Field(quotes, upload)
 if form.process().accepted:
 manage_quotes(form.vars.**quotes**)
 elif form.errors:
 response.flash = form has error

 After upload I cannot see the uploaded in the upload folder!

 regards



 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving

[web2py] Ref: Problem with simple file upload

2013-03-21 Thread Teddy Nyambe
This is a repost cause it did not receive much feedback.

I have noticed an error in the code below. The book emphasises on upload
file storage in the db, but what about simple upload and manipulation.

I have created a very simple form to test the upload without using
components. The code is as follows:

Controller: = def index():
 form = SQLFORM.factory(Field(first_ name),Field(quotes_file,
upload, uploadfolder=os.path.join(request.folder, 'uploads'))) test = ''
first_name = '' if request.vars.first_name: first_name = My test if
request.vars.quotes_file: test = My File
return locals()

View: ==

{{extend 'layout.html'}}br File: {{=test}}br

First name: {{=first_name}} {{=form}} {{=BEAUTIFY(request.vars)}}

When i submit the form with a file attached the beautify displays the file
content and the value for first_name.

But, the value for test = My File is not being displayed in the view,
while the first_name = My test is being displayed without any problem.

I have further noticed this error in the page source after making a submit:

script type=text/javascript!--// These variables are used by the
web2py_ajax_init function in web2py_ajax.js (which is loaded below). var
w2p_ajax_confirm_message = Are you sure you want to delete this object?;
var w2p_ajax_date_format = %Y-%m-%d; var w2p_ajax_datetime_format =
%Y-%m-%d %H:%M:%S; var ajax_error_500 = 'An error occured, please a
href=/testapp/default/index? first_name=bggfbfgamp;quotes_
file=FieldStorage%28%27quotes_ file%27%2C+%27rows+%282%29.
csv%27%2C+%27circular. circular_no%2Ccircular. recipients%2Ccircular.
circular_title%2Ccircular. circular_date%5Cr%5CnNAZ%2F1%
2F2013%2CALL+MEMBERS+OF+STAFF% 2CLunch+to+be+served+at+the+
Motel%2C2013-03-01%5Cr%5Cn%27% 29reload/a the page' //--/script

any idea on whats going on here?

-- 

--- 
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: REF: Upload of Files

2013-03-21 Thread Teddy Nyambe
But the question again is where is the file stored, its not appearing in
the specified uploads directory for manipulation. What I want to do is
upload an excel sheet with specific columns of data, then get the data and
insert into db with similar columns
On Mar 21, 2013 6:48 PM, Anthony abasta...@gmail.com wrote:

 if request.vars.quotes_file:


 Sorry, I didn't realize this, but apparently if you do if
 [cgi.FieldStorage object] you get False rather than True, so instead try:

 if hasattr(request.vars.quotes_file, file):

 or

 import cgi
 if isinstance(request.vars.quotes_file, cgi.FieldStorage)



 I have further noticed this error in the page source after making a
 submit:


 var ajax_error_500 = 'An error occured, please a
 href=/testapp/default/index?**first_name=bggfbfgamp;quotes_**
 file=FieldStorage%28%27quotes_**file%27%2C+%27rows+%282%29.**
 csv%27%2C+%27circular.**circular_no%2Ccircular.**recipients%2Ccircular.**
 circular_title%2Ccircular.**circular_date%5Cr%5CnNAZ%2F1%**
 2F2013%2CALL+MEMBERS+OF+STAFF%**2CLunch+to+be+served+at+the+**
 Motel%2C2013-03-01%5Cr%5Cn%27%**29reload/a the page'


 That is not an error -- it is just a Javascript variable that is
 automatically generated by web2py_ajax.html. It is there in case there is
 an Ajax error on the page, in which case it will be used to generate an
 error message. However, I notice there is an error in the code used to
 generate that variable -- it should not be including post_vars in the link
 URL, only get_vars (I have submitted a patch to correct that).

 Anthony

 --

 ---
 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.




-- 

--- 
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.




[web2py] REF: Upload of Files

2013-03-20 Thread Teddy Nyambe
I want to upload a file to web2py and then manipulate it. I dont want to
save it into the database...after manipulating it i want to delete it. How
do i do that. I have been trying like this but all fails:

Controller:

def quotes():
form = SQLFORM.factory(Field(quotes, upload)
if form.process().accepted:
manage_quotes(form.vars.quotes)
elif form.errors:
response.flash = form has error

After upload I cannot see the uploaded in the upload folder!

regards



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Upload of Files

2013-03-20 Thread Teddy Nyambe
Anthony,

Am having a very funny behavior. I am loading a form in a component
quotes.load in another page of a div.
When i access the component directly through the URL address the
{{=BEAUTIFY(request.vars)}} am able to see the uploaded file, but accessing
it through the component its sending empty quotes upload file note the code:

controller

def quotes():
form = SQLFORM.factory(Field(first_name), Field(quotes, upload,
uploadfolder=os.path.join(request.folder,'uploads')))

file_name=

first_name = 

if request.vars.quotes:
  file_name=test

if request.vars.first_name:
first_name = Testing

return dict(form=form, file_name = file_name, first_name = first_name)





view::

First name is: {{=file_name}}br

{{=form}}br

First name is:{{=first_name}}

filename is returning empty all the time.


On Wed, Mar 20, 2013 at 3:21 PM, Anthony abasta...@gmail.com wrote:

 As is, your code should generate an error because you haven't specified an
 upload folder, which is required when passing new Field objects to
 SQLFORM.factory. Try:

 import os
 SQLFORM.factory(Field(quotes, upload, uploadfolder=os.path.join(
 request.folder, 'uploads')))

 If you don't want to save the file at all, though, then don't call
 form.process(). Instead, just check for the uploaded file:

 if request.vars.quotes:
 manage_quotes(request.vars.quotes.file)

 Anthony

 On Wednesday, March 20, 2013 8:30:29 AM UTC-4, software.ted wrote:

 I want to upload a file to web2py and then manipulate it. I dont want to
 save it into the database...after manipulating it i want to delete it. How
 do i do that. I have been trying like this but all fails:

 Controller:

 def quotes():
 form = SQLFORM.factory(Field(quotes**, upload)
 if form.process().accepted:
 manage_quotes(form.vars.**quotes)
 elif form.errors:
 response.flash = form has error

 After upload I cannot see the uploaded in the upload folder!

 regards



 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Upload of Files

2013-03-20 Thread Teddy Nyambe
Actually this this is how am loading it, please advise:

{{=A('Quotes', component=URL('quotes','quotes.loadp ),
target='quote-content')}}

div id='quote-content'/div

One funny thing is when I add a simple text field to the SQLFORM.factory
and submit sample content...its displayed...only for upload is not showing.
On Mar 20, 2013 4:23 PM, Anthony abasta...@gmail.com wrote:

 Did you set ajax=True or ajax_trap=True in your LOAD() call? If not, the
 form will get posted to the action of the containing page, not the
 component action.

 Anthony

 On Wednesday, March 20, 2013 10:06:28 AM UTC-4, software.ted wrote:

 Anthony,

 Am having a very funny behavior. I am loading a form in a component
 quotes.load in another page of a div.
 When i access the component directly through the URL address the
 {{=BEAUTIFY(request.vars)}} am able to see the uploaded file, but accessing
 it through the component its sending empty quotes upload file note the code:

 controller

 def quotes():
 form = SQLFORM.factory(Field(first_**name), Field(quotes,
 upload, uploadfolder=os.path.join(**request.folder,'uploads')))

 file_name=

 first_name = 

 if request.vars.quotes:
   file_name=test

 if request.vars.first_name:
 first_name = Testing

 return dict(form=form, file_name = file_name, first_name = first_name)





 view::

 First name is: {{=file_name}}br

 {{=form}}br

 First name is:{{=first_name}}

 filename is returning empty all the time.


 On Wed, Mar 20, 2013 at 3:21 PM, Anthony abas...@gmail.com wrote:

 As is, your code should generate an error because you haven't specified
 an upload folder, which is required when passing new Field objects to
 SQLFORM.factory. Try:

 import os
 SQLFORM.factory(Field(quotes**, upload, uploadfolder=os.path.
 join(requ**est.folder, 'uploads')))

 If you don't want to save the file at all, though, then don't call
 form.process(). Instead, just check for the uploaded file:

 if request.vars.quotes:
 manage_quotes(request.vars.quo**tes.file)

 Anthony

 On Wednesday, March 20, 2013 8:30:29 AM UTC-4, software.ted wrote:

 I want to upload a file to web2py and then manipulate it. I dont want
 to save it into the database...after manipulating it i want to delete it.
 How do i do that. I have been trying like this but all fails:

 Controller:

 def quotes():
 form = SQLFORM.factory(Field(quotes, upload)
 if form.process().accepted:
 manage_quotes(form.vars.**quotes**)
 elif form.errors:
 response.flash = form has error

 After upload I cannot see the uploaded in the upload folder!

 regards



 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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+un...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.




-- 

--- 
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] REF: SQLFORM.grid: Determine when a new record is added

2013-03-15 Thread Teddy Nyambe
I have checked it and thanks its the thing am looking for however, I have
managed to have it work using SQLFORM.grid, however, I am having a
challenge having it work with SQLFORM.smartgrid where a child table upon
adding or editing a row can trigger a callback, I was trying it like so but
it failed:

db.define_table(person,
Field(first_name),
Field(last_name),
plural=People,
singular=Person)
db.define_table(work_experience,
Field(person_id, reference person),
Field(company_name),
Field(start_date, date),
Field(end_date, date),
plural=Work experience,
singular=Work experience)

def getPerson(form):
session.company_name = form.vars.company_name

def index():
grid =
SQLFORM.smartgrid(db.person,onupdate=dict(work_experience=getPerson),
linked_tables=['work_experience'])
return locals()


On Thu, Mar 14, 2013 at 2:48 PM, Carlos Costa yamandu.co...@gmail.comwrote:

 Check oncreate argument.


 2013/3/14 Teddy Nyambe software@gmail.com

 I want to add logic when a user clicks on submit to add a new record
 using the SQLFORM.grid, I would like to do something. I have checked the
 vars and args there is nothing to indicate this only when a form is
 requested for add, edit, view...

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 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.






 --
 Att.

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

 EL MELECH NEEMAN!
 אָמֵן

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: SQLFORM.grid: Determine when a new record is added

2013-03-14 Thread Teddy Nyambe
I want to add logic when a user clicks on submit to add a new record using
the SQLFORM.grid, I would like to do something. I have checked the vars and
args there is nothing to indicate this only when a form is requested for
add, edit, view...

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: SQLFORM.grid programmatically determine operation [add, edit or delete]

2013-03-13 Thread Teddy Nyambe
I would like to know how you can determine what button or operation was
made by a user on the grid where they pressed edit or add or delete in the
controller.

Teddy L.

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: SQLFORM.grid programmatically determine operation [add, edit or delete]

2013-03-13 Thread Teddy Nyambe
Thanks got it!

On Wed, Mar 13, 2013 at 10:45 AM, Niphlod niph...@gmail.com wrote:

 inspect request.args ... edit, delete, new should appear accordingly to
 the operation.


 On Wednesday, March 13, 2013 9:04:19 AM UTC+1, software.ted wrote:

 I would like to know how you can determine what button or operation was
 made by a user on the grid where they pressed edit or add or delete in the
 controller.

 Teddy L.

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: SQLFORM.grid Display Name

2013-03-13 Thread Teddy Nyambe
I am having a challenge displaying the first_name and lastname concatenated
in the grid listing its not displaying but the label is displayed correctly
but without records...but for View, Add and Edit the field is displaying
data correctly.

Controller:

def mp_info():
db.emp_portfolio.emp_id.requires = IS_IN_DB(db, db.auth_user.id,
'%(first_name)s %(last_name)s')
db.emp_portfolio.emp_id.label = Employee Name
grid = SQLFORM.grid(db.mp_portfolio)
return dict(grid=grid)

View:

{{=grid}}

What am i missing out?
-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: SQLFORM.smartgrid() changing the table labels

2013-03-13 Thread Teddy Nyambe
Is there a way to change the labels of the tables in the generated
breadcrumbs of the SQLFORM.grid as well as the link pointing to the linked
tables to something custom.



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] Integrating web2py with dhtmlx

2013-03-12 Thread Teddy Nyambe
Is its possible to use web2py with dhtmlx. Its got cool UI features!!! very
classy.



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] Re: REF:Error accessing a foriegn key object

2013-03-11 Thread Teddy Nyambe
Thanks.

-- 

--- 
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.




[web2py] REF: Integrating Web2py with Redactor WYSIWYG

2013-03-07 Thread Teddy Nyambe
I have managed to add the Redactor WYSIWYG  into a field with text type.
But what I have failed is to have it upload images, anyone who had managed
to get the image upload work?

Tried this but failed to upload image, but teh provision is showing to
upload images:

script type=text/javascript
$(document).ready(
function(){
$('#circular_circular_body').redactor({ imageUpload:
'{{=URL(default,download)}}' });
$('#circular_circular_body').redactor();
}
);
/script

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF:Error accessing a foriegn key object

2013-03-05 Thread Teddy Nyambe
Following the example in the new book under components:

Model:

db.define_table(comment_post, Field(body, text, label=Your
comment), auth.signature)

Controller:

@auth.requires_login()
def post(): return dict(form = SQLFORM(db.comment_post).process(), comments
= db(db.comment_post).select())

View:

{{extend 'layout.html'}}
{{for comment in comments:}}
div class=post
{{=comment.created_by.first_name}} on
{{=comment.created_on}} said: span
class=post_body{{=comment.body}}/span
/div
{{pass}}
{{=form}}

Error Trace:

Versionweb2py™(2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 21))
PythonPython 2.7.3:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
(prefix: /Library/Frameworks/Python.framework/Versions/2.7)Traceback

1.
2.
3.
4.
5.
6.

Traceback (most recent call last):
  File /Users/teddyl/Documents/src/web2py/gluon/restricted.py, line
212, in restricted
exec ccode in environment
  File 
/Users/teddyl/Documents/src/web2py/applications/testapp/views/comments/post.html,
line 85, in module
AttributeError: 'NoneType' object has no attribute 'first_name'

Error snapshot [image:
help]http://localhost:8000/admin/default/ticket/testapp/127.0.0.1.2013-03-06.09-40-30.a9801d29-f1d9-46e9-82f2-bccfbf1c0292#

type 'exceptions.AttributeError'('NoneType' object has no attribute
'first_name')

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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.




[web2py] REF: SQLFORM in HTML

2013-02-27 Thread Teddy Nyambe
I am following the book example with modified tables, the form is not being
processed in the controller, what could be wrong with my code below:

*db.py [Model]*

db.define_table(address,
Field(street, requires=IS_NOT_EMPTY()),
Field(suburb, requires = IS_NOT_EMPTY()),
Field(town, requires = IS_NOT_EMPTY()),
Field(province, requires = IS_NOT_EMPTY()))

*default.py [Controller]*

def add_address():
form = SQLFORM(db.address)
if form.process(session=None, formname=test).accepted:
response.flash = Address added
elif form.errors:
response.flash = Form has errors
else:
response.flash = Fill in form
return dict()

*add_address.html [View]*

{{extend layout.html}}
form
table
tr
tdEnter street: /tdtdinput type=text name=street
//td
/tr
tr
tdEnter suburb: /tdtdinput type=text name=suburb
//td
/tr
tr
tdEnter town: /tdtdinput type=text name=town //td
/tr
tr
tdEnter province: /tdtdinput type=text
 name=province //td
/tr
tr
td colspan = 2input type=submit //td
/tr
/table
input type=hidden name=_formname value=test /
/form


Regards, Teddy L.

-- 

--- 
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] REF: Documentation Correction Proposal

2013-02-19 Thread Teddy Nyambe
Ok will do!
On Feb 19, 2013 6:24 PM, Richard Vézina ml.richard.vez...@gmail.com
wrote:

 Hello Teddy,

 Report this with book typo in the object, these kind of issue with the
 book are usally report like until now so the person reponsible to edit the
 book will flag them more easily.

 Richard


 On Tue, Feb 19, 2013 at 8:57 AM, Teddy Nyambe software@gmail.comwrote:

 Hi Massimo,

 Re-reading the online book...looking at this example:

 def first():
 form = SQLFORM.factory(Field('visitor_name', requires=IS_NOT_EMPTY()))
 if form.process().accepted:
 name = form.vars.visitor_name
 redirect(URL('second',vars=dict(name=name)))
 return dict(form=form)

 def second():
 name = request.vars.visitor_name or redirect(URL('first'))
 return dict(name=name)


 I have noticed in the action second, the request.vars.visitor_name
 should be request.vars.name considering that the key for the dictionary
 passed is name in the first action. Please note the error.
 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

 --

 ---
 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.




  --

 ---
 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.




-- 

--- 
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: Real Python for Web Development, featuring web2py

2013-02-06 Thread Teddy Nyambe
...let him do something more interesting for an example - like  a ticket
processing system, with reminders so that we can even learn about
scheduling aspect of web2py


On Tue, Feb 5, 2013 at 9:52 PM, Niphlod niph...@gmail.com wrote:

 +1 for web2py, -1 for blog as an example app.


 On Tuesday, February 5, 2013 6:28:50 PM UTC+1, rochacbruno wrote:



 Take a look:
 http://www.kickstarter.com/**projects/1369857650/real-**
 python-for-web-development-**featuring-web2pyhttp://www.kickstarter.com/projects/1369857650/real-python-for-web-development-featuring-web2py

 Why Web2py?

 web2py is an open-source web framework for rapid development. You can get
 up in running in less than 10 minutes and build a full-featured application
 in under an hour. Much like the Python language itself, web2py is designed
 for beginners to quickly get up to speed as well as advanced users.

  --

 ---
 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.






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Change order of fields in a form??!

2013-01-04 Thread Teddy Nyambe
Thanks, what about the ide font in web2py how do u change it?
On Jan 5, 2013 6:46 AM, Christian Espinoza chespin...@gmail.com wrote:

 Is easy use a custom form instead of {{=form}}, then you can control
 where put your input fields...

 {{=form.custom.begin}}
 Image name: div{{=form.custom.widget.name}}/div
 Image file: div{{=form.custom.widget.file}}/div
 Click here to upload: {{=form.custom.submit}}
 {{=form.custom.end}}

 Reference:
 http://web2py.com/books/default/chapter/29/07#Custom-forms
 Christian.



 El viernes, 4 de enero de 2013 04:22:51 UTC-3, software.ted escribió:

 How do you change the order of the form after it has been created using:

 form = SQLFORM(db.table)

 Also how do you change the font of the web2py editor???

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --





-- 





[web2py] REF: Change order of fields in a form??!

2013-01-03 Thread Teddy Nyambe
How do you change the order of the form after it has been created using:

form = SQLFORM(db.table)

Also how do you change the font of the web2py editor???

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





[web2py] REF: Change Editor font type and size

2012-12-31 Thread Teddy Nyambe
I would like to change the font size and type for my web2py editor...how do
i do that?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





Re: [web2py] book 5th ed. Need help

2012-12-31 Thread Teddy Nyambe
When are is the expected release date of the 5th Edition of the book?


On Fri, Dec 28, 2012 at 12:09 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 If the labor is divided than I cannot pay because it is too complicated.
 But if you do all of them then I will be happy to pay you. We can discuss
 this off-line when you send me the samples.

 Massimo


 On Thursday, 27 December 2012 16:03:31 UTC-6, Roberto Perdomo wrote:

 I can help with that. Tonight beginning, and I send you some example.

 PS: No need to pay me for it.

 Regards.


 2012/12/27 Massimo Di Pierro massimo@gmail.com

 I need help to redo all screenshots in the book using the latest web2py.

 I am looking for a few volunteers. Almost all of the screenshots are in
 chapter 3, 7, and 9.

 They should be done using Chrome without toolbars.
 Here are current screenshots:
 https://github.com/mdipierro/**web2py-book/tree/master/**
 sources/29-web2py-english/**imageshttps://github.com/mdipierro/web2py-book/tree/master/sources/29-web2py-english/images
 The new screenshots should have the same name and format.

 If one of you wants to them all and can do in 3 days, send me an example
 of a couple of screenshots privately (to make sure they look good) and I
 will pay you $150 for all of them.

  --





  --







-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





[web2py] Re: REF: Change Editor font type and size

2012-12-31 Thread Teddy Nyambe
The online demo seems to have a different font from mine and the editor has
a toolbar and status bar showline line number etc


On Mon, Dec 31, 2012 at 11:07 AM, Teddy Nyambe software@gmail.comwrote:

 I would like to change the font size and type for my web2py editor...how
 do i do that?

 --

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





[web2py] REF: Web2py Shell - cannot overwrite functions??

2012-12-31 Thread Teddy Nyambe
In web2py when i redefine a function, it does not overwrite the
function...is this by design? See the example below:

In [39] : def add(v):
  return v+2


In [40] : print add(5)
7

In [41] : def add(v):
  return v+5


In [42] : print add(5)
7



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





Re: [web2py] REF: Web2py Shell - cannot overwrite functions??

2012-12-31 Thread Teddy Nyambe
ok noted!



On Mon, Dec 31, 2012 at 4:52 PM, Bruno Rocha rochacbr...@gmail.com wrote:


 If you are using the web shell (on admin interface), yes there is a bug
 with this.

 But in a normal console it does not happens.

 --







-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





[web2py] REF: Setting the selected option attribute

2012-12-31 Thread Teddy Nyambe
Happy New Year!!

I am trying to set some functions...am having trouble haveing a selected
option, am doing as follows:

def get_drop_down_option9(options_dict, selected):
  return [OPTION(value_, _value=key_ , *['_selected' if selected == key_
else '']) for key_, value_ in options_dict.iteritems()]

I am getting the output

print SELECT(get_drop_down_option9(options, 'dad'))

selectoption value=dadJame_selected/optionoption
value=sisterAnn/optionoption value=bro1Sam/optionoption
value=momSara/optionoption value=bro2Kelvin/option/select


What am i missing or how do i get it right

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





  1   2   >