[web2py] I don't want 'Login Successful' or 'Success' popping up on the screen in my app.

2013-12-30 Thread Keith Planer
How do I keep session.flash and response.flash from doing their things when 
I don't want to? Specifically I don't want the messages popping up after a 
user logs in or when they make a new entry to the DB.

-- 
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] Re: REF: Problem with Dates from db query

2013-12-30 Thread Niphlod
you can't mix python formatting directly in the select
fetch the values first and transform them later using strptime and strftime.

BTW: if startdate is a 'datetime' field you just need to strftime it later.

On Monday, December 30, 2013 6:04:39 AM UTC+1, software.ted wrote:


 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.


[web2py] Re: gevent and admin app

2013-12-30 Thread Niphlod
as you do with the normal one. either you use ssh forwarding or you 
enable ssl

On Sunday, December 29, 2013 10:02:52 PM UTC+1, Arnon Marcus wrote:

 How can I access the admin app in remote (non localhost) server, when 
 hosting via gevent?

-- 
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: links in texts stoded in a database

2013-12-30 Thread Jonas Fredriksson
the XML function solved the problem:

{{for i, row in enumerate(rows):}}
{{=DIV(XML(T(row.table_field), sanitize = True) ) }}
{{pass}}

thanks.



On Mon, Dec 30, 2013 at 3:29 AM, 黄祥 steve.van.chris...@gmail.com wrote:

 another way around is define it on the represent for your table text field.
 e.g.
 table.table_field.represent = lambda v, r: XML(v, sanitize = True)

 the difference for previous code in this one you can use it for grid
 without define it again on your view.

 if you use string type field, yet it can be done with represent also
 e.g.
 table.website.represent = lambda website, field: \
 A(website, _title = T(View Website), _target = _blank, _href = %s %
 website)

 best regards,
 stifan

 --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/yukzpnZe4GQ/unsubscribe.
 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.


-- 
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] Calendar widget in a custom form?

2013-12-30 Thread Keith Planer
After adding some input validation I've realized that the calendar widget 
is not popping up. Is there anything I need to add to the controller or 
elsewhere?

form=FORM(TABLE(...TR(Admission Date: ,INPUT(_name='adm_date',widget=
SQLFORM.widgets.date.widget,requires=IS_DATE()))...


-- 
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] Re: How to upload a file without using SQLFORM ??

2013-12-30 Thread Rogere Questre


 In my Case it says 

 'str' object has no attribute 'filename'

-- 
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] Re: Calendar widget in a custom form?

2013-12-30 Thread Alan Etkin


 After adding some input validation I've realized that the calendar widget 
 is not popping up. Is there anything I need to add to the controller or 
 elsewhere?


I suspect there's no widget option for the INPUT objects, unless it was 
added and was not updated in examples:

http://www.web2py.com/examples/static/epydoc/gluon.html.INPUT-class.html

However, for a similar effect, you can use a customized SQLFORM object

http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms

-- 
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] Re: I don't want 'Login Successful' or 'Success' popping up on the screen in my app.

2013-12-30 Thread Alan Etkin


 How do I keep session.flash and response.flash from doing their things 
 when I don't want to? Specifically I don't want the messages popping up 
 after a user logs in or when they make a new entry to the DB.


For processing forms, you can disable the message_something option in 
.process()

http://www.web2py.com/books/default/chapter/29/07/forms-and-validators?search=success#The-process-and-validate-methods

-- 
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] Re: unpickling stack underflow

2013-12-30 Thread Alan Etkin


 HELP PLEASE!


Could you post the relevant part of code that throws the error? What 
version of web2py are you running? 

-- 
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] Re: Firefox 26.0 and redirect after login

2013-12-30 Thread Alan Etkin
 

 I tested these functions in Safari, in Safari everything works as before.
 Does anyone have an idea what changed in Firefox and how to solve this 
 issue?


Does it actually redirect (does it open the new location)? You can check 
the response output with the firefox console (Ctrl+Shift+K)

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

2013-12-30 Thread Tushar Tuteja
I have an app running on MySQL , I want to use mongoDB instead. 
I want to help on migration from mysql to mongoDB.
Thanks,

regards,

Tushar Tuteja

-- 
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] Re: MongoDb

2013-12-30 Thread Alan Etkin


 I have an app running on MySQL , I want to use mongoDB instead. 
 I want to help on migration from mysql to mongoDB.
 Thanks,


Beware that mongodb adapter is in an experimental stage of development, so 
you should know what you are doing before migrating. I suppose there are 
lots of howtos for migrating data between those backends. The web2py way of 
doing has two options, AFAIK:

- use cpdb (never tried it with those connections)
- use DAL.import_from_csv_file and DAL.export_from_csv_file methods (for a 
small amount of db records)

Mind that the most important issue is that mongodb is not a relational 
database management system and there's no such thing as JOIN queries. This 
is a limitation for web2py also, since some of the web2py features require 
joins to work.

-- 
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] Re: gevent and admin app

2013-12-30 Thread Arnon Marcus
How do I do that?
I tried the anyserver -h flag, but there was nothing there about it...

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

2013-12-30 Thread Tushar Tuteja
Hey,
Thanks for the answer. Luckily there are no joins, but I need to see what
web2py features of DAL won't work.
Thanks,
Regards,
Tushar Tuteja



On 30 December 2013 16:44, Alan Etkin spame...@gmail.com wrote:

 I have an app running on MySQL , I want to use mongoDB instead.
 I want to help on migration from mysql to mongoDB.
 Thanks,


 Beware that mongodb adapter is in an experimental stage of development, so
 you should know what you are doing before migrating. I suppose there are
 lots of howtos for migrating data between those backends. The web2py way of
 doing has two options, AFAIK:

 - use cpdb (never tried it with those connections)
 - use DAL.import_from_csv_file and DAL.export_from_csv_file methods (for a
 small amount of db records)

 Mind that the most important issue is that mongodb is not a relational
 database management system and there's no such thing as JOIN queries. This
 is a limitation for web2py also, since some of the web2py features require
 joins to work.

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/oPCXZnnFvyI/unsubscribe.
 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.




-- 
Tushar Tuteja
Undergraduate Student(Fourth Year)
Civil Engineering
IIT Delhi
+919953061943
ttut...@gmail.com ttut...@gmal.com
ce1090...@civil.iitd.ernet.in
The question isn't who is going to let me; its who is going to stop me! -
Howard Roark

-- 
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] OFF TOPIC - Text to SVG !

2013-12-30 Thread António Ramos
Fantastic

http://bramp.github.io/js-sequence-diagrams/

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

2013-12-30 Thread Alan Etkin


 Thanks for the answer. Luckily there are no joins, but I need to see what 
 web2py features of DAL won't work.


To my knowledge, you cannot use the scheduler or Auth.accessible_query, 
everything else not requiring join queries should work.

-- 
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] Re: gevent and admin app

2013-12-30 Thread Niphlod
how do you connect to the admin app when it's served by rocket ? the same 
way goes for the gevented webserver (or anyserver.py).

ssh forwarding

ssh -L localport:host:hostport user@ssh_server



On Monday, December 30, 2013 1:06:35 PM UTC+1, Arnon Marcus wrote:

 How do I do that?
 I tried the anyserver -h flag, but there was nothing there about it...

-- 
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: create doc files

2013-12-30 Thread Diego Tostes
thanks anthony,

but did not works... the result was a file with no name with None printed
at the first page


2013/12/29 Anthony abasta...@gmail.com

 You are attempting to return a pyrtf.Document object, but instead you must
 stream a file or file-like object. You have to render the document to a
 file-like object and use response.stream():

 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO

 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )

 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )
 response.stream(pyrtf.Renderer().Write(doc, cStringIO.StringIO()),
 filename='yourdocument.rtf')

 Specifying the filename with the .rtf extension ensures the content-type
 header will be set properly automatically.

 Anthony

 On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:

 here is my code:

 http://pastebin.com/qh5AV8Xh

 but the download don't start when i access this controler.






 2013/12/28 Diego Tostes tostes...@gmail.com

 i am using the pyrtf, but i dont know how create the file and download
 without save the file on the server.

 any idea?


 2013/12/28 Anthony abas...@gmail.com

 There's also python-docx https://github.com/mikemaccana/python-docx.


 On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:

 done using
 PyRTF


 thanks


 2013/12/28 Diego Tostes tostes...@gmail.com

 Hi,

 Is it possible create doc files (word or openoffice) using templates
 rendering?

 Rgds,

 Diego


  --
 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: create doc files

2013-12-30 Thread Cliff Kachinske
What happens if you move doc.Sections.append ( section ) after the line 
that says section.append( p ) ?

On Monday, December 30, 2013 7:52:07 AM UTC-5, Diego Tostes wrote:

 thanks anthony,

 but did not works... the result was a file with no name with None 
 printed at the first page


 2013/12/29 Anthony abas...@gmail.com javascript:

 You are attempting to return a pyrtf.Document object, but instead you 
 must stream a file or file-like object. You have to render the document to 
 a file-like object and use response.stream():

 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO
 
 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )
 
 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )
 response.stream(pyrtf.Renderer().Write(doc, cStringIO.StringIO()),
 filename='yourdocument.rtf')

 Specifying the filename with the .rtf extension ensures the 
 content-type header will be set properly automatically.

 Anthony

 On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:

 here is my code:

 http://pastebin.com/qh5AV8Xh

 but the download don't start when i access this controler.






 2013/12/28 Diego Tostes tostes...@gmail.com

 i am using the pyrtf, but i dont know how create the file and download 
 without save the file on the server.

 any idea?


 2013/12/28 Anthony abas...@gmail.com

 There's also python-docx https://github.com/mikemaccana/python-docx.


 On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:

 done using 
 PyRTF


 thanks


 2013/12/28 Diego Tostes tostes...@gmail.com

 Hi,

 Is it possible create doc files (word or openoffice) using templates 
 rendering?

 Rgds,

 Diego


  -- 
 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 javascript:.
 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] Re: wrong version of web2py book on dropbox

2013-12-30 Thread LightDot
My understanding is that:
- github repo for the book app has the latest content
- the online book app is somewhat regularly updated from the github repo
- the pdf is generated only when the actual book gets published.

So once the 6th edition gets out, the pdf will reflect this, not before.

Regards

On Monday, December 30, 2013 4:39:26 AM UTC+1, Pystar wrote:

 Hello Max,
 The web2py online book shows its a 6th edition, pre-release version but on 
 clicking download the pdf version from dropbox, its the 5th edition that 
 gets downloaded.


-- 
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] Re: Calendar widget in a custom form?

2013-12-30 Thread Paolo Caruccio
Please try to add to the INPUT the class date:

form=FORM(TABLE(...TR(Admission Date: ,INPUT(_class='date',_name=
'adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...



Il giorno lunedì 30 dicembre 2013 09:48:06 UTC+1, Keith Planer ha scritto:

 After adding some input validation I've realized that the calendar widget 
 is not popping up. Is there anything I need to add to the controller or 
 elsewhere?

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_name='adm_date',widget=
 SQLFORM.widgets.date.widget,requires=IS_DATE()))...




-- 
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] Re: gevent and admin app

2013-12-30 Thread Arnon Marcus
I have no idea what ssh forwarding is, or whatever it is you wrote here-I can 
look it up.
I am not a linux wiz by any means, nor an operations guy - just learning things 
as I go as I need them.

I understand that the admin app, by default, requires a secure channel, for ano 
non localhost usage. That makes sense. The only way I know of to do that, is to 
serve web2py over ssl on port 443, with an accomanying certificate, then log-in 
via the https protocol. I thing I managed to configure that with apache once, 
not sure about rocket...

My use-case requires remote windows-machine access, since the server is a 
minimalist centos one, so no-browser.

Can anyserver.py be used to serve web2py  through ssl when using gevent?

-- 
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: Calendar widget in a custom form?

2013-12-30 Thread Keith Planer
That fixed it, Paolo, thanks!


On Mon, Dec 30, 2013 at 8:33 AM, Paolo Caruccio
paolo.carucci...@gmail.comwrote:

 Please try to add to the INPUT the class date:

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_class='date',_name=
 'adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...



 Il giorno lunedì 30 dicembre 2013 09:48:06 UTC+1, Keith Planer ha scritto:

 After adding some input validation I've realized that the calendar widget
 is not popping up. Is there anything I need to add to the controller or
 elsewhere?

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_name='adm_date',widget=
 SQLFORM.widgets.date.widget,requires=IS_DATE()))...


  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/yx1h4TMnXBU/unsubscribe.
 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.


-- 
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] with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Hi,
I have this on the view:

div
   input name=name onkeyup=ajax('org_form_load.load', ['name'], 
'org_form_target') /
/div
div id = org_form_target/div

and something like this on the controller:

def org_form_load():
org_code = request.vars.name
org_code_name = db(..).select(..)
if org_code_name:
db.t_org_members.f_org_member.default = auth.user.id
form = 
SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
'something...')
if form.process().accepted:
response.flash = 'Success!'
else:
response.flash = 'There was an error..'
return dict(form = form, org_code_name = org_code_name)
and on the org_form_load:

{{=form}}



(Before moving the form into the load page, everything went fine.)
After moving the form to the load page, this is what it does:
User fill correctly the organization code.
The form appears as expected, (but not submitted yet)
BUT I already get the  response.flash = 'There was an error..'.
If I try to submit the form nothing flashes and form is not submitted 
either.
Help please...
Thanks.

-- 
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: create doc files

2013-12-30 Thread Anthony
Sorry, a couple mistakes in the code. This should do it:

def generate_doc():
from gluon.contrib.pyrtf import *
import cStringIO

doc = Document()
ss  = doc.StyleSheet
section = Section()
doc.Sections.append( section )

p = Paragraph( ss.ParagraphStyles.Heading1 )
p.append( 'Certified Staff Evaluation' )
section.append( p )

s = cStringIO.StringIO()
Renderer().Write(doc, s)
s.seek(0)
return response.stream(s, attachment= True, filename='yourdocument.rtf')

Anthony

On Monday, December 30, 2013 7:52:07 AM UTC-5, Diego Tostes wrote:

 thanks anthony,

 but did not works... the result was a file with no name with None 
 printed at the first page


 2013/12/29 Anthony

 You are attempting to return a pyrtf.Document object, but instead you 
 must stream a file or file-like object. You have to render the document to 
 a file-like object and use response.stream():

 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO
 
 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )
 
 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )
  
 s = cStringIO.StringIO()
 Renderer().Write(doc, s)
 s.seek(0)
 return response.stream(s, attachment= True, filename=
 'yourdocument.rtf')

 Specifying the filename with the .rtf extension ensures the 
 content-type header will be set properly automatically.

 Anthony

 On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:

 here is my code:

 http://pastebin.com/qh5AV8Xh

 but the download don't start when i access this controler.






 2013/12/28 Diego Tostes tostes...@gmail.com

 i am using the pyrtf, but i dont know how create the file and download 
 without save the file on the server.

 any idea?


 2013/12/28 Anthony abas...@gmail.com

 There's also python-docx https://github.com/mikemaccana/python-docx.


 On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:

 done using 
 PyRTF


 thanks


 2013/12/28 Diego Tostes tostes...@gmail.com

 Hi,

 Is it possible create doc files (word or openoffice) using templates 
 rendering?

 Rgds,

 Diego


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


[web2py] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Anthony
The form is not accepted when it is first created, so you will always get 
that error message. Instead, you want:

elif form.errors:
response.flash = 'There was an error..'

Anthony

On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.


-- 
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] db modul creating question types

2013-12-30 Thread Timo Bahner
Hi. How do I define question_types (ie text, radio, checkbox) in a table?

db.define_table('question',
Field('title'),
Field('question_type', ??? ))

Do I list them somewhere or do I create a field for all three options? 

I want to be able to choose the question type while creating a question.

Thanks.

-- 
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] Re: gevent and admin app

2013-12-30 Thread Niphlod
nope. anyserver does not provide ssl capable webserver, 'cause most of the 
engines leave SSL out of the picture (i.e. since usually you'd want them 
behind a real webserver that acts as a proxy, like apache or nginx, SSL 
is managed there and not by the python engine).

That being said, I think the best way for you to access the remote centos 
miminal server is to download putty and use port forwarding (putty is an 
ssh client for windows, for which there is extensive documentation 
throughout all the internet)

If instead you want gevent to serve directly SSL, you're lucky because:
- gevent is one of the few providing an SSL capable webserver
- there's a script in trunk that serves web2py in gevent with SSL 
https://github.com/web2py/web2py/blob/master/handlers/web2py_on_gevent.py



On Monday, December 30, 2013 4:07:45 PM UTC+1, Arnon Marcus wrote:

 I have no idea what ssh forwarding is, or whatever it is you wrote here-I 
 can look it up.
 I am not a linux wiz by any means, nor an operations guy - just learning 
 things as I go as I need them.

 I understand that the admin app, by default, requires a secure channel, 
 for ano non localhost usage. That makes sense. The only way I know of to do 
 that, is to serve web2py over ssl on port 443, with an accomanying 
 certificate, then log-in via the https protocol. I thing I managed to 
 configure that with apache once, not sure about rocket...

 My use-case requires remote windows-machine access, since the server is a 
 minimalist centos one, so no-browser.

 Can anyserver.py be used to serve web2py  through ssl when using gevent?



-- 
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: create doc files

2013-12-30 Thread Jonathan Lundell
On 30 Dec 2013, at 7:31 AM, Anthony abasta...@gmail.com wrote:
 Sorry, a couple mistakes in the code. This should do it:

There's a pyrtf example in the book 
http://web2py.com/books/default/chapter/29/10/services?search=pyrtf#PyRTF 
that uses a helper (dumps) and apparently returns a string. I wonder whether 
the example shouldn't be updated to take advantage of response.stream; we're 
short of response.stream examples anyway.

 
 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO
 
 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )
 
 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )
 
 s = cStringIO.StringIO()
 Renderer().Write(doc, s)
 s.seek(0)
 return response.stream(s, attachment= True, filename='yourdocument.rtf')
 
 Anthony
 
 On Monday, December 30, 2013 7:52:07 AM UTC-5, Diego Tostes wrote:
 thanks anthony,
 
 but did not works... the result was a file with no name with None printed 
 at the first page
 
 
 2013/12/29 Anthony
 You are attempting to return a pyrtf.Document object, but instead you must 
 stream a file or file-like object. You have to render the document to a 
 file-like object and use response.stream():
 
 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO
 
 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )
 
 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )
  
 s = cStringIO.StringIO()
 Renderer().Write(doc, s)
 s.seek(0)
 return response.stream(s, attachment= True, filename='yourdocument.rtf')
 
 Specifying the filename with the .rtf extension ensures the content-type 
 header will be set properly automatically.
 
 Anthony
 
 On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:
 here is my code:
 
 http://pastebin.com/qh5AV8Xh
 
 but the download don't start when i access this controler.
 
 
 
 
 
 
 2013/12/28 Diego Tostes tostes...@gmail.com
 i am using the pyrtf, but i dont know how create the file and download 
 without save the file on the server.
 
 any idea?
 
 
 2013/12/28 Anthony abas...@gmail.com
 There's also python-docx.
 
 
 On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:
 done using 
 PyRTF
 
 
 
 thanks
 
 
 
 2013/12/28 Diego Tostes tostes...@gmail.com
 
 Hi,
 
 Is it possible create doc files (word or openoffice) using templates 
 rendering?
 
 Rgds,
 
 Diego
 
 
 -- 
 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)



-- 
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] Re: db modul creating question types

2013-12-30 Thread Paolo Caruccio

# radio
Field('question_type', widget=SQLFORM.widgets.radio.widget, requires=
IS_IN_SET(['option A','option B'])

#checkboxes
Field('question_type', widget=SQLFORM.widgets.checkboxes.widget, requires=
IS_IN_SET(['option A','option B','option C'])

#textarea
Field('question_type', 'text')

#text input
Field('question_type') or Field('question_type', 'string')




Il giorno lunedì 30 dicembre 2013 17:15:30 UTC+1, Timo Bahner ha scritto:

 Hi. How do I define question_types (ie text, radio, checkbox) in a table?

 db.define_table('question',
 Field('title'),
 Field('question_type', ??? ))

 Do I list them somewhere or do I create a field for all three options? 

 I want to be able to choose the question type while creating a question.

 Thanks.


-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Thanks,
It solved the error getting after the form is loaded into the page,
but still nothing happen if I submit the form.
This is what I do:
if form.process().accepted:
response.flash = 'Success!'
elif form.errors:
response.flash = 'response errors'


On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always get 
 that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.



-- 
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] Re: Calendar widget in a custom form?

2013-12-30 Thread Keith Planer
One other small problem, the field doesn't allow for nothing to be entered 
now. How do I make it optional?

On Monday, December 30, 2013 8:33:34 AM UTC-6, Paolo Caruccio wrote:

 Please try to add to the INPUT the class date:

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_class='date',_name=
 'adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...



 Il giorno lunedì 30 dicembre 2013 09:48:06 UTC+1, Keith Planer ha scritto:

 After adding some input validation I've realized that the calendar widget 
 is not popping up. Is there anything I need to add to the controller or 
 elsewhere?

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_name='adm_date',widget=
 SQLFORM.widgets.date.widget,requires=IS_DATE()))...




-- 
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] Re: Calendar widget in a custom form?

2013-12-30 Thread Keith Planer
Nevermind, found it.
requires=IS_EMPTY_OR(IS_DATE())



On Monday, December 30, 2013 11:31:36 AM UTC-6, Keith Planer wrote:

 One other small problem, the field doesn't allow for nothing to be entered 
 now. How do I make it optional?

 On Monday, December 30, 2013 8:33:34 AM UTC-6, Paolo Caruccio wrote:

 Please try to add to the INPUT the class date:

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_class='date',_name=
 'adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...



 Il giorno lunedì 30 dicembre 2013 09:48:06 UTC+1, Keith Planer ha scritto:

 After adding some input validation I've realized that the calendar 
 widget is not popping up. Is there anything I need to add to the controller 
 or elsewhere?

 form=FORM(TABLE(...TR(Admission Date: ,INPUT(_name='adm_date',widget=
 SQLFORM.widgets.date.widget,requires=IS_DATE()))...




-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Anthony
The form won't get submitted to the org_form_load action, but instead will 
get submitted to the action of the parent page. You have to trap the form 
submission and submit back to the org_form_load action. Rather than using 
the ajax() function to load a form, you're better off loading the form via 
an Ajax component:

onkeyup={{=$.web2py.component('%s', 'org_form_target'); % URL('default', 
'org_form_load.load')}}

Anthony

On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always get 
 that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.



-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
Thanks. I will look into it.
Happy new year! and thanks for all the awesome support!

On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead will 
 get submitted to the action of the parent page. You have to trap the form 
 submission and submit back to the org_form_load action. Rather than using 
 the ajax() function to load a form, you're better off loading the form via 
 an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always 
 get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.



-- 
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: create doc files

2013-12-30 Thread Diego Tostes
thanks anthony!!

works!

but one more thing, is it possible create a rtf template and send
parameters to the template?

rgsd,

Diego


2013/12/30 Anthony abasta...@gmail.com

 Sorry, a couple mistakes in the code. This should do it:

 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO

 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )

 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )


 s = cStringIO.StringIO()
 Renderer().Write(doc, s)
 s.seek(0)
 return response.stream(s, attachment= True, filename=
 'yourdocument.rtf')

 Anthony

 On Monday, December 30, 2013 7:52:07 AM UTC-5, Diego Tostes wrote:

 thanks anthony,

 but did not works... the result was a file with no name with None
 printed at the first page


 2013/12/29 Anthony

 You are attempting to return a pyrtf.Document object, but instead you
 must stream a file or file-like object. You have to render the document to
 a file-like object and use response.stream():

 def generate_doc():
 from gluon.contrib.pyrtf import *
 import cStringIO

 doc = Document()
 ss  = doc.StyleSheet
 section = Section()
 doc.Sections.append( section )

 p = Paragraph( ss.ParagraphStyles.Heading1 )
 p.append( 'Certified Staff Evaluation' )
 section.append( p )

 s = cStringIO.StringIO()
 Renderer().Write(doc, s)
 s.seek(0)
 return response.stream(s, attachment= True, filename='yourdocument.
 rtf')

 Specifying the filename with the .rtf extension ensures the
 content-type header will be set properly automatically.

 Anthony

 On Saturday, December 28, 2013 4:20:34 PM UTC-5, Diego Tostes wrote:

 here is my code:

 http://pastebin.com/qh5AV8Xh

 but the download don't start when i access this controler.






 2013/12/28 Diego Tostes tostes...@gmail.com

 i am using the pyrtf, but i dont know how create the file and download
 without save the file on the server.

 any idea?


 2013/12/28 Anthony abas...@gmail.com

 There's also python-docx https://github.com/mikemaccana/python-docx
 .


 On Saturday, December 28, 2013 10:35:33 AM UTC-5, Diego Tostes wrote:

 done using
 PyRTF


 thanks


 2013/12/28 Diego Tostes tostes...@gmail.com

 Hi,

 Is it possible create doc files (word or openoffice) using
 templates rendering?

 Rgds,

 Diego


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


-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
How is the name (input value) is passed in this component template/case? 
(i click the code and the form won't load into the page.).

On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead 
 will get submitted to the action of the parent page. You have to trap the 
 form submission and submit back to the org_form_load action. Rather than 
 using the ajax() function to load a form, you're better off loading the 
 form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always 
 get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.



-- 
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] Re: OFF TOPIC - Text to SVG !

2013-12-30 Thread Massimo Di Pierro
Fantastic indeed.

On Monday, 30 December 2013 06:14:29 UTC-6, Ramos wrote:

 Fantastic

 http://bramp.github.io/js-sequence-diagrams/


-- 
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] Re: db modul creating question types

2013-12-30 Thread Paolo Caruccio
If you want more questions with different types in the same form you 
could be interested to read this discussion

https://groups.google.com/forum/#!topic/web2py/FAvjWNUiC3Y



Il giorno lunedì 30 dicembre 2013 18:01:04 UTC+1, Paolo Caruccio ha scritto:


 # radio
 Field('question_type', widget=SQLFORM.widgets.radio.widget, requires=
 IS_IN_SET(['option A','option B'])

 #checkboxes
 Field('question_type', widget=SQLFORM.widgets.checkboxes.widget, requires=
 IS_IN_SET(['option A','option B','option C'])

 #textarea
 Field('question_type', 'text')

 #text input
 Field('question_type') or Field('question_type', 'string')


 And dinamically:

 Field ('question_type')

 and in your controller:

 db.question.question_type.widget = SQLFORM.widgets.checkboxes.widget
 db.question.question_type.requires=IS_IN_SET(['Option A','Option 
 B','Option 
 C'])
 form = SQLFORM()

 I'm sorry for modifing my post but the return key of my keyboard is become 
 crazy.
 

 Il giorno lunedì 30 dicembre 2013 17:15:30 UTC+1, Timo Bahner ha scritto:

 Hi. How do I define question_types (ie text, radio, checkbox) in a table?

 db.define_table('question',
 Field('title'),
 Field('question_type', ??? ))

 Do I list them somewhere or do I create a field for all three options? 

 I want to be able to choose the question type while creating a question.

 Thanks.



-- 
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] Re: Trouble setting up database that chooses predefined options.

2013-12-30 Thread Dave S


On Saturday, December 28, 2013 7:18:27 AM UTC-8, Cliff wrote:

 Dave

 Just wanted to give you an update. I have it working for now and will play 
 with some other features in the future. I tried uploading it to GAE but it 
 was being a pain so I threw it on a old web page of mine. 

 https://crypto4games.com/bowlgames/https://crypto4games.com/bowlgames/default/stats


Congratulations!  I feel sorry for the people who picked Cincinnati.

/dps


 

 On Monday, December 23, 2013 3:26:46 PM UTC-5, Cliff wrote:

 Thanks Dave!

 You have been very helpful. I should be able to find my way from here. 
 Thanks again :)


 On Friday, December 20, 2013 2:46:56 PM UTC-5, Dave S wrote:


 On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:

 Hi Dave

 Thanks for the reply! That was somewhat the path I was on. I like the 
 boolean idea. Where I am hung up now though is how I would list all the 
 bowl games on a page then update picks, like how i mentioned before. Would 
 I be able to use SQLFORM to do this? This is my database setup, i have 
 kept 
 it simple for now.


 As a start, you might look at Loic's answer he linked in to the other 
 thread.  Your database should be small enough that Anthony's concern won't 
 be a problem.
 
 http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864
 

 (I use SQLFORM in my current, but just for a simple table; the trickiest 
 thing I do is figuring out maxid so I can limit the range of the table.)
  


 db.define_table('persons', Field('person'), Field('email'))
 db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
 default=False))
 db.define_table('bowls', Field('name'), Field('team1', 'reference 
 teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
 db.define_table('picks', Field('person', 'reference persons'), 
 Field('pick', 'reference teams'))
 db.persons.email.requires = IS_EMAIL()
 db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
 db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
 db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

 On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I 
 can enter their picks and it store it in a DB for that user. An example 
 would be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio 
 button to select the team. Bowl game 2: team 1 vs team 2 drop down list 
 to 
 select the team etc etc.. Then later be able to list what user is ahead 
 by 
 wins. What I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 



 /dps

  



-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Anthony
Oops, sorry. You'll need to do something more sophisticated. Create an 
onkeyup handler that retrieves the value in the input and appends it to the 
URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
call $.web2py.component() with that URL, and in the org_form_load action, 
use request.args(0) instead of request.vars.name.

Anthony

On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:

 How is the name (input value) is passed in this component template/case? 
 (i click the code and the form won't load into the page.).

 On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead 
 will get submitted to the action of the parent page. You have to trap the 
 form submission and submit back to the org_form_load action. Rather than 
 using the ajax() function to load a form, you're better off loading the 
 form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always 
 get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not submitted 
 either.
 Help please...
 Thanks.



-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
ok thanks.

On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:

 Oops, sorry. You'll need to do something more sophisticated. Create an 
 onkeyup handler that retrieves the value in the input and appends it to the 
 URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
 call $.web2py.component() with that URL, and in the org_form_load action, 
 use request.args(0) instead of request.vars.name.

 Anthony

 On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:

 How is the name (input value) is passed in this component 
 template/case? (i click the code and the form won't load into the page.).

 On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead 
 will get submitted to the action of the parent page. You have to trap the 
 form submission and submit back to the org_form_load action. Rather than 
 using the ajax() function to load a form, you're better off loading the 
 form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will always 
 get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not 
 submitted either.
 Help please...
 Thanks.



-- 
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] Re: Integration with source control system

2013-12-30 Thread Dave S


On Saturday, December 28, 2013 9:13:33 PM UTC-8, Massimo Di Pierro wrote:

 Your application will be in a folder web2py/applications/yourapp. You 
 can use any version control system you like for the content of that folder. 
 this is orthogonal to web2py.


I do like the integration in the admin app with Mercurial.  (Although 
sometimes I want a little more control than just a linear hg ci *, and do 
my commit from the command line.)


/dps

 

 On Saturday, 28 December 2013 07:59:06 UTC-6, Saifuddin Rangwala wrote:


 While I make changes to my applications, is there a way to specify a 
 source control like cvs, github, perforce etc.. that I can specify 
 somewhere so that all changes that are made are tracked and that I can 
 revert back to previous change easily?

 Or anything equivalent that I can setup to achieve change tracking to my 
 application code?

 -- 
 Saif.



-- 
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] Re: I don't want 'Login Successful' or 'Success' popping up on the screen in my app.

2013-12-30 Thread Anthony
If you generally don't want flash messages, you can remove the 
response.flash code from layout.html. If you want to prevent specific 
messages, you can do so via the arguments to SQLFORM. For Auth messages, 
you can do things like:

auth.messages.logged_in = None

SQLFORM and Auth set the messages via response.flash or session.flash (in 
case a redirect is being done), so you can also do something like:

response.flash = session.flash = None

any time after the SQLFORM or Auth code has run (but before the function 
returns and the view is executed).

Anthony

On Monday, December 30, 2013 3:31:51 AM UTC-5, Keith Planer wrote:

 How do I keep session.flash and response.flash from doing their things 
 when I don't want to? Specifically I don't want the messages popping up 
 after a user logs in or when they make a new entry to the DB.


-- 
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] Re: gevent and admin app

2013-12-30 Thread Arnon Marcus
Cool, thanks.
I have been using putty and winSCP pretty extensively for about a year now - 
but I won't even need that to access the web2py app files, because I managed to 
get a samba server up and running...

What I meant by 'accessing the admin app', was that when we have a 
server-error, we can access the ticket using the web-interface, and figure out 
what's wrong.
Without that, we would have to manually copy-over the ticket (error-file) into 
a dev windows-based workstation, and use the dev-server running locally - and 
that becomes tedious pretty fast. It's actually a very common use-case, as most 
web-server deployments are on minimalist-distributions, and not all feature 
ssl... I actually would have expexted the prevalance of such a use-case to 
already be known and accounted for by now...

I am in the process of working-out porting the centos-uwsgi shell script into 
ansible roles, but that's taking a while, and I'm still not sure I wanna ditch 
gevent just-yet (at least not altogether)

Anyways, I'll check that trunc-script, thanks.

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


[web2py] Re: ValueError: invalid literal for int() with base 10: ''

2013-12-30 Thread Keith Planer
I'm having the same problem, but I'm struggling with saving the database. 
The corrupted field is a 'date' type.

On Wednesday, May 27, 2009 1:15:36 AM UTC-5, ニコノコ wrote:

 I found the source of my problem. I have records with null values. And 
 since sqlite don't enforce data typing, I assume that it simply 
 guess the data type, based on whatever is found in the first(???) 
 record. 

 On this assumption, I assigned datetime values in the empty datetime 
 fields and tested again. It's now working. 

 On May 26, 10:19 pm, Nik nikolai...@gmail.com wrote: 
  Traceback (most recent call last): 
File /home/ern/web2py/gluon/restricted.py, line 107, in restricted 
  exec ccode in environment 
File /home/ern/web2py/applications/smb/views/appadmin.html, line 
  122, in module 
File /home/ern/web2py/gluon/sqlhtml.py, line 623, in __init__ 
  for (rc, record) in enumerate(sqlrows): 
File /home/ern/web2py/gluon/sql.py, line 2196, in __iter__ 
  yield self[i] 
File /home/ern/web2py/gluon/sql.py, line 2151, in __getitem__ 
  str(value)[:10].strip().split('-')] 
  ValueError: invalid literal for int() with base 10: '' 
  
  I was trying to go to database administration of db2 when I got this 
  error. The table is defined as follows: 
  
  db2.define_table('msg_log', 
  SQLField('type', 'string'), 
  SQLField('smsc', 'string'), 
  SQLField('sent', 'datetime'), 
  SQLField('received', 'datetime'), 
  SQLField('sender', 'string'), 
  SQLField('receiver', 'string'), 
  SQLField('msgid', 'string'), migrate=False)

-- 
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] Re: REF: Date format

2013-12-30 Thread Niphlod
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.


[web2py] Re: gevent and admin app

2013-12-30 Thread Niphlod
if you're using putty then why don't you use port forwarding ? that's 
definitely the easier (and secure) way to go.

summary: using putty, go to connections--ssh--tunnels, put *8000* (or 
whatever port gevent is listening to) into source port, put 
*localhost:8000*into destination and voilà. if you use 
http://localhost:8000 in your 
pc's browser (the one running putty) the 8000 port is actually the one on 
the server, so you're able to read tickets and so on.

On Monday, December 30, 2013 8:25:34 PM UTC+1, Arnon Marcus wrote:

 Cool, thanks.
 I have been using putty and winSCP pretty extensively for about a year now 
 - but I won't even need that to access the web2py app files, because I 
 managed to get a samba server up and running...

 What I meant by 'accessing the admin app', was that when we have a 
 server-error, we can access the ticket using the web-interface, and figure 
 out what's wrong.
 Without that, we would have to manually copy-over the ticket (error-file) 
 into a dev windows-based workstation, and use the dev-server running 
 locally - and that becomes tedious pretty fast. It's actually a very common 
 use-case, as most web-server deployments are on minimalist-distributions, 
 and not all feature ssl... I actually would have expexted the prevalance of 
 such a use-case to already be known and accounted for by now...

 I am in the process of working-out porting the centos-uwsgi shell script 
 into ansible roles, but that's taking a while, and I'm still not sure I 
 wanna ditch gevent just-yet (at least not altogether)

 Anyways, I'll check that trunc-script, thanks.



-- 
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: gevent and admin app

2013-12-30 Thread Arnon Marcus
That sounds totally cool!
Didn't know this can be done...


On Mon, Dec 30, 2013 at 10:14 PM, Niphlod niph...@gmail.com wrote:

 if you're using putty then why don't you use port forwarding ? that's
 definitely the easier (and secure) way to go.

 summary: using putty, go to connections--ssh--tunnels, put *8000* (or
 whatever port gevent is listening to) into source port, put
 *localhost:8000* into destination and voilà. if you use
 http://localhost:8000 in your pc's browser (the one running putty) the
 8000 port is actually the one on the server, so you're able to read tickets
 and so on.


 On Monday, December 30, 2013 8:25:34 PM UTC+1, Arnon Marcus wrote:

 Cool, thanks.
 I have been using putty and winSCP pretty extensively for about a year
 now - but I won't even need that to access the web2py app files, because I
 managed to get a samba server up and running...

 What I meant by 'accessing the admin app', was that when we have a
 server-error, we can access the ticket using the web-interface, and figure
 out what's wrong.
 Without that, we would have to manually copy-over the ticket (error-file)
 into a dev windows-based workstation, and use the dev-server running
 locally - and that becomes tedious pretty fast. It's actually a very common
 use-case, as most web-server deployments are on minimalist-distributions,
 and not all feature ssl... I actually would have expexted the prevalance of
 such a use-case to already be known and accounted for by now...

 I am in the process of working-out porting the centos-uwsgi shell script
 into ansible roles, but that's taking a while, and I'm still not sure I
 wanna ditch gevent just-yet (at least not altogether)

 Anyways, I'll check that trunc-script, thanks.

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/4gBGPxJdGHY/unsubscribe.
 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.


-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
It works only till the alert...

script
function insert_component(org_code)
{
alert(org_code);
$.web2py.component('%s', 'org_form_target'); % URL('default', 
'org_form_load.load/org_code');
}
/script

On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:

 ok thanks.

 On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:

 Oops, sorry. You'll need to do something more sophisticated. Create an 
 onkeyup handler that retrieves the value in the input and appends it to the 
 URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
 call $.web2py.component() with that URL, and in the org_form_load action, 
 use request.args(0) instead of request.vars.name.

 Anthony

 On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:

 How is the name (input value) is passed in this component 
 template/case? (i click the code and the form won't load into the page.).

 On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead 
 will get submitted to the action of the parent page. You have to trap the 
 form submission and submit back to the org_form_load action. Rather than 
 using the ajax() function to load a form, you're better off loading the 
 form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will 
 always get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', ['name'], 
 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not 
 submitted either.
 Help please...
 Thanks.



-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Anthony
$.web2py.component('%s', 'org_form_target'); % URL('default', 
'org_form_load.load/org_code');

is actually Python code that generates Javascript, so you cannot use it as 
you are using it. Instead, I would create the url variable separately:

function insert_component(org_code)
{
alert(org_code);
var url = '{{=URL('default', 'org_form_load.load/org_code')}}';
$.web2py.component(url, 'org_form_target');
}

Note the URL is generated in Python, hence its inclusion within the {{...}} 
template delimiters.

Anthony

On Monday, December 30, 2013 3:58:10 PM UTC-5, Avi A wrote:

 It works only till the alert...

 script
 function insert_component(org_code)
 {
 alert(org_code);
 $.web2py.component('%s', 'org_form_target'); % URL('default', 
 'org_form_load.load/org_code');
 }
 /script

 On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:

 ok thanks.

 On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:

 Oops, sorry. You'll need to do something more sophisticated. Create an 
 onkeyup handler that retrieves the value in the input and appends it to the 
 URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
 call $.web2py.component() with that URL, and in the org_form_load action, 
 use request.args(0) instead of request.vars.name.

 Anthony

 On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:

 How is the name (input value) is passed in this component 
 template/case? (i click the code and the form won't load into the page.).

 On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but instead 
 will get submitted to the action of the parent page. You have to trap 
 the 
 form submission and submit back to the org_form_load action. Rather than 
 using the ajax() function to load a form, you're better off loading the 
 form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will 
 always get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', 
 ['name'], 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not 
 submitted either.
 Help please...
 Thanks.



-- 
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] Re: with ajax load, getting form failure alert before form was submitted

2013-12-30 Thread Avi A
I was in the direction in one of the tries...
Thanks.

On Monday, December 30, 2013 11:17:44 PM UTC+2, Anthony wrote:

 $.web2py.component('%s', 'org_form_target'); % URL('default', 
 'org_form_load.load/org_code');

 is actually Python code that generates Javascript, so you cannot use it as 
 you are using it. Instead, I would create the url variable separately:

 function insert_component(org_code)
 {
 alert(org_code);
 var url = '{{=URL('default', 'org_form_load.load/org_code')}}';
 $.web2py.component(url, 'org_form_target');
 }

 Note the URL is generated in Python, hence its inclusion within the 
 {{...}} template delimiters.

 Anthony

 On Monday, December 30, 2013 3:58:10 PM UTC-5, Avi A wrote:

 It works only till the alert...

 script
 function insert_component(org_code)
 {
 alert(org_code);
 $.web2py.component('%s', 'org_form_target'); % URL('default', 
 'org_form_load.load/org_code');
 }
 /script

 On Monday, December 30, 2013 8:27:00 PM UTC+2, Avi A wrote:

 ok thanks.

 On Monday, December 30, 2013 8:24:04 PM UTC+2, Anthony wrote:

 Oops, sorry. You'll need to do something more sophisticated. Create an 
 onkeyup handler that retrieves the value in the input and appends it to 
 the 
 URL of the form action (i.e., /default/org_form_load.load/some_name). Then 
 call $.web2py.component() with that URL, and in the org_form_load action, 
 use request.args(0) instead of request.vars.name.

 Anthony

 On Monday, December 30, 2013 12:56:19 PM UTC-5, Avi A wrote:

 How is the name (input value) is passed in this component 
 template/case? (i click the code and the form won't load into the page.).

 On Monday, December 30, 2013 7:49:32 PM UTC+2, Avi A wrote:

 Thanks. I will look into it.
 Happy new year! and thanks for all the awesome support!

 On Monday, December 30, 2013 7:47:48 PM UTC+2, Anthony wrote:

 The form won't get submitted to the org_form_load action, but 
 instead will get submitted to the action of the parent page. You have 
 to 
 trap the form submission and submit back to the org_form_load action. 
 Rather than using the ajax() function to load a form, you're better off 
 loading the form via an Ajax component:

 onkeyup={{=$.web2py.component('%s', 'org_form_target'); % 
 URL('default', 'org_form_load.load')}}

 Anthony

 On Monday, December 30, 2013 12:18:33 PM UTC-5, Avi A wrote:

 Thanks,
 It solved the error getting after the form is loaded into the page,
 but still nothing happen if I submit the form.
 This is what I do:
 if form.process().accepted:
 response.flash = 'Success!'
 elif form.errors:
 response.flash = 'response errors'


 On Monday, December 30, 2013 6:14:57 PM UTC+2, Anthony wrote:

 The form is not accepted when it is first created, so you will 
 always get that error message. Instead, you want:

 elif form.errors:
 response.flash = 'There was an error..'

 Anthony

 On Monday, December 30, 2013 10:21:58 AM UTC-5, Avi A wrote:

 Hi,
 I have this on the view:

 div
input name=name onkeyup=ajax('org_form_load.load', 
 ['name'], 'org_form_target') /
 /div
 div id = org_form_target/div

 and something like this on the controller:

 def org_form_load():
 org_code = request.vars.name
 org_code_name = db(..).select(..)
 if org_code_name:
 db.t_org_members.f_org_member.default = auth.user.id
 form = 
 SQLFORM(db.t_org_members,onupdate=auth.archive,submit_button= 
 'something...')
 if form.process().accepted:
 response.flash = 'Success!'
 else:
 response.flash = 'There was an error..'
 return dict(form = form, org_code_name = org_code_name)
 and on the org_form_load:

 {{=form}}



 (Before moving the form into the load page, everything went fine.)
 After moving the form to the load page, this is what it does:
 User fill correctly the organization code.
 The form appears as expected, (but not submitted yet)
 BUT I already get the  response.flash = 'There was an error..'.
 If I try to submit the form nothing flashes and form is not 
 submitted either.
 Help please...
 Thanks.



-- 
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] What is the purpose of data-w2p_disable_with?

2013-12-30 Thread User
Links I build with the anchor A html helper look like:

a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor 
Text/a

What is the purpose of the data-w2p_disable_with = default attribute and 
how can I remove it?

-- 
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] Re: What is the purpose of data-w2p_disable_with?

2013-12-30 Thread Anthony
That's so the link can be temporarily disabled (the text will be replaced 
with Working...) when it is used to trigger an Ajax request. However, I 
don't know why it's included in the anchor tag in all cases -- seems like 
it would only be needed when the cid, component, or callback 
arguments are used.

Anthony

On Monday, December 30, 2013 5:39:53 PM UTC-5, User wrote:

 Links I build with the anchor A html helper look like:

 a href=/myapp/mycontroller/view/5 data-w2p_disable_with=defaultAnchor 
 Text/a

 What is the purpose of the data-w2p_disable_with = default attribute and 
 how can I remove it?



-- 
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] always get This webpage has a redirect loop if use google oauth2

2013-12-30 Thread Wei Li
I am trying to make a tiny example to login my app via google oauth2. 
However, I always got  This webpage has a redirect loop error from the 
browser if I use @auth.requires_login() pragma.

Model Code:
from gluon.contrib.login_methods.oauth20_account import OAuthAccount
auth.settings.login_form=OAuthAccount(
 client_id=XXX.apps.googleusercontent.com,
 client_secret=YYY,
 auth_url=https://accounts.google.com/o/oauth2/auth;,
 token_url=https://accounts.google.com/o/oauth2/token;,
 scope=openid profile email)


Controller code:
@auth.requires_login()
def index():
return dict(message=index)


Redirect URL set in google API console: 
https://www.limijd.me/example_oauth2/default/user/login


I have tried to use web2py's build-in local authentication method by 
removing my code in model instead of using oauth2. Then the URL redirecting 
is good.

I have read the web2py manual book, in 9.1.2, it says for Janrain:
When a new user logins for the first time, web2py creates a new db.auth_user 
record associated to the user. It will use the registration_id field to 
store a unique id for the user.


However for OAuth2 login, apparently there is no new record created in 
db.auth_user like what web2py will do for Janrain. My suspicion is even I 
successfully logged in via OAuth2, web2py still doesn't consider I was 
logged in. I have removed the @auth.requires_login() and I am able to get 
the valid accessToken(). 

Please help if you know what could be the issue... 

Thanks a lot.
Wei



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