Re: [web2py] Re: Huge amount of data slowing page loads...

2010-01-27 Thread Jason Brower
It's nice... but can I get it to work with things like in my example...
Where I press a and it gives me
Army
Jane
Jason
Gane
Best Regards,
Jason
On Tue, 2010-01-26 at 23:55 -0800, desfrenes wrote: 
 this works like a charm: http://docs.jquery.com/Plugins/Autocomplete
 
 On 27 jan, 08:24, Jason Brower encomp...@gmail.com wrote:
  I have a database with 16k entries in it...
  I have a one to many relation with them.
  When I create a form with the requiers=IS_ID_DB() feature I notice a
  huge lag in page load time. (I would to if I had 16k entries in one drop
  down too.)
  Is there a way to do this similar to the autocompletion but have it so I
  can search for any part of it. (Like the awesome bar in firefox)
  So I have
  Jason
  Jane
  John
  Gane
  and when I press a it gives:
  Jason
  John
  Gane
  and so forth.
  Best Regards,
  Jason Brower
 


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



[web2py] Fields in the SQLTable running in GAE

2010-01-27 Thread Leandro - ProfessionalIT
Hi,
   I have a table (pampa_produto) with many fields (and many
records), but when I try show only two fields of this table in a page
in GAE, ever show me ALL fields of the table.

In my controller:
myfields = [db.pampa_produto.id, db.pampa_produto.codigo,
db.pampa_produto.nome_compra]
rows = db(db.pampa_produto.id0).select(*myfields)

# this too show all fields
#rows = db(db.pampa_produto.id0).select(db.pampa_produto.id,
db.pampa_produto.codigo, db.pampa_produto.nome_compra)

items = SQLTABLE(rows)

In my page:
   {{=items}}

Its a bug ?

-- Leandro.

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



[web2py] create folder in view when new controller is made

2010-01-27 Thread Jason Brower
It would be nifty if the folder for a newly created controller file was
made.
What do you think?
---
Jason


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



[web2py] point to line of error in built in editor

2010-01-27 Thread Jason Brower
It would be nice if the line where the error accured would be pointed to
in the editor when you go to edit the file.
BR,
Jason Brower

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



[web2py] Question about SQLFORM flow

2010-01-27 Thread leone
I have a question.
In flow SQLFORM, accepts etc. when SQLFORM (and the its field values)
is rendered as html script so that is updatable only by javascript
functions added to returned code?
Thanks
leone

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



Re: [web2py] Re: JOB POST: I need a Web2Py Developer

2010-01-27 Thread Alexandre Andrade
Response to the list, not private

2010/1/26 mdipierro mdipie...@cs.depaul.edu

 for what?

 On Jan 26, 2:24 pm, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  I apologize.
 
  2010/1/26 Alexandre Andrade alexandrema...@gmail.com
 
 
 
   Mr.,
 
   I'm insterested in your offer.
 
   My websites, hipercenter.com/init and hipercenter.com/ciclismo are in
   web2py.
 
   I wish to receive the details of project.
 
   --
 
   --
   =
   Alexandre Andrade
   Hipercenter.com
 
   2010/1/25 tweety76 tweetych...@gmail.com
 
   I manage 2 websites that sell prepaid phonecards in the internet. I
   need a developer who can .create another site for me in web2py. I
 would
   like it in web2py since I am learning the platform and the language
   and I would like to have the website on a language and platform that I
   am learning right now. Please pm me privately if you are interested in
   developing this for me so we can discuss the details.
 
   I need the website in a month if possible.
 
   --
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
  --
  Atenciosamente
 
  --
  =
  Alexandre Andrade
  Hipercenter.com

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




-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

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



[web2py] Re: JOB POST: I need a Web2Py Developer

2010-01-27 Thread Richard
perhaps because OP asked for private reply.


On Jan 27, 8:33 am, mdipierro mdipie...@cs.depaul.edu wrote:
 for what?

 On Jan 26, 2:24 pm, Alexandre Andrade alexandrema...@gmail.com
 wrote:



  I apologize.

  2010/1/26 Alexandre Andrade alexandrema...@gmail.com

   Mr.,

   I'm insterested in your offer.

   My websites, hipercenter.com/init and hipercenter.com/ciclismo are in
   web2py.

   I wish to receive the details of project.

   --

   --
   =
   Alexandre Andrade
   Hipercenter.com

   2010/1/25 tweety76 tweetych...@gmail.com

   I manage 2 websites that sell prepaid phonecards in the internet. I
   need a developer who can .create another site for me in web2py. I would
   like it in web2py since I am learning the platform and the language
   and I would like to have the website on a language and platform that I
   am learning right now. Please pm me privately if you are interested in
   developing this for me so we can discuss the details.

   I need the website in a month if possible.

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

  --
  Atenciosamente

  --
  =
  Alexandre Andrade
  Hipercenter.com

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



[web2py] Re: Calling a SQLFORM through AJAX

2010-01-27 Thread Khaled ElAdawy
Many thanks,
formname=None have solved the problem

On Jan 25, 5:03 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Hard to say without looking at the code.
 I assume there is an accepts in the controller. Try call it with
 accepts(request.vars,formname=None)
 instead of
 accepts(request.vars,session)

 On Jan 25, 9:00 am, Khaled ElAdawy elad...@gmail.com wrote:



  I created a controller function that could be called through ajax and
  returns a SQLFORM.
  I've got the form to appear on the page, but the SQLFORM doesn't work
  as it should.
  When I submit information from the view that the generated content has
  been placed into,
  the page refreshes and nothing is inserted/updated in the database.
  When I call the controller function directly, it works fine and the
  submitted
  data is inserted/updated in the database properly.

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



[web2py] Re: Web2py for PHP

2010-01-27 Thread Beerc
Don't mock the humpbacked, please :).

The correct syntax is Windows-like, to ease the work of the PHP
interpreter:
namespaces\that\look\like\paths

Quote: Of course, it would be great if PHP used a ‘.’ period for
public methods, static methods, and namespaces. That would make it
consistent with Java, C#, JavaScript, Python and many other languages.
Unfortunately, PHP’s history and backwards compatibility makes that
difficult to achieve.

According to PHP traditions, there are many exceptions in teh usage:
* Nested namespaces aren't allowed.
* Neither functions nor constants can be imported via the use
statement, use statements affects only namespaces and class names.
* You must prepend '\' before global names (global class names,
function names etc.).
* If you want to define a constant in a namespace, you will need to
specify the namespace in your call to define(), but class and function
names inside namespace are automatically prefixed with the namespace
name.
* The namespace declaration statement must be the very first statement
in the file.

According to PHP traditions, there are some performance hits in teh
usage:
* Inside namespaces, calls to unqualified functions are resolved at
run-time.
* Inside namespaces, calls to unqualified or qualified class names
(not _fully_ qualified class names) are resolved at run-time.
* Calls to internal functions in namespaces are slower, because PHP
first looks for such function in the current namespace.
* Calls to static methods are slower, because PHP first tries to look
for corresponding function in namespace.

On Jan 26, 4:57 pm, pistacchio pistacc...@gmail.com wrote:
 you are right, desfrenes, it has namespace (indeed, it has gained
 namespaces only lately), but, talking about elegance, adding
 namespaces/that/look/like/paths is not what i consider a wow design
 decision :)

 On Jan 26, 1:49 pm, desfrenes desfre...@gmail.com wrote:

  You're right, Python is (much more) elegant. But you're wrong, PHP has
  namespaces.

  On 25 jan, 18:27, pistacchio pistacc...@gmail.com wrote:

   python is a very elegant and mature language. php has gained a huge
   popularity more for the moment when it came out that for the goodness
   of the language itself. it has a broken object system, no namespaces
   and so on.

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



[web2py] Re: uWSGI + Cherokee + web2py - a howto.

2010-01-27 Thread Adi
Hi Ivan,

I followed this howto, and when I try to access the application I get
an internal error thrown by web2py:
Ticket issued: unknown

Any idea how to read contents of this ticket to debug?

On Jan 15, 3:14 am, Ivan P ivanv...@gmail.com wrote:
 Inspired by Phyo Arkar's howto on setting up web2py with Cherokee and
 FCGI I tried the setup, but was somewhat unsatisfied with the fcgi
 method and decided to try uWSGI. I am happy I did so, since it proved
 to be real easy and uWSGI is a real powerhouse and deserves attention
 of the whole python webdev community. On to the howto.

 I. Compile from source and run the latest uWSGI, 0.9.3 in my case
 (available herehttp://projects.unbit.it/uwsgi/wiki).
 1. Download the source from and unzip.

 2. To compile you must install packages python-dev and libxml2-dev (at
 least thats what they are called on a debian-based system)

 3. When compiling simply run pick a makefile which matches your OS and
 python version and run something like make -f Makefile.Linux.Py26.
 This produces only one executable named uwsgi26, where 26 is my python
 version. You can put it in /usr/local/bin.

 5. To run it, you have two options:

 5a) Create an xml file and call it, for example, config.xml. Put
 something like this in it:
 uwsgi
     pythonpath/var/web2py//pythonpath
     app mountpoint=/
     scriptwsgihandler/script
     /app
 /uwsgi
 In this file pythonpath is where your web2py directory is and
 script is the file you want to run, in this case its web2py's
 wsgihandler.py. Now run uWSGI like this, but replace www-data with
 the owner of your web2py directory, if its the same as your current
 user omit the sudo command:
 sudo -u www-data uwsgi26 -s /tmp/uwsgi.sock -C -x config.xml
 Why you need to change user is because web2py writes things (session
 data for example) to disc during execution, so the uwsgi process,
 which runs the web2py code, has to be the owner of the directories
 that contain the framework. Note that uwsgi now opened a socket we
 called /tmp/uwsgi.sock About other options consult the uwsgi manual
 or uwsgi -h.

 5b) You can omit the xml file and pass all the info via command line,
 doing that is easy, so consult the uwsgi docs :)

 II. Setting up cherokee (0.99.37 in my case).
 1. Install it, run cherokee-admin, go to localhost:9090

 2. Open Information Sources and create a new one with these
 parameters:
 Nick: web2py
 Connection: /tmp/uwsgi.sock
 Interpreter: uwsgi26 -s /tmp/uwsgi.sock -C -x /path/to/config.xml
 The interpreter line is why it is a good idea to have your web2py
 source owned by www-data or the Cherokee server's user - when cherokee
 runs it, you can be sure that owners of the sources and process match.
 And of  course put the correct path in.

 3. Go to Virtual Servers and edit the default one, or you can create
 a new one, but make sure you give it a domain name to avoid conflict
 (not really sure what happens when they conflict).

 4. Go to the Behavior section and edit the Default behavior.

 5. Set the Handler to uWSGI and on the bottom set the information
 source to web2py

 6. Pick Hard restart from the dropdown on the left and click Save.
 TO PREVENT HEADACHE READ THIS: I seem to get inconsistent results with
 these restarts, so if you're doing production it seems to me that one
 should restart the server manualy (via /etc/init.d/cherokee restart,
 that is). Or maybe I should RTFM.

 6. Go to localhost and BAM! (or at least I hope its a bam). veeery
 easy if all goes smooth.

 But wait, what about url rewriting? was my thought, and this caused
 much confusion, so I'll add a section on that.

 III. Doing some redirection (I'll give few examples due to poor
 knowledge of regex).
 Lets redirect localhost/ to /myapp/cntrlr/index
 1. Go back to the Behavior section of your server.

 2. Add a new rule and set it's type to Regular Expression and set
 the regular expression to ^/$, this simply matches localhost/ or
 localhost, nothing more, nothing less.

 3. Go to the Handler section and set the rule to Redirect with
 these parameters
 Type: Internal
 Regular Expression:     (yes, blank)
 Substitution: /myapp/cntrlr/index
 The regular expression is blank because for this scenario we did all
 the matching while defining a new behavior, you can combine the two in
 creative ways.

 That's about all. Your imagination should take care of the rest. I,
 for example, put my static files separately from the framework by
 creating a behavior that points to /static and picking static
 files as the handler.
 Thanks to Massimo DiPierro for web2py and Phyo Arkar for his cherokee
 howto.
 I'm not much of a writer so feel free to ask for clarifications.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 

[web2py] Re: Web2py for PHP

2010-01-27 Thread desfrenes
Yes, they're very far from perfect... but still they have the effects
of removing the need for those
Incredibly_Stupid_Long_Class_Names_That_You_Find_In_Those_Bloated_Frameworks,
just like
Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive.
That alone is worth the switch from 5.2 to 5.3 (plus you get closures,
new gc, etc...)

As for the original question of this thread, maybe you should look at
this: http://pluf.org/  The author says this has been modeled after
django. On the DAL/ORM side I would recommend redbean (http://
www.redbeanphp.com/) for the ease of use (see also
http://www.desfrenes.com/active-record-like-layer-for-redbean.html).
You'll also miss the cross-database capability of web2py. I have used
Doctrine in the past I found that it uses too much memory (and it
feels more like a design pattern demo than a pragmatic solution).

As for the pyhon/php debate, it's very clear that python is vastly
superior in all design aspects. Too bad their respective market share
don't follow this trend :-(

On 27 jan, 13:09, Beerc berces.las...@fomi.hu wrote:
 Don't mock the humpbacked, please :).

 The correct syntax is Windows-like, to ease the work of the PHP
 interpreter:
     namespaces\that\look\like\paths

 Quote: Of course, it would be great if PHP used a ‘.’ period for
 public methods, static methods, and namespaces. That would make it
 consistent with Java, C#, JavaScript, Python and many other languages.
 Unfortunately, PHP’s history and backwards compatibility makes that
 difficult to achieve.

 According to PHP traditions, there are many exceptions in teh usage:
 * Nested namespaces aren't allowed.
 * Neither functions nor constants can be imported via the use
 statement, use statements affects only namespaces and class names.
 * You must prepend '\' before global names (global class names,
 function names etc.).
 * If you want to define a constant in a namespace, you will need to
 specify the namespace in your call to define(), but class and function
 names inside namespace are automatically prefixed with the namespace
 name.
 * The namespace declaration statement must be the very first statement
 in the file.

 According to PHP traditions, there are some performance hits in teh
 usage:
 * Inside namespaces, calls to unqualified functions are resolved at
 run-time.
 * Inside namespaces, calls to unqualified or qualified class names
 (not _fully_ qualified class names) are resolved at run-time.
 * Calls to internal functions in namespaces are slower, because PHP
 first looks for such function in the current namespace.
 * Calls to static methods are slower, because PHP first tries to look
 for corresponding function in namespace.

 On Jan 26, 4:57 pm, pistacchio pistacc...@gmail.com wrote:

  you are right, desfrenes, it has namespace (indeed, it has gained
  namespaces only lately), but, talking about elegance, adding
  namespaces/that/look/like/paths is not what i consider a wow design
  decision :)

  On Jan 26, 1:49 pm, desfrenes desfre...@gmail.com wrote:

   You're right, Python is (much more) elegant. But you're wrong, PHP has
   namespaces.

   On 25 jan, 18:27, pistacchio pistacc...@gmail.com wrote:

python is a very elegant and mature language. php has gained a huge
popularity more for the moment when it came out that for the goodness
of the language itself. it has a broken object system, no namespaces
and so on.

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



[web2py] Re: Web2py for PHP

2010-01-27 Thread desfrenes
oh...

You must prepend '\' before global names (global class names,
function names etc.

Wrong, global functions names don't need this. But then that makes it
another exception ;-)

On 27 jan, 13:09, Beerc berces.las...@fomi.hu wrote:
 Don't mock the humpbacked, please :).

 The correct syntax is Windows-like, to ease the work of the PHP
 interpreter:
     namespaces\that\look\like\paths

 Quote: Of course, it would be great if PHP used a ‘.’ period for
 public methods, static methods, and namespaces. That would make it
 consistent with Java, C#, JavaScript, Python and many other languages.
 Unfortunately, PHP’s history and backwards compatibility makes that
 difficult to achieve.

 According to PHP traditions, there are many exceptions in teh usage:
 * Nested namespaces aren't allowed.
 * Neither functions nor constants can be imported via the use
 statement, use statements affects only namespaces and class names.
 * You must prepend '\' before global names (global class names,
 function names etc.).
 * If you want to define a constant in a namespace, you will need to
 specify the namespace in your call to define(), but class and function
 names inside namespace are automatically prefixed with the namespace
 name.
 * The namespace declaration statement must be the very first statement
 in the file.

 According to PHP traditions, there are some performance hits in teh
 usage:
 * Inside namespaces, calls to unqualified functions are resolved at
 run-time.
 * Inside namespaces, calls to unqualified or qualified class names
 (not _fully_ qualified class names) are resolved at run-time.
 * Calls to internal functions in namespaces are slower, because PHP
 first looks for such function in the current namespace.
 * Calls to static methods are slower, because PHP first tries to look
 for corresponding function in namespace.

 On Jan 26, 4:57 pm, pistacchio pistacc...@gmail.com wrote:

  you are right, desfrenes, it has namespace (indeed, it has gained
  namespaces only lately), but, talking about elegance, adding
  namespaces/that/look/like/paths is not what i consider a wow design
  decision :)

  On Jan 26, 1:49 pm, desfrenes desfre...@gmail.com wrote:

   You're right, Python is (much more) elegant. But you're wrong, PHP has
   namespaces.

   On 25 jan, 18:27, pistacchio pistacc...@gmail.com wrote:

python is a very elegant and mature language. php has gained a huge
popularity more for the moment when it came out that for the goodness
of the language itself. it has a broken object system, no namespaces
and so on.

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



[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread mdipierro
The ids are only used for CSS. you can do

form1=SQLFORM(...,_class='form1')
form1.accepts(request.post_vars,formname=None)
form2=SQLFORM(...,_class='form2')
form2.accepts(request.post_vars,formname=None)
return dict(form1=form1,form2=form2)

and you can use the class to refer to the id of the first or the
second in CSS. There should be no ambiguity.

Massimo


On Jan 27, 12:23 am, Jeremy Dillworth jdillwo...@gmail.com wrote:
 I'm building an app where I am likely to want multiple SQLFORMs on the
 same view.

 Reading the manual I can see how this works using the formname
 argument on the SQLFORM.accepts method.

 I'm a little concerned about the HTML side of things, though. I've
 noticed that the HTML generated by default contains lots ids that will
 be duplicates if you have multiple forms (e.g. tr
 id=submit_record__row).

   I'll probably want to write custom forms in my own HTML in the long-
 run anyway, but it looks like a lot of these ids could be CSS classes
 and maybe save me some trouble in cases where the SQLFORM default HTML
 is otherwise 'good enough' (in fact I've been having some fun and have
 a short function using xml.dom.minidom.parseString to move the ids to
 the class attribute and it seems to work ok).

 Is there any reason why the ids are needed (other than CSS perhaps)?

 If not, any chance of a future version of web2py using these as
 classnames?

 Thanks in advance and thanks for a cool web framework,

 Jeremy

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



Re: [web2py] Re: Issues with join...

2010-01-27 Thread Jason Brower
I have the paint table and the order_que...
I wnat to join them to show only tables that have a que_letter. (Not
none but anything else.)
BR,
Jason Brower

On Wed, 2010-01-27 at 06:21 -0800, mdipierro wrote: 
 This is not a valid DAL query
 plate_que = db((db.order_que.que_letter != None)==db.paint.name).select
 ()
 (a!=b)==c?
 
 can you say in words (or in SQL) what you need to do?
 
 Massimo
 
 On Jan 27, 12:49 am, Jason Brower encomp...@gmail.com wrote:
  I have a database as follow:
  # coding: utf8
  from datetime import datetime, date, time
  now = datetime.utcnow()
  today = date.today()
 
  db = SQLDB('sqlite://paint.sqlite')
 
  db.define_table('order_que',
  Field('customer_code', length=30),
  Field('paint'),
  Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
  Litre', '30 Litre'])),
  Field('pickup_time'),
  Field('que_letter',
  requires=IS_IN_SET([None,A,B,C,D,E,F])))
 
  db.define_table('paint',
  Field('name', length=30, requires=IS_NOT_EMPTY(), unique=True),
  Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
  Field('hex_color', length=6))
 
  db.define_table('tint',
  Field('name', length=3, requires=IS_NOT_EMPTY()))
 
  db.define_table('paint_tints',
  Field('paint_id', db.paint),
  Field('tint_id', db.tint),
  Field('units', 'integer'))
 
  db.order_que.paint.requires = IS_IN_DB(db, 'paint.id',  '%(name)s')
  db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
  db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
  db.order_que.customer_code.requires=IS_NOT_EMPTY()
 
  And I am trying to do a join like this...
  plate_que = db((db.order_que.que_letter != None) ==
  db.paint.name).select()
  But no matter what I put into order_que.que_letter I don't get any
  results.  Any ideas?
  BR,
  Jason
 


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



Re: [web2py] Re: Huge amount of data slowing page loads...

2010-01-27 Thread Thadeus Burgess
You would need to write your own levenshtien database query that returns to
jquery autocomplete.

-Thadeus




On Wed, Jan 27, 2010 at 2:20 AM, Jason Brower encomp...@gmail.com wrote:

 It's nice... but can I get it to work with things like in my example...
 Where I press a and it gives me
 Army
 Jane
 Jason
 Gane
 Best Regards,
 Jason
 On Tue, 2010-01-26 at 23:55 -0800, desfrenes wrote:
  this works like a charm: http://docs.jquery.com/Plugins/Autocomplete
 
  On 27 jan, 08:24, Jason Brower encomp...@gmail.com wrote:
   I have a database with 16k entries in it...
   I have a one to many relation with them.
   When I create a form with the requiers=IS_ID_DB() feature I notice a
   huge lag in page load time. (I would to if I had 16k entries in one
 drop
   down too.)
   Is there a way to do this similar to the autocompletion but have it so
 I
   can search for any part of it. (Like the awesome bar in firefox)
   So I have
   Jason
   Jane
   John
   Gane
   and when I press a it gives:
   Jason
   John
   Gane
   and so forth.
   Best Regards,
   Jason Brower
 


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



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



Re: [web2py] Re: uWSGI + Cherokee + web2py - a howto.

2010-01-27 Thread Thadeus Burgess
open the file on the filesystem

web2py/applications/myapp/errors/traceback_id

its a python pickle object, but you can still read good enough opening it in
a text editor.

-Thadeus




On Wed, Jan 27, 2010 at 6:56 AM, Adi aditya.sa...@gmail.com wrote:

 Hi Ivan,

 I followed this howto, and when I try to access the application I get
 an internal error thrown by web2py:
 Ticket issued: unknown

 Any idea how to read contents of this ticket to debug?

 On Jan 15, 3:14 am, Ivan P ivanv...@gmail.com wrote:
  Inspired by Phyo Arkar's howto on setting up web2py with Cherokee and
  FCGI I tried the setup, but was somewhat unsatisfied with the fcgi
  method and decided to try uWSGI. I am happy I did so, since it proved
  to be real easy and uWSGI is a real powerhouse and deserves attention
  of the whole python webdev community. On to the howto.
 
  I. Compile from source and run the latest uWSGI, 0.9.3 in my case
  (available herehttp://projects.unbit.it/uwsgi/wiki).
  1. Download the source from and unzip.
 
  2. To compile you must install packages python-dev and libxml2-dev (at
  least thats what they are called on a debian-based system)
 
  3. When compiling simply run pick a makefile which matches your OS and
  python version and run something like make -f Makefile.Linux.Py26.
  This produces only one executable named uwsgi26, where 26 is my python
  version. You can put it in /usr/local/bin.
 
  5. To run it, you have two options:
 
  5a) Create an xml file and call it, for example, config.xml. Put
  something like this in it:
  uwsgi
  pythonpath/var/web2py//pythonpath
  app mountpoint=/
  scriptwsgihandler/script
  /app
  /uwsgi
  In this file pythonpath is where your web2py directory is and
  script is the file you want to run, in this case its web2py's
  wsgihandler.py. Now run uWSGI like this, but replace www-data with
  the owner of your web2py directory, if its the same as your current
  user omit the sudo command:
  sudo -u www-data uwsgi26 -s /tmp/uwsgi.sock -C -x config.xml
  Why you need to change user is because web2py writes things (session
  data for example) to disc during execution, so the uwsgi process,
  which runs the web2py code, has to be the owner of the directories
  that contain the framework. Note that uwsgi now opened a socket we
  called /tmp/uwsgi.sock About other options consult the uwsgi manual
  or uwsgi -h.
 
  5b) You can omit the xml file and pass all the info via command line,
  doing that is easy, so consult the uwsgi docs :)
 
  II. Setting up cherokee (0.99.37 in my case).
  1. Install it, run cherokee-admin, go to localhost:9090
 
  2. Open Information Sources and create a new one with these
  parameters:
  Nick: web2py
  Connection: /tmp/uwsgi.sock
  Interpreter: uwsgi26 -s /tmp/uwsgi.sock -C -x /path/to/config.xml
  The interpreter line is why it is a good idea to have your web2py
  source owned by www-data or the Cherokee server's user - when cherokee
  runs it, you can be sure that owners of the sources and process match.
  And of  course put the correct path in.
 
  3. Go to Virtual Servers and edit the default one, or you can create
  a new one, but make sure you give it a domain name to avoid conflict
  (not really sure what happens when they conflict).
 
  4. Go to the Behavior section and edit the Default behavior.
 
  5. Set the Handler to uWSGI and on the bottom set the information
  source to web2py
 
  6. Pick Hard restart from the dropdown on the left and click Save.
  TO PREVENT HEADACHE READ THIS: I seem to get inconsistent results with
  these restarts, so if you're doing production it seems to me that one
  should restart the server manualy (via /etc/init.d/cherokee restart,
  that is). Or maybe I should RTFM.
 
  6. Go to localhost and BAM! (or at least I hope its a bam). veeery
  easy if all goes smooth.
 
  But wait, what about url rewriting? was my thought, and this caused
  much confusion, so I'll add a section on that.
 
  III. Doing some redirection (I'll give few examples due to poor
  knowledge of regex).
  Lets redirect localhost/ to /myapp/cntrlr/index
  1. Go back to the Behavior section of your server.
 
  2. Add a new rule and set it's type to Regular Expression and set
  the regular expression to ^/$, this simply matches localhost/ or
  localhost, nothing more, nothing less.
 
  3. Go to the Handler section and set the rule to Redirect with
  these parameters
  Type: Internal
  Regular Expression: (yes, blank)
  Substitution: /myapp/cntrlr/index
  The regular expression is blank because for this scenario we did all
  the matching while defining a new behavior, you can combine the two in
  creative ways.
 
  That's about all. Your imagination should take care of the rest. I,
  for example, put my static files separately from the framework by
  creating a behavior that points to /static and picking static
  files as the handler.
  Thanks to Massimo DiPierro for web2py and Phyo Arkar for his cherokee
  howto.
  I'm 

Re: [web2py] Replacing template engine

2010-01-27 Thread Timothy Farrell
IIRC, response._caller acts like a function decorator.  So it takes a 
function and returns a function.  I used to use Genshi like this:


def renderGenshi(func):
def _render():
output = func()
if not isinstance(dict, output):
return output
else:
# real Genshi render code goes here
return Genshi.render(response._view, output)
return _render

response._caller = renderGenshi

Naturally it was more complicated than that, but you get the idea.

That said, make sure Jinja2 is really what you want.  I thought I liked 
it until I learned that its context is immutable.  (This means you can't 
set response.title in a template and expect that change to propagate to 
an included or extended template file.  This was a deal-breaker for me.)


In case you're curious, I switched off of Genshi back to web2py 
templates because Genshi only works on normal cPython platforms.  It 
blows up on Jython or AIX Python.


-tim

On 1/26/2010 9:05 PM, Thadeus Burgess wrote:
Its going to be your best bet in using a different templating 
language. YOu will have to make sure to only parse your HTML requests 
and not json/download etc.


Basically, response._caller is a function, that returns a string which 
is the html.


So you would instead of response.render(d) you would do 
jinja2.render(d) where d is the dict returned from the action, you 
will of course have to tell jinja where to find templates and which 
template to render based on action


jinja.render(d, '/applications/init/views/' + request.action+'.html')

-Thadeus




On Tue, Jan 26, 2010 at 8:24 PM, Alexandre airm...@gmail.com 
mailto:airm...@gmail.com wrote:


Hi,

I want to replace web2py's template engine with Jinja 2
http://jinja.pocoo.org/2/, anyone has some experience doing
something similar? I'm trying to assign response._caller with a
custom function, but I'm not having much success, is that the
right way?

Thanks,
Alexandre Rosenfeld

Eng Comp 06 - USP São Carlos
FoG - http://fog.icmc.usp.br
IM Team - AIESEC
-- 
You received this message because you are subscribed to the Google

Groups web2py-users group.
To post to this group, send email to web2py@googlegroups.com
mailto:web2py@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com
mailto:web2py%2bunsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.


--
You received this message because you are subscribed to the Google 
Groups web2py-users group.

To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


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



Re: [web2py] Re: Web2py for PHP

2010-01-27 Thread Thadeus Burgess
**falls in love with redbean

-Thadeus




On Wed, Jan 27, 2010 at 7:43 AM, desfrenes desfre...@gmail.com wrote:

 oh...

 You must prepend '\' before global names (global class names,
 function names etc.

 Wrong, global functions names don't need this. But then that makes it
 another exception ;-)

 On 27 jan, 13:09, Beerc berces.las...@fomi.hu wrote:
  Don't mock the humpbacked, please :).
 
  The correct syntax is Windows-like, to ease the work of the PHP
  interpreter:
  namespaces\that\look\like\paths
 
  Quote: Of course, it would be great if PHP used a ‘.’ period for
  public methods, static methods, and namespaces. That would make it
  consistent with Java, C#, JavaScript, Python and many other languages.
  Unfortunately, PHP’s history and backwards compatibility makes that
  difficult to achieve.
 
  According to PHP traditions, there are many exceptions in teh usage:
  * Nested namespaces aren't allowed.
  * Neither functions nor constants can be imported via the use
  statement, use statements affects only namespaces and class names.
  * You must prepend '\' before global names (global class names,
  function names etc.).
  * If you want to define a constant in a namespace, you will need to
  specify the namespace in your call to define(), but class and function
  names inside namespace are automatically prefixed with the namespace
  name.
  * The namespace declaration statement must be the very first statement
  in the file.
 
  According to PHP traditions, there are some performance hits in teh
  usage:
  * Inside namespaces, calls to unqualified functions are resolved at
  run-time.
  * Inside namespaces, calls to unqualified or qualified class names
  (not _fully_ qualified class names) are resolved at run-time.
  * Calls to internal functions in namespaces are slower, because PHP
  first looks for such function in the current namespace.
  * Calls to static methods are slower, because PHP first tries to look
  for corresponding function in namespace.
 
  On Jan 26, 4:57 pm, pistacchio pistacc...@gmail.com wrote:
 
   you are right, desfrenes, it has namespace (indeed, it has gained
   namespaces only lately), but, talking about elegance, adding
   namespaces/that/look/like/paths is not what i consider a wow design
   decision :)
 
   On Jan 26, 1:49 pm, desfrenes desfre...@gmail.com wrote:
 
You're right, Python is (much more) elegant. But you're wrong, PHP
 has
namespaces.
 
On 25 jan, 18:27, pistacchio pistacc...@gmail.com wrote:
 
 python is a very elegant and mature language. php has gained a huge
 popularity more for the moment when it came out that for the
 goodness
 of the language itself. it has a broken object system, no
 namespaces
 and so on.

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



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



Re: [web2py] Re: bug in SQLFORM.factory?

2010-01-27 Thread Thadeus Burgess
because SQLFORM.accepts does alot more meta processing before it passes to
FORM.accepts.

-Thadeus




On Wed, Jan 27, 2010 at 8:24 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Why

 def test1():
form=SQLFORM.factory(Field(bool,boolean))

if FORM.accepts(form, request.vars, session, keepvalues=True):
db.test.insert(bool=request.vars.bool)

return dict(form=form,list=db().select(db.test.ALL))

 and not

 def test1():
form=SQLFORM.factory(Field(bool,boolean))

 if form.accepts(request.vars, session, keepvalues=True):
 db.test.insert(bool=request.vars.bool)

return dict(form=form,list=db().select(db.test.ALL))

 ?

 Please check the latter, it should work fine. I check why the former
 does not.


 On Jan 27, 1:50 am, Frederik Wagner fner...@googlemail.com wrote:
  Hi .*,
 
  it seems to me that there is a bug saving boolean fields with
  SQLFORM.factory forms.
  If I define a boolean field in a table and use the standard SQLFORM to
  make an input form, the accept function will save 'T' of 'F' to the
  DB.
  Whereas in the case where I create a form with SQLFORM.factory, do a
  FORM.accept and an explicit db.insert, instead of 'F' there will be a
  NULL on the DB.
 
  Here a test setup:
 
  DB:
  db.define_table('test',Field('bool','boolean'))
 
  CONTROLLER:
  def test1():
  form=SQLFORM.factory(Field(bool,boolean))
 
  if FORM.accepts(form, request.vars, session, keepvalues=True):
  db.test.insert(bool=request.vars.bool)
 
  return dict(form=form,list=db().select(db.test.ALL))
 
  def test2():
  form=SQLFORM(db.test)
 
  if form.accepts(request.vars, session, keepvalues=True):
  response.flash = 'done'
 
  return dict(form=form,list=db().select(db.test.ALL))
 
  test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
  'False' ('F').
 
  A bug or my problem? :-)
 
  Bye
  Frederik

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



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



Re: [web2py] Re: Question about SQLFORM flow

2010-01-27 Thread Thadeus Burgess
no.

its rendered as html, you can style it however you like with css

i think thats what you are asking?

-Thadeus




On Wed, Jan 27, 2010 at 8:27 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Please ask again. I do not understand.

 On Jan 27, 4:54 am, leone handja...@gmail.com wrote:
  I have a question.
  In flow SQLFORM, accepts etc. when SQLFORM (and the its field values)
  is rendered as html script so that is updatable only by javascript
  functions added to returned code?
  Thanks
  leone

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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
On this same topic when you define an SQLFORM.factory() it appends
'no_table' as the name.

Would it be difficult to add a way to pass a tablename to factory, so that
my CSS will stay logical when I use SQLFORM or SQLFORM.factory?

-Thadeus




On Wed, Jan 27, 2010 at 8:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 The ids are only used for CSS. you can do

 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)

 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.

 Massimo


 On Jan 27, 12:23 am, Jeremy Dillworth jdillwo...@gmail.com wrote:
  I'm building an app where I am likely to want multiple SQLFORMs on the
  same view.
 
  Reading the manual I can see how this works using the formname
  argument on the SQLFORM.accepts method.
 
  I'm a little concerned about the HTML side of things, though. I've
  noticed that the HTML generated by default contains lots ids that will
  be duplicates if you have multiple forms (e.g. tr
  id=submit_record__row).
 
I'll probably want to write custom forms in my own HTML in the long-
  run anyway, but it looks like a lot of these ids could be CSS classes
  and maybe save me some trouble in cases where the SQLFORM default HTML
  is otherwise 'good enough' (in fact I've been having some fun and have
  a short function using xml.dom.minidom.parseString to move the ids to
  the class attribute and it seems to work ok).
 
  Is there any reason why the ids are needed (other than CSS perhaps)?
 
  If not, any chance of a future version of web2py using these as
  classnames?
 
  Thanks in advance and thanks for a cool web framework,
 
  Jeremy

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



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



Re: [web2py] Replacing template engine

2010-01-27 Thread Thadeus Burgess
I dislike django-like templating languages.

I can't sit down and write a single simple django app without the need to
make a templatetag whose whole purpose is to format the data so I can use
djangos other broken tag models to display this data.

Django has the arugment well our designers arn't programmers so we cant
trust them to use python in the templates. Really? Seriously? I have yet to
come across a django developer that doesn't write his own views one way or
another. He might hire a web designer to make a site, but he still goes in
afterwords and hacks the design into his templating language. And even then
that web designer has their own knowledge of django.

/rant off

the template language is one of the most divine gifts that web2py has given
us.

-Thadeus




On Wed, Jan 27, 2010 at 9:36 AM, Timothy Farrell tfarr...@swgen.com wrote:

  IIRC, response._caller acts like a function decorator.  So it takes a
 function and returns a function.  I used to use Genshi like this:

 def renderGenshi(func):
 def _render():
 output = func()
 if not isinstance(dict, output):
 return output
 else:
 # real Genshi render code goes here
 return Genshi.render(response._view, output)
 return _render

 response._caller = renderGenshi

 Naturally it was more complicated than that, but you get the idea.

 That said, make sure Jinja2 is really what you want.  I thought I liked it
 until I learned that its context is immutable.  (This means you can't set
 response.title in a template and expect that change to propagate to an
 included or extended template file.  This was a deal-breaker for me.)

 In case you're curious, I switched off of Genshi back to web2py templates
 because Genshi only works on normal cPython platforms.  It blows up on
 Jython or AIX Python.

 -tim


 On 1/26/2010 9:05 PM, Thadeus Burgess wrote:

 Its going to be your best bet in using a different templating language. YOu
 will have to make sure to only parse your HTML requests and not
 json/download etc.

 Basically, response._caller is a function, that returns a string which is
 the html.

 So you would instead of response.render(d) you would do jinja2.render(d)
 where d is the dict returned from the action, you will of course have to
 tell jinja where to find templates and which template to render based on
 action

 jinja.render(d, '/applications/init/views/' + request.action+'.html')

 -Thadeus




 On Tue, Jan 26, 2010 at 8:24 PM, Alexandre airm...@gmail.com wrote:

 Hi,

  I want to replace web2py's template engine with Jinja 
 2http://jinja.pocoo.org/2/,
 anyone has some experience doing something similar? I'm trying to assign
 response._caller with a custom function, but I'm not having much success, is
 that the right way?

  Thanks,
 Alexandre Rosenfeld

 Eng Comp 06 - USP São Carlos
 FoG - http://fog.icmc.usp.br
 IM Team - AIESEC
  --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.


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


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


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



[web2py] Re: bug in SQLFORM.factory?

2010-01-27 Thread mdipierro
On a second look I believe FORM.accepts behave correctly. Since it is
not supposed to convert None to 'F'. Only SQLFORM.accepts does that.

On Jan 27, 8:24 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Why

 def test1():
     form=SQLFORM.factory(Field(bool,boolean))

     if FORM.accepts(form, request.vars, session, keepvalues=True):
         db.test.insert(bool=request.vars.bool)

     return dict(form=form,list=db().select(db.test.ALL))

 and not

 def test1():
     form=SQLFORM.factory(Field(bool,boolean))

     if form.accepts(request.vars, session, keepvalues=True):
         db.test.insert(bool=request.vars.bool)

     return dict(form=form,list=db().select(db.test.ALL))

 ?

 Please check the latter, it should work fine. I check why the former
 does not.

 On Jan 27, 1:50 am, Frederik Wagner fner...@googlemail.com wrote:

  Hi .*,

  it seems to me that there is a bug saving boolean fields with
  SQLFORM.factory forms.
  If I define a boolean field in a table and use the standard SQLFORM to
  make an input form, the accept function will save 'T' of 'F' to the
  DB.
  Whereas in the case where I create a form with SQLFORM.factory, do a
  FORM.accept and an explicit db.insert, instead of 'F' there will be a
  NULL on the DB.

  Here a test setup:

  DB:
  db.define_table('test',Field('bool','boolean'))

  CONTROLLER:
  def test1():
      form=SQLFORM.factory(Field(bool,boolean))

      if FORM.accepts(form, request.vars, session, keepvalues=True):
          db.test.insert(bool=request.vars.bool)

      return dict(form=form,list=db().select(db.test.ALL))

  def test2():
      form=SQLFORM(db.test)

      if form.accepts(request.vars, session, keepvalues=True):
          response.flash = 'done'

      return dict(form=form,list=db().select(db.test.ALL))

  test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
  'False' ('F').

  A bug or my problem? :-)

  Bye
  Frederik



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



[web2py] Re: Issues with join...

2010-01-27 Thread mdipierro
I think you want:

db.define_table('paint',
Field('name', length=30, requires=IS_NOT_EMPTY(),
unique=True),
Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
Field('hex_color', length=6),
format='%(name)s')

db.define_table('tint',
Field('name', length=3, requires=IS_NOT_EMPTY()),
format='%(name)s')

db.define_table('paint_tints',
Field('paint_id', db.paint),
Field('tint_id', db.tint),
Field('units', 'integer'))

volume = IS_IN_SET(['½ Litre', '1 Litre', '10 Litre', '30 Litre'])
letters = IS_EMPTY_OR(IS_IN_SET([A,B,C,D,E,F]))

db.define_table('order_que',
Field('customer_code', length=30,requires=IS_NOT_EMPTY()),
Field('paint',db.paint), ###  this was wrong
Field('can_size',requires=volume),
Field('pickup_time'),
Field('que_letter',requires=letters))

# these are all automatic because of format above
#db.order_que.paint.requires = IS_IN_DB(db, 'paint.id',  '%(name)s')
#db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
#db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
#db.order_que.customer_code.requires=IS_NOT_EMPTY()

and your select:

plate_que = db(db.order_que.que_letter!=None)
(db.order_que.paint==db.paint.id).select()


On Jan 27, 9:19 am, Jason Brower encomp...@gmail.com wrote:
 I have the paint table and the order_que...
 I wnat to join them to show only tables that have a que_letter. (Not
 none but anything else.)
 BR,
 Jason Brower

 On Wed, 2010-01-27 at 06:21 -0800, mdipierro wrote:
  This is not a valid DAL query
  plate_que = db((db.order_que.que_letter != None)==db.paint.name).select
  ()
  (a!=b)==c?

  can you say in words (or in SQL) what you need to do?

  Massimo

  On Jan 27, 12:49 am, Jason Brower encomp...@gmail.com wrote:
   I have a database as follow:
   # coding: utf8
   from datetime import datetime, date, time
   now = datetime.utcnow()
   today = date.today()

   db = SQLDB('sqlite://paint.sqlite')

   db.define_table('order_que',
           Field('customer_code', length=30),
           Field('paint'),
           Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
   Litre', '30 Litre'])),
           Field('pickup_time'),
           Field('que_letter',
   requires=IS_IN_SET([None,A,B,C,D,E,F])))

   db.define_table('paint',
           Field('name', length=30, requires=IS_NOT_EMPTY(), unique=True),
           Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
           Field('hex_color', length=6))

   db.define_table('tint',
           Field('name', length=3, requires=IS_NOT_EMPTY()))

   db.define_table('paint_tints',
           Field('paint_id', db.paint),
           Field('tint_id', db.tint),
           Field('units', 'integer'))

   db.order_que.paint.requires = IS_IN_DB(db, 'paint.id',  '%(name)s')
   db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
   db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
   db.order_que.customer_code.requires=IS_NOT_EMPTY()

   And I am trying to do a join like this...
   plate_que = db((db.order_que.que_letter != None) ==
   db.paint.name).select()
   But no matter what I put into order_que.que_letter I don't get any
   results.  Any ideas?
   BR,
   Jason



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



[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread mdipierro
No objection. send me a patch.

On Jan 27, 9:45 am, Thadeus Burgess thade...@thadeusb.com wrote:
 On this same topic when you define an SQLFORM.factory() it appends
 'no_table' as the name.

 Would it be difficult to add a way to pass a tablename to factory, so that
 my CSS will stay logical when I use SQLFORM or SQLFORM.factory?

 -Thadeus

 On Wed, Jan 27, 2010 at 8:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  The ids are only used for CSS. you can do

  form1=SQLFORM(...,_class='form1')
  form1.accepts(request.post_vars,formname=None)
  form2=SQLFORM(...,_class='form2')
  form2.accepts(request.post_vars,formname=None)
  return dict(form1=form1,form2=form2)

  and you can use the class to refer to the id of the first or the
  second in CSS. There should be no ambiguity.

  Massimo

  On Jan 27, 12:23 am, Jeremy Dillworth jdillwo...@gmail.com wrote:
   I'm building an app where I am likely to want multiple SQLFORMs on the
   same view.

   Reading the manual I can see how this works using the formname
   argument on the SQLFORM.accepts method.

   I'm a little concerned about the HTML side of things, though. I've
   noticed that the HTML generated by default contains lots ids that will
   be duplicates if you have multiple forms (e.g. tr
   id=submit_record__row).

     I'll probably want to write custom forms in my own HTML in the long-
   run anyway, but it looks like a lot of these ids could be CSS classes
   and maybe save me some trouble in cases where the SQLFORM default HTML
   is otherwise 'good enough' (in fact I've been having some fun and have
   a short function using xml.dom.minidom.parseString to move the ids to
   the class attribute and it seems to work ok).

   Is there any reason why the ids are needed (other than CSS perhaps)?

   If not, any chance of a future version of web2py using these as
   classnames?

   Thanks in advance and thanks for a cool web framework,

   Jeremy

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



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



[web2py] Re: Question about SQLFORM flow

2010-01-27 Thread leone
Yes.
I have to modify some tag attributes generates by SQLFORM after
form.accepts, so I  suppose i have to use javascript.
Thanks

On 27 Gen, 16:43, Thadeus Burgess thade...@thadeusb.com wrote:
 no.

 its rendered as html, you can style it however you like with css

 i think thats what you are asking?

 -Thadeus



 On Wed, Jan 27, 2010 at 8:27 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  Please ask again. I do not understand.

  On Jan 27, 4:54 am, leone handja...@gmail.com wrote:
   I have a question.
   In flow SQLFORM, accepts etc. when SQLFORM (and the its field values)
   is rendered as html script so that is updatable only by javascript
   functions added to returned code?
   Thanks
   leone

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

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



[web2py] Re: Replacing template engine

2010-01-27 Thread mdipierro
I agree with Thadeus.

Anyway. You can use any template language you like but be aware you
need to test what happens when you print a helper and what happens
when a string needs escaping. Not all template languages behave in the
same way in this regard.

You will also lose the ability to bytecode compile your app using
web2py admin. This has a measurable effects on speed.

You will also lose the ability to distribute your app without
additional dependencies. Since the template language needs to be
installed and it non-trivial to package it with the app itself.

On Jan 27, 9:51 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I dislike django-like templating languages.

 I can't sit down and write a single simple django app without the need to
 make a templatetag whose whole purpose is to format the data so I can use
 djangos other broken tag models to display this data.

 Django has the arugment well our designers arn't programmers so we cant
 trust them to use python in the templates. Really? Seriously? I have yet to
 come across a django developer that doesn't write his own views one way or
 another. He might hire a web designer to make a site, but he still goes in
 afterwords and hacks the design into his templating language. And even then
 that web designer has their own knowledge of django.

 /rant off

 the template language is one of the most divine gifts that web2py has given
 us.

 -Thadeus

 On Wed, Jan 27, 2010 at 9:36 AM, Timothy Farrell tfarr...@swgen.com wrote:
   IIRC, response._caller acts like a function decorator.  So it takes a
  function and returns a function.  I used to use Genshi like this:

  def renderGenshi(func):
      def _render():
          output = func()
          if not isinstance(dict, output):
              return output
          else:
              # real Genshi render code goes here
              return Genshi.render(response._view, output)
      return _render

  response._caller = renderGenshi

  Naturally it was more complicated than that, but you get the idea.

  That said, make sure Jinja2 is really what you want.  I thought I liked it
  until I learned that its context is immutable.  (This means you can't set
  response.title in a template and expect that change to propagate to an
  included or extended template file.  This was a deal-breaker for me.)

  In case you're curious, I switched off of Genshi back to web2py templates
  because Genshi only works on normal cPython platforms.  It blows up on
  Jython or AIX Python.

  -tim

  On 1/26/2010 9:05 PM, Thadeus Burgess wrote:

  Its going to be your best bet in using a different templating language. YOu
  will have to make sure to only parse your HTML requests and not
  json/download etc.

  Basically, response._caller is a function, that returns a string which is
  the html.

  So you would instead of response.render(d) you would do jinja2.render(d)
  where d is the dict returned from the action, you will of course have to
  tell jinja where to find templates and which template to render based on
  action

  jinja.render(d, '/applications/init/views/' + request.action+'.html')

  -Thadeus

  On Tue, Jan 26, 2010 at 8:24 PM, Alexandre airm...@gmail.com wrote:

  Hi,

   I want to replace web2py's template engine with Jinja 
  2http://jinja.pocoo.org/2/,
  anyone has some experience doing something similar? I'm trying to assign
  response._caller with a custom function, but I'm not having much success, 
  is
  that the right way?

   Thanks,
  Alexandre Rosenfeld

  Eng Comp 06 - USP São Carlos
  FoG -http://fog.icmc.usp.br
  IM Team - AIESEC
   --
  You received this message because you are subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

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

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



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 

[web2py] db.export_to_csv_file and Carriage Return

2010-01-27 Thread Praneeth
Hello folks,

I was wondering if anyone faced this problem before. I was migrating a
database from sqlite to MySQL and had to do a db.export_to_csv_file. My
database contains strings with a carriage return. Seems like the export
creates carriage returns in the CSV file resulting in a failure when
doing a db.import_from_csv_file. I manually removed the carriage returns
from my file for a successful import.


--
Praneeth

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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
this sounds like a bug but more of a bug in the csv module than in
web2py.
Anyway, it needs some testing. I will put this in my queue but it
would help if somebody else can also look into this. The only export/
import functions are in gluon/sql.py (for Table and for SQLDB).

On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
 Hello folks,

 I was wondering if anyone faced this problem before. I was migrating a
 database from sqlite to MySQL and had to do a db.export_to_csv_file. My
 database contains strings with a carriage return. Seems like the export
 creates carriage returns in the CSV file resulting in a failure when
 doing a db.import_from_csv_file. I manually removed the carriage returns
 from my file for a successful import.

 --
 Praneeth

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



Re: [web2py] Re: Issues with join...

2010-01-27 Thread Thadeus Burgess
for one, if that is your actual model, your fields have absolutely no
relationship to the other tables.

 
  db.define_table('order_que',
  Field('customer_code', length=30),
  Field('paint'),
  Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
  Litre', '30 Litre'])),
  Field('pickup_time'),
  Field('que_letter',
  requires=IS_IN_SET([None,A,
B,C,D,E,F])))

needs to be

db.define_table('order_que',
   Field('customer_code', length=30),
   Field('paint', db.paint),
   Field('que_letter', db.que_letter),
...etcetc...
)

Of course your joins would never work since they never have a relationship.

I am thinking you want all orders who have a queu letter no?

rows = db(db.order_que.que_letter != None).select()

for row in rows:
   row.paint.name
   row.paint.hex
   row.customer_code
   row.pickup_time

-Thadeus




On Wed, Jan 27, 2010 at 9:19 AM, Jason Brower encomp...@gmail.com wrote:

 I have the paint table and the order_que...
 I wnat to join them to show only tables that have a que_letter. (Not
 none but anything else.)
 BR,
 Jason Brower

 On Wed, 2010-01-27 at 06:21 -0800, mdipierro wrote:
  This is not a valid DAL query
  plate_que = db((db.order_que.que_letter != None)==db.paint.name).select
  ()
  (a!=b)==c?
 
  can you say in words (or in SQL) what you need to do?
 
  Massimo
 
  On Jan 27, 12:49 am, Jason Brower encomp...@gmail.com wrote:
   I have a database as follow:
   # coding: utf8
   from datetime import datetime, date, time
   now = datetime.utcnow()
   today = date.today()
  
   db = SQLDB('sqlite://paint.sqlite')
  
   db.define_table('order_que',
   Field('customer_code', length=30),
   Field('paint'),
   Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
   Litre', '30 Litre'])),
   Field('pickup_time'),
   Field('que_letter',
   requires=IS_IN_SET([None,A,B,C,D,E,F])))
  
   db.define_table('paint',
   Field('name', length=30, requires=IS_NOT_EMPTY(), unique=True),
   Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
   Field('hex_color', length=6))
  
   db.define_table('tint',
   Field('name', length=3, requires=IS_NOT_EMPTY()))
  
   db.define_table('paint_tints',
   Field('paint_id', db.paint),
   Field('tint_id', db.tint),
   Field('units', 'integer'))
  
   db.order_que.paint.requires = IS_IN_DB(db, 'paint.id',  '%(name)s')
   db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
   db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
   db.order_que.customer_code.requires=IS_NOT_EMPTY()
  
   And I am trying to do a join like this...
   plate_que = db((db.order_que.que_letter != None) ==
   db.paint.name).select()
   But no matter what I put into order_que.que_letter I don't get any
   results.  Any ideas?
   BR,
   Jason
 


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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
while im working on getting a patch together.

did you decide on how we want to handle markdown/__init__.py ?

-Thadeus




On Wed, Jan 27, 2010 at 10:00 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 No objection. send me a patch.

 On Jan 27, 9:45 am, Thadeus Burgess thade...@thadeusb.com wrote:
  On this same topic when you define an SQLFORM.factory() it appends
  'no_table' as the name.
 
  Would it be difficult to add a way to pass a tablename to factory, so
 that
  my CSS will stay logical when I use SQLFORM or SQLFORM.factory?
 
  -Thadeus
 
  On Wed, Jan 27, 2010 at 8:31 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   The ids are only used for CSS. you can do
 
   form1=SQLFORM(...,_class='form1')
   form1.accepts(request.post_vars,formname=None)
   form2=SQLFORM(...,_class='form2')
   form2.accepts(request.post_vars,formname=None)
   return dict(form1=form1,form2=form2)
 
   and you can use the class to refer to the id of the first or the
   second in CSS. There should be no ambiguity.
 
   Massimo
 
   On Jan 27, 12:23 am, Jeremy Dillworth jdillwo...@gmail.com wrote:
I'm building an app where I am likely to want multiple SQLFORMs on
 the
same view.
 
Reading the manual I can see how this works using the formname
argument on the SQLFORM.accepts method.
 
I'm a little concerned about the HTML side of things, though. I've
noticed that the HTML generated by default contains lots ids that
 will
be duplicates if you have multiple forms (e.g. tr
id=submit_record__row).
 
  I'll probably want to write custom forms in my own HTML in the
 long-
run anyway, but it looks like a lot of these ids could be CSS classes
and maybe save me some trouble in cases where the SQLFORM default
 HTML
is otherwise 'good enough' (in fact I've been having some fun and
 have
a short function using xml.dom.minidom.parseString to move the ids to
the class attribute and it seems to work ok).
 
Is there any reason why the ids are needed (other than CSS perhaps)?
 
If not, any chance of a future version of web2py using these as
classnames?
 
Thanks in advance and thanks for a cool web framework,
 
Jeremy
 
   --
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
 

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



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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
You need to define the appropriate csv.QOUTES type. You probably have
csv.QOUTES_MINIMAL (which is the web2py default)

Try the following

import csv
db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
quoting=csv.QUOTE_NONNUMERIC)
db.import_from_csv_file(s, delimiter=',', quotechar='',
qouting=csv.QOUTE_NONNUMERIC)

-Thadeus




On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 this sounds like a bug but more of a bug in the csv module than in
 web2py.
 Anyway, it needs some testing. I will put this in my queue but it
 would help if somebody else can also look into this. The only export/
 import functions are in gluon/sql.py (for Table and for SQLDB).

 On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
  Hello folks,
 
  I was wondering if anyone faced this problem before. I was migrating a
  database from sqlite to MySQL and had to do a db.export_to_csv_file. My
  database contains strings with a carriage return. Seems like the export
  creates carriage returns in the CSV file resulting in a failure when
  doing a db.import_from_csv_file. I manually removed the carriage returns
  from my file for a successful import.
 
  --
  Praneeth

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



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



[web2py] put line in variable in view

2010-01-27 Thread Wes James
What is the best way to put this in to a variable so I can output it
in a view and write it to a file:

line=XML('ulliName:' + {{=schol.name}} + '/li/ul')

{{=line}}

{{f = open('/tmp/workfile', 'w')
print f.write(line)
}}


line=XML() is not plain text is it?  just can't do f.write on it - hmm
looking at the manual it looks like I can.

??? not sure where I should write this file while rendering view -
/tmp should be ok, right?

-wes

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



Re: [web2py] put line in variable in view

2010-01-27 Thread Thadeus Burgess
print f.write(line.xml())

the xml function returns a string which is the xml representation of
the helper object.

-Thadeus





On Wed, Jan 27, 2010 at 11:24 AM, Wes James compte...@gmail.com wrote:
 What is the best way to put this in to a variable so I can output it
 in a view and write it to a file:

 line=XML('ulliName:' + {{=schol.name}} + '/li/ul')

 {{=line}}

 {{f = open('/tmp/workfile', 'w')
 print f.write(line)
 }}


 line=XML() is not plain text is it?  just can't do f.write on it - hmm
 looking at the manual it looks like I can.

 ??? not sure where I should write this file while rendering view -
 /tmp should be ok, right?

 -wes

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



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



[web2py] Re: no pending patches?

2010-01-27 Thread Wikus van de Merwe
This is incorrectly marked as fixed and still awaits your acceptance:
http://code.google.com/p/web2py/issues/detail?id=58

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



[web2py] Re: Fields in the SQLTable running in GAE

2010-01-27 Thread Leandro - ProfessionalIT
Sorry master by my ignorance, but do you have a example to me ?

-- Leandro.

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



[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Jeremy Dillworth
Thanks. But I wasn't too concerned about ambiguity in the CSS. I was
more concerned about there being duplicate IDs in the DOM. The w3c
HTML validator flags this kind of thing as a problem. As far as I know
it doesn't create a problem in any current browser (other than making
document.getElementById useless), but since these IDs are only used
for CSS, wouldn't it be safer to move these labels into the class
attributes and modify the default stylesheets as needed?

Thanks

Jeremy

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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
I just made this default in trunk.

On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
 You need to define the appropriate csv.QOUTES type. You probably have
 csv.QOUTES_MINIMAL (which is the web2py default)

 Try the following

 import csv
 db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
 quoting=csv.QUOTE_NONNUMERIC)
 db.import_from_csv_file(s, delimiter=',', quotechar='',
 qouting=csv.QOUTE_NONNUMERIC)

 -Thadeus

 On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  this sounds like a bug but more of a bug in the csv module than in
  web2py.
  Anyway, it needs some testing. I will put this in my queue but it
  would help if somebody else can also look into this. The only export/
  import functions are in gluon/sql.py (for Table and for SQLDB).

  On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
   Hello folks,

   I was wondering if anyone faced this problem before. I was migrating a
   database from sqlite to MySQL and had to do a db.export_to_csv_file. My
   database contains strings with a carriage return. Seems like the export
   creates carriage returns in the CSV file resulting in a failure when
   doing a db.import_from_csv_file. I manually removed the carriage returns
   from my file for a successful import.

   --
   Praneeth

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



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



[web2py] Re: no pending patches?

2010-01-27 Thread mdipierro
Thank you I will take a second look asap.

On Jan 27, 11:34 am, Wikus van de Merwe dupakrop...@googlemail.com
wrote:
 This is incorrectly marked as fixed and still awaits your 
 acceptance:http://code.google.com/p/web2py/issues/detail?id=58

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



[web2py] Re: Fields in the SQLTable running in GAE

2010-01-27 Thread mdipierro
What I meant is that I need to fix the web2py to support this. I will
try to this by the week-end.

On Jan 27, 1:08 pm, Leandro - ProfessionalIT lsever...@gmail.com
wrote:
 Sorry master by my ignorance, but do you have a example to me ?

 -- Leandro.

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



[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread mdipierro
I agree it is a bug that ids may not be unique. Yet fixing this will
break backward compatibility.
Perhaps we can add the same strings to the class attribute without
breaking backward compatibility but we should not remove them from id.
What do people think?

On Jan 27, 1:36 pm, Jeremy Dillworth jdillwo...@gmail.com wrote:
 Thanks. But I wasn't too concerned about ambiguity in the CSS. I was
 more concerned about there being duplicate IDs in the DOM. The w3c
 HTML validator flags this kind of thing as a problem. As far as I know
 it doesn't create a problem in any current browser (other than making
 document.getElementById useless), but since these IDs are only used
 for CSS, wouldn't it be safer to move these labels into the class
 attributes and modify the default stylesheets as needed?

 Thanks

 Jeremy

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



[web2py] Re: Fields in the SQLTable running in GAE

2010-01-27 Thread Leandro - ProfessionalIT
OK.
Thanks

-- Leandro.

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



[web2py] crud newbie getting invalid function

2010-01-27 Thread weheh
I'm a crud newbie. I've read the doc v2 on crud and think I understand
it. So I tried the following:

#model
db = DAL('sqlite://storage.sqlite')
from gluon.tools import *
crud=Crud(globals(),db)

db.define_table('test',Field('name','string'));

#default.py controller
def data:  return dict(form=crud())

This works just fine with the various crud actions. But then I tried a
more complex example and I get the invalid function page. I'm not
sure what this means. Any hints?

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



[web2py] Postgresql interface buggy

2010-01-27 Thread Johann Spies
It has happened several times now that I make changes in models/db.py
to the structure of a table (e.g. changing the type of a field) and
then web2py does not write the changes to the database (Postgresql)
and in the end one ends up with a situation that you have to do
changed using another interface to the database.

How do I recreate a database setup using web2py?

Regards
Johann

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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
Doesn't that break backwards compatibility ?

-Thadeus





On Wed, Jan 27, 2010 at 1:38 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 I just made this default in trunk.

 On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
 You need to define the appropriate csv.QOUTES type. You probably have
 csv.QOUTES_MINIMAL (which is the web2py default)

 Try the following

 import csv
 db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
 quoting=csv.QUOTE_NONNUMERIC)
 db.import_from_csv_file(s, delimiter=',', quotechar='',
 qouting=csv.QOUTE_NONNUMERIC)

 -Thadeus

 On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  this sounds like a bug but more of a bug in the csv module than in
  web2py.
  Anyway, it needs some testing. I will put this in my queue but it
  would help if somebody else can also look into this. The only export/
  import functions are in gluon/sql.py (for Table and for SQLDB).

  On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
   Hello folks,

   I was wondering if anyone faced this problem before. I was migrating a
   database from sqlite to MySQL and had to do a db.export_to_csv_file. My
   database contains strings with a carriage return. Seems like the export
   creates carriage returns in the CSV file resulting in a failure when
   doing a db.import_from_csv_file. I manually removed the carriage returns
   from my file for a successful import.

   --
   Praneeth

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



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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Bugs must be squashed!

You said so yourself a bug is not to be backwards compatible.

This isn't really a bug but a design oversight, since it was
figured two forms with the same field would never reside on the same
page.

I too have use for multiple same named fields, but since it doesn't
break browsers and the app is internal I have not bothered with w3c
validation.

Then again, I have lots of CSS that is based around the ID field, so
for me it requires making lots of little changes, so I am not
supporting this change lightly, but being a bug and in the spirit of
making web2py force w3c validity as much as possible I support it.

-Thadeus





On Wed, Jan 27, 2010 at 1:45 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 I agree it is a bug that ids may not be unique. Yet fixing this will
 break backward compatibility.
 Perhaps we can add the same strings to the class attribute without
 breaking backward compatibility but we should not remove them from id.
 What do people think?

 On Jan 27, 1:36 pm, Jeremy Dillworth jdillwo...@gmail.com wrote:
 Thanks. But I wasn't too concerned about ambiguity in the CSS. I was
 more concerned about there being duplicate IDs in the DOM. The w3c
 HTML validator flags this kind of thing as a problem. As far as I know
 it doesn't create a problem in any current browser (other than making
 document.getElementById useless), but since these IDs are only used
 for CSS, wouldn't it be safer to move these labels into the class
 attributes and modify the default stylesheets as needed?

 Thanks

 Jeremy

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



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



Re: [web2py] crud newbie getting invalid function

2010-01-27 Thread Thadeus Burgess
can you give an example of the more complex example?

-Thadeus





On Wed, Jan 27, 2010 at 2:20 PM, weheh richard_gor...@verizon.net wrote:
 I'm a crud newbie. I've read the doc v2 on crud and think I understand
 it. So I tried the following:

 #model
 db = DAL('sqlite://storage.sqlite')
 from gluon.tools import *
 crud=Crud(globals(),db)

 db.define_table('test',Field('name','string'));

 #default.py controller
 def data:  return dict(form=crud())

 This works just fine with the various crud actions. But then I tried a
 more complex example and I get the invalid function page. I'm not
 sure what this means. Any hints?

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



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



Re: [web2py] Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
This is most likely a bug, would you be willing to provide more
information on the matter?

For simplicities sake, drop your tables with the DAL by doing

db.table.drop()

Then you will have a fresh start when you remove this command.

-Thadeus





On Wed, Jan 27, 2010 at 3:37 PM, Johann Spies johann.sp...@gmail.com wrote:
 How do I recreate a database setup using web2py?

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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
I would say keep the old default in sql.py but make this the new
default in dal.py

The new dal has new functionality anyways

-Thadeus





On Wed, Jan 27, 2010 at 3:58 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 Doesn't that break backwards compatibility ?

 -Thadeus





 On Wed, Jan 27, 2010 at 1:38 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 I just made this default in trunk.

 On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
 You need to define the appropriate csv.QOUTES type. You probably have
 csv.QOUTES_MINIMAL (which is the web2py default)

 Try the following

 import csv
 db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
 quoting=csv.QUOTE_NONNUMERIC)
 db.import_from_csv_file(s, delimiter=',', quotechar='',
 qouting=csv.QOUTE_NONNUMERIC)

 -Thadeus

 On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  this sounds like a bug but more of a bug in the csv module than in
  web2py.
  Anyway, it needs some testing. I will put this in my queue but it
  would help if somebody else can also look into this. The only export/
  import functions are in gluon/sql.py (for Table and for SQLDB).

  On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
   Hello folks,

   I was wondering if anyone faced this problem before. I was migrating a
   database from sqlite to MySQL and had to do a db.export_to_csv_file. My
   database contains strings with a carriage return. Seems like the export
   creates carriage returns in the CSV file resulting in a failure when
   doing a db.import_from_csv_file. I manually removed the carriage returns
   from my file for a successful import.

   --
   Praneeth

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



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




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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Jonathan Lundell
On Jan 27, 2010, at 11:45 AM, mdipierro wrote:

 I agree it is a bug that ids may not be unique. Yet fixing this will
 break backward compatibility.
 Perhaps we can add the same strings to the class attribute without
 breaking backward compatibility but we should not remove them from id.
 What do people think?

It's better than not doing it. But duplicate IDs is bad. If you serve an xhtml 
page as xhtml (rather than as html), and it has duplicate IDs, the browser will 
not display it. Period.

I question whether backward compatibility needs to extend to propagating bugs. 


 
 On Jan 27, 1:36 pm, Jeremy Dillworth jdillwo...@gmail.com wrote:
 Thanks. But I wasn't too concerned about ambiguity in the CSS. I was
 more concerned about there being duplicate IDs in the DOM. The w3c
 HTML validator flags this kind of thing as a problem. As far as I know
 it doesn't create a problem in any current browser (other than making
 document.getElementById useless), but since these IDs are only used
 for CSS, wouldn't it be safer to move these labels into the class
 attributes and modify the default stylesheets as needed?
 
 Thanks
 
 Jeremy


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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Wes James
Why not:

 form1=SQLFORM(..., _id=what_you_want)

-wes

On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do

 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)

 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.

 Massimo



snip

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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
if it was defaulted to None we could go

if _id == None then id = tablename else id = _id

Id accept that, just set a unique id for each of my forms and nothing
will conflict and it will still keep good with old apps.

-Thadeus





On Wed, Jan 27, 2010 at 4:27 PM, Wes James compte...@gmail.com wrote:
 Why not:

  form1=SQLFORM(..., _id=what_you_want)

 -wes

 On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do

 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)

 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.

 Massimo



 snip

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



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



[web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Jeremy Dillworth
I just want to clarify, that based on what I have seen, you always get
tr id=submit_record__row even if you don't have any duplicate
fields. So it's not something you can avoid. Once you have multiple
forms you have duplicate IDs.

There are also multiple IDs in the form's HTML. So rather than SQLFORM
(..._id=something) I was thinking more along the lines of SQLFORM
(... _id_prefix=form22_) and then use the prefix on the front of
IDs.

There are probably ways to make this relatively painless.

I personally think web2py should do the right thing by default, for
whatever my opinion is worth (I know everyone else here has much more
invested). So I would suggest if there were a new option to SQLFORM
then something like: SQLFORM(... _use_old_id_scheme=True)... would be
best. Then those that are in Thadeus' situation could simply add the
new option and upgrade their CSS at their leisure.

But then, these kind of switches to preserve old behavior when needed
can accumulate over time. There should probably be a deprecation note
(at least) about it.

Jeremy

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



[web2py] After upgrade, getting NameError name 'table' is not defined

2010-01-27 Thread MikeEllis
I get the error shown in the subject of this message when I try to
manually insert a new record into any of my tables using the built-in
db admin interface.  The complete traceback is

Traceback (most recent call last):
  File /Users/mellis/web2py/gluon/restricted.py, line 173, in
restricted
exec ccode in environment
  File /Users/mellis/web2py/applications/init/views/appadmin.html,
line 208, in module
NameError: name 'table' is not defined

The error occurs when I click Insert new ... in appadmin/index.

FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
copied the entire app to the new installation.  Do I need to replace
any of the appadmin files?

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



Re: [web2py] After upgrade, getting NameError name 'table' is not defined

2010-01-27 Thread Thadeus Burgess
Yes you should replace the appadmin files.

There was a bug (don't remember what) with the old appadmin that was
fixed in recent versions.

Plus you get access to cache statistics if you have guppy heapy installed :)

-Thadeus





On Wed, Jan 27, 2010 at 4:44 PM, MikeEllis michael.f.el...@gmail.com wrote:
 I get the error shown in the subject of this message when I try to
 manually insert a new record into any of my tables using the built-in
 db admin interface.  The complete traceback is

 Traceback (most recent call last):
  File /Users/mellis/web2py/gluon/restricted.py, line 173, in
 restricted
    exec ccode in environment
  File /Users/mellis/web2py/applications/init/views/appadmin.html,
 line 208, in module
 NameError: name 'table' is not defined

 The error occurs when I click Insert new ... in appadmin/index.

 FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
 copied the entire app to the new installation.  Do I need to replace
 any of the appadmin files?

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



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



[web2py] Re: After upgrade, getting NameError name 'table' is not defined

2010-01-27 Thread MikeEllis
Thanks, Thadeus.  Replacing appadmin.py fixed it.

On Jan 27, 5:56 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Yes you should replace the appadmin files.

 There was a bug (don't remember what) with the old appadmin that was
 fixed in recent versions.

 Plus you get access to cache statistics if you have guppy heapy installed :)

 -Thadeus

 On Wed, Jan 27, 2010 at 4:44 PM, MikeEllis michael.f.el...@gmail.com wrote:
  I get the error shown in the subject of this message when I try to
  manually insert a new record into any of my tables using the built-in
  db admin interface.  The complete traceback is

  Traceback (most recent call last):
   File /Users/mellis/web2py/gluon/restricted.py, line 173, in
  restricted
     exec ccode in environment
   File /Users/mellis/web2py/applications/init/views/appadmin.html,
  line 208, in module
  NameError: name 'table' is not defined

  The error occurs when I click Insert new ... in appadmin/index.

  FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
  copied the entire app to the new installation.  Do I need to replace
  any of the appadmin files?

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



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



Re: [web2py] Re: After upgrade, getting NameError name 'table' is not defined

2010-01-27 Thread Thadeus Burgess
Dont forget to replace teh views so you can get the cache templates

-Thadeus





On Wed, Jan 27, 2010 at 5:01 PM, MikeEllis michael.f.el...@gmail.com wrote:
 Thanks, Thadeus.  Replacing appadmin.py fixed it.

 On Jan 27, 5:56 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Yes you should replace the appadmin files.

 There was a bug (don't remember what) with the old appadmin that was
 fixed in recent versions.

 Plus you get access to cache statistics if you have guppy heapy installed :)

 -Thadeus

 On Wed, Jan 27, 2010 at 4:44 PM, MikeEllis michael.f.el...@gmail.com wrote:
  I get the error shown in the subject of this message when I try to
  manually insert a new record into any of my tables using the built-in
  db admin interface.  The complete traceback is

  Traceback (most recent call last):
   File /Users/mellis/web2py/gluon/restricted.py, line 173, in
  restricted
     exec ccode in environment
   File /Users/mellis/web2py/applications/init/views/appadmin.html,
  line 208, in module
  NameError: name 'table' is not defined

  The error occurs when I click Insert new ... in appadmin/index.

  FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
  copied the entire app to the new installation.  Do I need to replace
  any of the appadmin files?

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



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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Jonathan Lundell
On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:

 if it was defaulted to None we could go
 
 if _id == None then id = tablename else id = _id
 
 Id accept that, just set a unique id for each of my forms and nothing
 will conflict and it will still keep good with old apps.

And _id = False for no id at all.

It's not that it isn't useful to put all of them into the same class; it's that 
class is the right way to do it, rather than id. 


 
 -Thadeus
 
 
 
 
 
 On Wed, Jan 27, 2010 at 4:27 PM, Wes James compte...@gmail.com wrote:
 Why not:
 
  form1=SQLFORM(..., _id=what_you_want)
 
 -wes
 
 On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do
 
 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)
 
 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.
 
 Massimo
 
 
 
 snip
 
 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.
 


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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Doesn't javascript input serialization expect to look the field up by id?

it should be

form = id = formname class=formname:
   input:
  class = formname
  id = formname_field

#formname input { ... }
#formname #formname_users_email { ... }
#formname .formname { ... }

This would give a lot more flexibility from both a CSS design and a UI
design using jquery selection.

-Thadeus





On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:

 if it was defaulted to None we could go

 if _id == None then id = tablename else id = _id

 Id accept that, just set a unique id for each of my forms and nothing
 will conflict and it will still keep good with old apps.

 And _id = False for no id at all.

 It's not that it isn't useful to put all of them into the same class; it's 
 that class is the right way to do it, rather than id.



 -Thadeus





 On Wed, Jan 27, 2010 at 4:27 PM, Wes James compte...@gmail.com wrote:
 Why not:

  form1=SQLFORM(..., _id=what_you_want)

 -wes

 On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do

 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)

 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.

 Massimo



 snip

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



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



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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Doesn't javascript input serialization expect to look the field up by id?

form = id = formname class=formname:
   input:
  class = formname
  id = formname_field

#formname input { ... }
#formname #formname_users_email { ... }
#formname .formname { ... }

-Thadeus





On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:

 if it was defaulted to None we could go

 if _id == None then id = tablename else id = _id

 Id accept that, just set a unique id for each of my forms and nothing
 will conflict and it will still keep good with old apps.

 And _id = False for no id at all.

 It's not that it isn't useful to put all of them into the same class; it's 
 that class is the right way to do it, rather than id.



 -Thadeus





 On Wed, Jan 27, 2010 at 4:27 PM, Wes James compte...@gmail.com wrote:
 Why not:

  form1=SQLFORM(..., _id=what_you_want)

 -wes

 On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do

 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)

 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.

 Massimo



 snip

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



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



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



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



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Jonathan Lundell
On Jan 27, 2010, at 5:07 PM, Thadeus Burgess wrote:

 Doesn't javascript input serialization expect to look the field up by id?

There's nothing *wrong* with having an id; it just needs to be unique on the 
page.

 
 it should be
 
 form = id = formname class=formname:
   input:
  class = formname
  id = formname_field
 
 #formname input { ... }
 #formname #formname_users_email { ... }
 #formname .formname { ... }
 
 This would give a lot more flexibility from both a CSS design and a UI
 design using jquery selection.
 
 -Thadeus
 
 
 
 
 
 On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:
 
 if it was defaulted to None we could go
 
 if _id == None then id = tablename else id = _id
 
 Id accept that, just set a unique id for each of my forms and nothing
 will conflict and it will still keep good with old apps.
 
 And _id = False for no id at all.
 
 It's not that it isn't useful to put all of them into the same class; it's 
 that class is the right way to do it, rather than id.
 
 
 
 -Thadeus
 
 
 
 
 
 On Wed, Jan 27, 2010 at 4:27 PM, Wes James compte...@gmail.com wrote:
 Why not:
 
  form1=SQLFORM(..., _id=what_you_want)
 
 -wes
 
 On Wed, Jan 27, 2010 at 7:31 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 The ids are only used for CSS. you can do
 
 form1=SQLFORM(...,_class='form1')
 form1.accepts(request.post_vars,formname=None)
 form2=SQLFORM(...,_class='form2')
 form2.accepts(request.post_vars,formname=None)
 return dict(form1=form1,form2=form2)
 
 and you can use the class to refer to the id of the first or the
 second in CSS. There should be no ambiguity.
 
 Massimo
 
 
 
 snip


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



[web2py] Re: Postgresql interface buggy

2010-01-27 Thread mdipierro
The problem is that changing a type is not always well defined. In
particular if you have data in the column the database may not be able
to convert the data from the old type to the new type.

If you need to change a type the safe way if by deleting the column,
run admin, add the column again of a new type. In this way postgresql
will understand you are not trying to convert the data.


On Jan 27, 3:37 pm, Johann Spies johann.sp...@gmail.com wrote:
 It has happened several times now that I make changes in models/db.py
 to the structure of a table (e.g. changing the type of a field) and
 then web2py does not write the changes to the database (Postgresql)
 and in the end one ends up with a situation that you have to do
 changed using another interface to the database.

 How do I recreate a database setup using web2py?

 Regards
 Johann

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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
I do not think this change will cause any backward compatibility
problems.

On Jan 27, 3:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Doesn't that break backwards compatibility ?

 -Thadeus

 On Wed, Jan 27, 2010 at 1:38 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  I just made this default in trunk.

  On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
  You need to define the appropriate csv.QOUTES type. You probably have
  csv.QOUTES_MINIMAL (which is the web2py default)

  Try the following

  import csv
  db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
  quoting=csv.QUOTE_NONNUMERIC)
  db.import_from_csv_file(s, delimiter=',', quotechar='',
  qouting=csv.QOUTE_NONNUMERIC)

  -Thadeus

  On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu 
  wrote:
   this sounds like a bug but more of a bug in the csv module than in
   web2py.
   Anyway, it needs some testing. I will put this in my queue but it
   would help if somebody else can also look into this. The only export/
   import functions are in gluon/sql.py (for Table and for SQLDB).

   On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
Hello folks,

I was wondering if anyone faced this problem before. I was migrating a
database from sqlite to MySQL and had to do a db.export_to_csv_file. My
database contains strings with a carriage return. Seems like the export
creates carriage returns in the CSV file resulting in a failure when
doing a db.import_from_csv_file. I manually removed the carriage 
returns
from my file for a successful import.

--
Praneeth

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

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



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



Re: [web2py] Re: Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
What about data type conversion though.

In rails this is why you have to define migrations in rake script.

Would it even be worth it for web2py ?

Could we load the database column to a csv file, have web2py automate
the drop column create column and new insert to the new data type?

-Thadeus





On Wed, Jan 27, 2010 at 7:44 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 problem is that changing a type is not always well defined. In
 particular if you have data in the column the database may not be able
 to convert the data from the old typ

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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
what if I have old csv backups laying around :)

Ok +1 for QOUTES_NONNUMERIC as default.

-Thadeus





On Wed, Jan 27, 2010 at 7:45 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not think this change will cause any backward compatibility
 problems.

 On Jan 27, 3:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Doesn't that break backwards compatibility ?

 -Thadeus

 On Wed, Jan 27, 2010 at 1:38 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  I just made this default in trunk.

  On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
  You need to define the appropriate csv.QOUTES type. You probably have
  csv.QOUTES_MINIMAL (which is the web2py default)

  Try the following

  import csv
  db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
  quoting=csv.QUOTE_NONNUMERIC)
  db.import_from_csv_file(s, delimiter=',', quotechar='',
  qouting=csv.QOUTE_NONNUMERIC)

  -Thadeus

  On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu 
  wrote:
   this sounds like a bug but more of a bug in the csv module than in
   web2py.
   Anyway, it needs some testing. I will put this in my queue but it
   would help if somebody else can also look into this. The only export/
   import functions are in gluon/sql.py (for Table and for SQLDB).

   On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
Hello folks,

I was wondering if anyone faced this problem before. I was migrating a
database from sqlite to MySQL and had to do a db.export_to_csv_file. 
My
database contains strings with a carriage return. Seems like the 
export
creates carriage returns in the CSV file resulting in a failure when
doing a db.import_from_csv_file. I manually removed the carriage 
returns
from my file for a successful import.

--
Praneeth

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

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



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



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



[web2py] Two domains, two web2py instances, two apps, same database

2010-01-27 Thread Thadeus Burgess
Here are my needs.

example.com = public portion of the website. This includes anything
publicly accessible, and allows new accounts to be created. Only needs
access to one table, accounts table.
dashboard.example.com = internal portion of the website, which
includes all account management functions, but of course linked to the
same database, but has access to many more tables.

In this setup, I would run two apache virtualhosts, and two
installations of web2py. I will define my models in a module that they
can be imported to each app.

Each app will of course have a different set of
controllers/views/static etc etc.

And dashboard.example.com will be force https, IP restricted (by
apache), htpasswd, web2py passwd, etc.. etc..

Is this an appropriate setup for this? Would having one app that
checks request.env.http_host and route based on this a better
solution?

What would be the correct way to design the models so they can be
imported instead of exectued, like Admin but I need them to unpack
into the web2py global namespace. Since I am on linux, would symlinks
be a better approach I could store just the accounts table in one
file, and symlink that to both apps from a central projects folder.

Thoughts, suggestions, ideas?

-Thadeus

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



[web2py] new on web2pyslices.com: version history!

2010-01-27 Thread mr.freeze
Well it took a while but I finally got around to it. From now on when
you modify your slice, a version history link will appear below the
main body.  It currently only allows viewing but will support
restoring previous versions soon. Enjoy and keep those slices coming!

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



[web2py] Re: CouchDB adapter - need any help?

2010-01-27 Thread vihang
Any news on new DAL or couchdb support?

On Dec 29 2009, 4:32 am, mdipierro mdipie...@cs.depaul.edu wrote:
 It is easy but I would not want to do it twice. I think it belongs to
 the new DAL, not the old DAL. We are getting close.

 Massimo

 On Dec 28, 5:06 pm, Jon Romero darks...@gmail.com wrote:

  I've read some threads about it but what's the status?
  I see Django supportsCouchDBand I think that's easy to do it also in
  web2py (and then mongoDB and tokyo tyrant).

 http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb...

  any ideas?
  thanks

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



[web2py] Mobile Access Design

2010-01-27 Thread yamandu
I am building an app that has some functions that need to be accessed
from a mobile, a pocket pc or maybe a cell phone.
The question is: using web2py what would be a working design?
I mean, what direction I must follow?
Anyone has made this?

I think I could be have different type of view for mobiles. But don´t
know if ti could be the best way.
I need to reduce as traffic as mush as possible but also don´t want to
rewrite lot of code neither write another app like in Java or
something else. That is, it must be more centralized.

Any tip?

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



[web2py] Re: crud newbie getting invalid function

2010-01-27 Thread yamandu
Maybe you put some args in the function or it´s misspelled or the path
is wrong.

On 27 Jan, 20:04, Thadeus Burgess thade...@thadeusb.com wrote:
 can you give an example of the more complex example?

 -Thadeus



 On Wed, Jan 27, 2010 at 2:20 PM, weheh richard_gor...@verizon.net wrote:
  I'm a crud newbie. I've read the doc v2 on crud and think I understand
  it. So I tried the following:

  #model
  db = DAL('sqlite://storage.sqlite')
  from gluon.tools import *
  crud=Crud(globals(),db)

  db.define_table('test',Field('name','string'));

  #default.py controller
  def data:  return dict(form=crud())

  This works just fine with the various crud actions. But then I tried a
  more complex example and I get the invalid function page. I'm not
  sure what this means. Any hints?

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

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



[web2py] Re: Mobile Access Design

2010-01-27 Thread mr.freeze
I made a mileage tracker for blackberry here:
http://www.web2pyslices.com/main/slices/take_slice/15

It's a simple app but hopefully will help.

On Jan 27, 10:35 pm, yamandu yamandu.co...@gmail.com wrote:
 I am building an app that has some functions that need to be accessed
 from a mobile, a pocket pc or maybe a cell phone.
 The question is: using web2py what would be a working design?
 I mean, what direction I must follow?
 Anyone has made this?

 I think I could be have different type of view for mobiles. But don´t
 know if ti could be the best way.
 I need to reduce as traffic as mush as possible but also don´t want to
 rewrite lot of code neither write another app like in Java or
 something else. That is, it must be more centralized.

 Any tip?

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



[web2py] Re: Postgresql interface buggy

2010-01-27 Thread mdipierro
When you change a field type web2py automatically creates tmp column
of the new type, copies data, delete the old column and renames the
tmp column. This works great if you convert, for example an int to
string. How well it works depends on the database and the type of
conversion.

If you want something that is more complex and the database does not
support it (for example a string field into a date field) than one
needs to write a script for it. The conversion may be done on the db
side or on the web2py side. The fact is there are a lot of options. I
am not sure how general rails migrations scripts are.

Massimo





On Jan 27, 8:05 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 What about data type conversion though.

 In rails this is why you have to define migrations in rake script.

 Would it even be worth it for web2py ?

 Could we load the database column to a csv file, have web2py automate
 the drop column create column and new insert to the new data type?

 -Thadeus

 On Wed, Jan 27, 2010 at 7:44 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  problem is that changing a type is not always well defined. In
  particular if you have data in the column the database may not be able
  to convert the data from the old typ



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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
This will not be a problem since this parameter only affects export
not import. Because of the way it works, you will be able to import
despite the type of quoting except you will not be able to import
those csv that you were already unable to import before.

On Jan 27, 8:06 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 what if I have old csv backups laying around :)

 Ok +1 for QOUTES_NONNUMERIC as default.

 -Thadeus

 On Wed, Jan 27, 2010 at 7:45 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  I do not think this change will cause any backward compatibility
  problems.

  On Jan 27, 3:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  Doesn't that break backwards compatibility ?

  -Thadeus

  On Wed, Jan 27, 2010 at 1:38 PM, mdipierro mdipie...@cs.depaul.edu wrote:
   I just made this default in trunk.

   On Jan 27, 10:42 am, Thadeus Burgess thade...@thadeusb.com wrote:
   You need to define the appropriate csv.QOUTES type. You probably have
   csv.QOUTES_MINIMAL (which is the web2py default)

   Try the following

   import csv
   db(query).select().export_to_csv_file(s, delimiter=',', quotechar='',
   quoting=csv.QUOTE_NONNUMERIC)
   db.import_from_csv_file(s, delimiter=',', quotechar='',
   qouting=csv.QOUTE_NONNUMERIC)

   -Thadeus

   On Wed, Jan 27, 2010 at 10:11 AM, mdipierro mdipie...@cs.depaul.edu 
   wrote:
this sounds like a bug but more of a bug in the csv module than in
web2py.
Anyway, it needs some testing. I will put this in my queue but it
would help if somebody else can also look into this. The only export/
import functions are in gluon/sql.py (for Table and for SQLDB).

On Jan 27, 8:55 am, Praneeth life...@gmail.com wrote:
 Hello folks,

 I was wondering if anyone faced this problem before. I was 
 migrating a
 database from sqlite to MySQL and had to do a 
 db.export_to_csv_file. My
 database contains strings with a carriage return. Seems like the 
 export
 creates carriage returns in the CSV file resulting in a failure when
 doing a db.import_from_csv_file. I manually removed the carriage 
 returns
 from my file for a successful import.

 --
 Praneeth

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

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

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



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



[web2py] Re: CouchDB adapter - need any help?

2010-01-27 Thread mdipierro
sorry... slowly than expected.

The only good news is that the new DAL is out there gluon/dal.py and
works for relational database. It needs a little bit more abstraction
before we can integrate nodb.

On Jan 27, 10:04 pm, vihang vihan...@gmail.com wrote:
 Any news on new DAL or couchdb support?

 On Dec 29 2009, 4:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

  It is easy but I would not want to do it twice. I think it belongs to
  the new DAL, not the old DAL. We are getting close.

  Massimo

  On Dec 28, 5:06 pm, Jon Romero darks...@gmail.com wrote:

   I've read some threads about it but what's the status?
   I see Django supportsCouchDBand I think that's easy to do it also in
   web2py (and then mongoDB and tokyo tyrant).

  http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb...

   any ideas?
   thanks



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



Re: [web2py] Re: Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
generic, their quite powerful though. But a single function called
from the web2py command line to convert between data types shouldn't
be that hard.

of course, you should have your data types set out before the app
ever hits production so migrations like this usually mean deleting the
sqlite database ands tarting from scratch.

-Thadeus





On Wed, Jan 27, 2010 at 10:52 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 ant something that is more complex and the database does not
 support it (for example a string field into a date field) than one
 needs to write a script for it. The conversion may be done on the db
 side or on the web2py side. The fact is there are a lot of options. I
 am not sure how general rails migrations scri

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



[web2py] Re: crud newbie getting invalid function

2010-01-27 Thread mdipierro
I think you are simply being redirected to a page that does not exist.
Can you list the steps to reproduce the problem and the url that cases
the problem?

On Jan 27, 4:04 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 can you give an example of the more complex example?

 -Thadeus

 On Wed, Jan 27, 2010 at 2:20 PM, weheh richard_gor...@verizon.net wrote:
  I'm a crud newbie. I've read the doc v2 on crud and think I understand
  it. So I tried the following:

  #model
  db = DAL('sqlite://storage.sqlite')
  from gluon.tools import *
  crud=Crud(globals(),db)

  db.define_table('test',Field('name','string'));

  #default.py controller
  def data:  return dict(form=crud())

  This works just fine with the various crud actions. But then I tried a
  more complex example and I get the invalid function page. I'm not
  sure what this means. Any hints?

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



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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
Are you saying that from the csv module point of view, or from web2py
point of view?

I just attempted a simple test attempting to export one of my old
files... it failed.

Its no biggie, I just will specify my qoute type if I ever need to use
one of these old csv files.

My only request is make an official changelog, and make a note about this!

-Thadeus





On Wed, Jan 27, 2010 at 10:55 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 ill not be a problem since this parameter only affects export
 not import. Because of the way it work

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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
Oops. I was wrong. I did not do what I said. I just changed trunk so
that import on import requires QUOTE_MINIMAL but on export applies
QUOTE_NONNUMERIC.

So import does not change but new export should still be compatible
with input. Am I wrong again?
I did not try it yet. I am making a guess.

Massimo

On Jan 27, 11:01 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Are you saying that from the csv module point of view, or from web2py
 point of view?

 I just attempted a simple test attempting to export one of my old
 files... it failed.

 Its no biggie, I just will specify my qoute type if I ever need to use
 one of these old csv files.

 My only request is make an official changelog, and make a note about this!

 -Thadeus

 On Wed, Jan 27, 2010 at 10:55 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  ill not be a problem since this parameter only affects export
  not import. Because of the way it work



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



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
We can't have it exporting qoutes and then the import expecting the
qoutes to be minimal. Then the export/import functionality is broken
between itself =/

I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
with the option of better use-case in the new dal.

Either way both import/export need to be the same.

-Thadeus





On Wed, Jan 27, 2010 at 11:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 Oops. I was wrong. I did not do what I said. I just changed trunk so
 that import on import requires QUOTE_MINIMAL but on export applies
 QUOTE_NONNUMERIC.

 So import does not change but new export should still be compatible
 with input. Am I wrong again?
 I did not try it yet. I am making a guess.

 Massimo

 On Jan 27, 11:01 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Are you saying that from the csv module point of view, or from web2py
 point of view?

 I just attempted a simple test attempting to export one of my old
 files... it failed.

 Its no biggie, I just will specify my qoute type if I ever need to use
 one of these old csv files.

 My only request is make an official changelog, and make a note about this!

 -Thadeus

 On Wed, Jan 27, 2010 at 10:55 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  ill not be a problem since this parameter only affects export
  not import. Because of the way it work



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



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



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread mdipierro
I just run the test and you are right. It does not work.

I also checked the original problem reported on this thread that
started the discussion and I fail to reproduce it.

 writer=csv.writer(s,quoting=csv.QUOTE_MINIMAL)
 writer.writerow(['this','is\na','test',12])
 print s.getvalue()
this,is
a,test,12
 reader=csv.reader(s,quoting=csv.QUOTE_MINIMAL)
 s.seek(0)
 for line in reader: print line
...
['this', 'is\x07', 'test', '12']
['this', 'is\na', 'test', '12']


On Jan 27, 11:36 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 We can't have it exporting qoutes and then the import expecting the
 qoutes to be minimal. Then the export/import functionality is broken
 between itself =/

 I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
 QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
 with the option of better use-case in the new dal.

 Either way both import/export need to be the same.

 -Thadeus

 On Wed, Jan 27, 2010 at 11:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  Oops. I was wrong. I did not do what I said. I just changed trunk so
  that import on import requires QUOTE_MINIMAL but on export applies
  QUOTE_NONNUMERIC.

  So import does not change but new export should still be compatible
  with input. Am I wrong again?
  I did not try it yet. I am making a guess.

  Massimo

  On Jan 27, 11:01 pm, Thadeus Burgess thade...@thadeusb.com wrote:
  Are you saying that from the csv module point of view, or from web2py
  point of view?

  I just attempted a simple test attempting to export one of my old
  files... it failed.

  Its no biggie, I just will specify my qoute type if I ever need to use
  one of these old csv files.

  My only request is make an official changelog, and make a note about this!

  -Thadeus

  On Wed, Jan 27, 2010 at 10:55 PM, mdipierro mdipie...@cs.depaul.edu 
  wrote:
   ill not be a problem since this parameter only affects export
   not import. Because of the way it work

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



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



[web2py] Re: CouchDB adapter - need any help?

2010-01-27 Thread vihang
Massimo, can you give me some directions how I could possibly make an
abstraction layer for couchdb inorder to use it like DAL.

On Jan 28, 9:57 am, mdipierro mdipie...@cs.depaul.edu wrote:
 sorry... slowly than expected.

 The only good news is that the new DAL is out there gluon/dal.py and
 works for relational database. It needs a little bit more abstraction
 before we can integrate nodb.

 On Jan 27, 10:04 pm, vihang vihan...@gmail.com wrote:

  Any news on new DAL or couchdb support?

  On Dec 29 2009, 4:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

   It is easy but I would not want to do it twice. I think it belongs to
   the new DAL, not the old DAL. We are getting close.

   Massimo

   On Dec 28, 5:06 pm, Jon Romero darks...@gmail.com wrote:

I've read some threads about it but what's the status?
I see Django supportsCouchDBand I think that's easy to do it also in
web2py (and then mongoDB and tokyo tyrant).

   http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb...

any ideas?
thanks

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



[web2py] Re: CouchDB adapter - need any help?

2010-01-27 Thread mdipierro
As soon as I do for GAE I will write some instructions.

On Jan 27, 11:55 pm, vihang vihan...@gmail.com wrote:
 Massimo, can you give me some directions how I could possibly make an
 abstraction layer for couchdb inorder to use it like DAL.

 On Jan 28, 9:57 am, mdipierro mdipie...@cs.depaul.edu wrote:

  sorry... slowly than expected.

  The only good news is that the new DAL is out there gluon/dal.py and
  works for relational database. It needs a little bit more abstraction
  before we can integrate nodb.

  On Jan 27, 10:04 pm, vihang vihan...@gmail.com wrote:

   Any news on new DAL or couchdb support?

   On Dec 29 2009, 4:32 am, mdipierro mdipie...@cs.depaul.edu wrote:

It is easy but I would not want to do it twice. I think it belongs to
the new DAL, not the old DAL. We are getting close.

Massimo

On Dec 28, 5:06 pm, Jon Romero darks...@gmail.com wrote:

 I've read some threads about it but what's the status?
 I see Django supportsCouchDBand I think that's easy to do it also in
 web2py (and then mongoDB and tokyo tyrant).

http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb...

 any ideas?
 thanks



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



Re: [web2py] Re: bug in SQLFORM.factory?

2010-01-27 Thread Frederik Wagner
Hi,

both version do save a None (actually all form.accepts, FORM.accepts,
SQLFORM.accepts do).

Wouldn't be the correct behavior to consistently and always convert a
False value to 'F'? Am I missing something?

Thanks a lot!
Frederik

On Wed, Jan 27, 2010 at 4:59 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 On a second look I believe FORM.accepts behave correctly. Since it is
 not supposed to convert None to 'F'. Only SQLFORM.accepts does that.

 On Jan 27, 8:24 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Why

 def test1():
 form=SQLFORM.factory(Field(bool,boolean))

 if FORM.accepts(form, request.vars, session, keepvalues=True):
 db.test.insert(bool=request.vars.bool)

 return dict(form=form,list=db().select(db.test.ALL))

 and not

 def test1():
 form=SQLFORM.factory(Field(bool,boolean))

 if form.accepts(request.vars, session, keepvalues=True):
 db.test.insert(bool=request.vars.bool)

 return dict(form=form,list=db().select(db.test.ALL))

 ?

 Please check the latter, it should work fine. I check why the former
 does not.

 On Jan 27, 1:50 am, Frederik Wagner fner...@googlemail.com wrote:

  Hi .*,

  it seems to me that there is a bug saving boolean fields with
  SQLFORM.factory forms.
  If I define a boolean field in a table and use the standard SQLFORM to
  make an input form, the accept function will save 'T' of 'F' to the
  DB.
  Whereas in the case where I create a form with SQLFORM.factory, do a
  FORM.accept and an explicit db.insert, instead of 'F' there will be a
  NULL on the DB.

  Here a test setup:

  DB:
  db.define_table('test',Field('bool','boolean'))

  CONTROLLER:
  def test1():
  form=SQLFORM.factory(Field(bool,boolean))

  if FORM.accepts(form, request.vars, session, keepvalues=True):
  db.test.insert(bool=request.vars.bool)

  return dict(form=form,list=db().select(db.test.ALL))

  def test2():
  form=SQLFORM(db.test)

  if form.accepts(request.vars, session, keepvalues=True):
  response.flash = 'done'

  return dict(form=form,list=db().select(db.test.ALL))

  test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
  'False' ('F').

  A bug or my problem? :-)

  Bye
  Frederik



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



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



[web2py] crud newbie

2010-01-27 Thread weheh
I'm using crud to create a mini CMS type of functionality. I'm using
the example on p. 218 of the doc v2 as a guide. (I'm reproducing it
here for reference.)

1 # assuming db.define_table('person', Field('name'))
2 def people():
3 form = crud.create(db.person, next=request.url,
4 message=T(record created))
5 persons = crud.select(db.person, fields=['name'],
6 headers={'person.name', 'Name'})
7 return dict(form=form, persons=persons)

When I click on the ID of any record, the URL says ...app/read/mytable/
id#. I really want an update, not a read. How do I coax it into doing
an update? That being said, when I do click on the ID link, I get an
invalid function page. What am I doing wrong?

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



[web2py] crud newbie question regarding update

2010-01-27 Thread weheh
changing subject line

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