[web2py] Re: how to get user name before login is completed

2011-07-15 Thread puercoespin
In a view:

{{if auth.user_id:}}
{{=H4(T('Welcome ') + db.auth_user[auth.user_id].first_name)}}
{{pass}



On 14 jul, 14:42, Anthony abasta...@gmail.com wrote:
 On Thursday, July 14, 2011 1:03:24 AM UTC-4, weheh wrote:

  How would one get auth.messages.logged_in to be something like
  Welcome Massimoupon login? auth.user_id is None at the time the
  auth.messages.logged_in is evaluated.

 There may be a better way, but maybe something like this:

 def dynamic_logged_in_message(form):
     session.flash='Welcome %s' % auth.user.first_name
 auth.settings.login_onaccept = dynamic_logged_in_message

 Anthony


[web2py] Re: Recurly with web2py

2011-07-15 Thread cjrh
On Thursday, July 14, 2011 6:00:29 PM UTC+2, Carl wrote:

 separately... had my head down when the 3rd edition of the Web2py book 
 came out... have just ordered it.


Same happened to me, but I got out my frustration by asking Massimo whether 
I could be allowed to fix errors in the online version of the book instead. 
  (It worked) 


Re: [web2py] Re: web2py with jquery mobile?

2011-07-15 Thread António Ramos
download and install the plugin in a web2py app gives me error!!!

2011/7/14 Anthony abasta...@gmail.com

 http://web2py.com/plugins/plugin_jqmobile/about




Re: [web2py] Re: web2py with jquery mobile?

2011-07-15 Thread António Ramos
type 'exceptions.WindowsError'([Error 32] The process cannot access the
file because it is being used by another process:
'D:/web2py10/web2py/deposit/web2py.plugin.jqmobile.w2p')

Em 15 de julho de 2011 09:28, António Ramos ramstei...@gmail.com escreveu:

 download and install the plugin in a web2py app gives me error!!!


 2011/7/14 Anthony abasta...@gmail.com

 http://web2py.com/plugins/plugin_jqmobile/about






[web2py] Re: hack doc: web2py's handling of incoming URLs

2011-07-15 Thread cjrh
Would you like me to document it somewhere actual? :)

Re: [web2py] Re: Recurly with web2py

2011-07-15 Thread Carl Roach
I'll be needing that erratum :)

In the meantime happy to support Massimo with the purchase




On 15 Jul 2011, at 09:28, cjrh caleb.hatti...@gmail.com wrote:

 On Thursday, July 14, 2011 6:00:29 PM UTC+2, Carl wrote:
 separately... had my head down when the 3rd edition of the Web2py book 
 came out... have just ordered it.
 
 Same happened to me, but I got out my frustration by asking Massimo whether I 
 could be allowed to fix errors in the online version of the book instead.   
 (It worked) 


Re: [web2py] Re: Recurly with web2py

2011-07-15 Thread cjrh
If you find errors as you go through your book, check to see whether they 
are still here:

http://www.web2py.com/book

If so, post them in this group.



[web2py] timeout: timed out

2011-07-15 Thread Manuele Pesenti

how could come?

Traceback (most recent call last):
  File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 
442, in wsgibase

parse_get_post_vars(request, environ)
  File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 
276, in parse_get_post_vars

request.body = copystream_progress(request) ### stores request body
  File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 
144, in copystream_progress

copystream(source, dest, size, chunk_size)
  File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/fileutils.py, 
line 366, in copystream

data = src.read(chunk_size)
  File /usr/lib64/python2.6/socket.py, line 353, in read
data = self._sock.recv(left)
timeout: timed out

I cannot install a newer version of my app because of this error but I'm 
pretty sure that nothing has changed in the web2py (v. 1.97.1) 
installation. Any idea?


thanks

Manuele


Re: [web2py] Good jQuery UI Library

2011-07-15 Thread Phyo Arkar
I am using JQUI most of the time , it is less bloated than any of
other UI Libs exist out there.

For full UI i am looking into QooXDoo but it is not jquery , it is
more like Java.

On 7/14/11, stargate kyoukh...@gmail.com wrote:
 I loved using the following library

 http://flowplayer.org/tools/index.html

 because it was light-weight but I think the developer is MIA. What is
 a good jQuery library that will work with web2py and is light
 weight.

 I am not impressed with jquery UI I think its to bloated.


[web2py] ajax not updating the client; got me stumped

2011-07-15 Thread Cliff
This ajax call is doing the server side stuff but failing to update
the client.  I am about at wit's end with this.

This is the client side call to ajax:

 ajax('{{=URL('add_training')}}',
['user_training_id', 'user_training_source'],
':eval')

This is the server side function:
def remove_training():
id_list = str(request.vars.user_training_id).split('_')
user_id = id_list[0]
course_id = id_list[1]
db((db.training_requirements.user_id == user_id) 
(db.training_requirements.course_id ==
course_id)).delete()
mystring = training_plan_status(user_id)
return jQuery('#training_plan_status').html(' + mystring + ');

I think the problem lies in this snippet from training_plan_status().
It seems to stick something in the output string that :eval does not
like.  If I replace return out with return 'found some rows,' the
browser updates the target.  Also if it falls through to the else at
the end, the browser updates the target.

if len(okay)  0:
out = 'h3Qualified/h3' + str(TABLE(
THEAD(TR(TH('Course
name'),TH('Status'),TH('Action'))),
*[TR(*rows) for rows in okay]))
if len(not_okay)  0:
if len(out)  0:
out += 'hr'
out += 'h3Not qualified/h3' + str(TABLE(
THEAD(TR(TH('Course
name'),TH('Reason'),TH('Action'))),
*[TR(*rows) for rows in not_okay]))
if len(out)  0:
return out
else:
return 'No training plan defined'

training_plan_status() works on initial page load when called by the
edit function.  It also works if I replace :eval in the client side
ajax call with the id of the target and sent its output without the
jQuery wrapper.

Anybody got any ideas?


Re: [web2py] Re: New Plugin: plugin_ckeditor

2011-07-15 Thread Ross Peoples
From BitBucket, download the model, the controller, the view, and the static 
plugin_ckeditor folder to your project.

Re: [web2py] Good jQuery UI Library

2011-07-15 Thread Ross Peoples
I have evaluated several UI libraries. ExtJS is the nicest, but you can only 
use it for open source projects, otherwise you have to buy it. QooXDoo looks 
cool, but wouldn't integrate into web2py very well if you wanted to 
completely replace jQuery. Then you have YUI (Yahoo User Interface), which 
is kind of nice, and probably the easiest library to integrate.

But I agree with Phyo that jQuery UI is really the best, easiest option. 
Plus, some of the jQuery plugins are really nice. Unfortunately, using 
jQuery's site to search for plugins is terrible. And plugin quality can 
range from horrible to excellent.


[web2py] Re: Recurly with web2py

2011-07-15 Thread Carl
Recurly have two APIs: 1) a full on integration API requiring you to
be PCI Compliant (level C) and the API I referred to my first post and
2) what they call Transparent Post api which submits a form to them
for processing but the returns to you via a redirect when you can
query their server for success/fail and other details. This TP API
requires a lower level of PCI PCI Compliance.

Alas, they don't provide a Python library for TP API (only Ruby and
PHP). Their CS has raised a ticket and will get back to me when the
library is available.

Recurly will also link with PayPal Website Payments Pro - probably the
most straightforward route to getting a Merchant account for those
with businesses registered in Canada, UK and USofA.

and no, I don't work there :)

On Jul 14, 5:00 pm, Carl m...@carlroach.com wrote:
 just a flag in the ground

 I've taken the python library fromrecurly.com (for their credit-card
 payment system) and it works just fine locally, on dev_appserver and
 on GAE.

 recurly.py (300 lines) makes use of import base64, import types,
 import re, import urllib, import urllib2.

 nice to have something slip in so smoothly.

 separately... had my head down when the 3rd edition of the Web2py book
 came out... have just ordered it.


[web2py] Re: ajax not updating the client; got me stumped

2011-07-15 Thread Cliff
More clues:

Firebug reports this came back from the host as a response.  Are the
line breaks and white space a problem?  Otherwise it looks clean to
me.

jQuery('#training_plan_status').html('h3Not qualified/
h3tabletheadtrthCourse name/ththReason/ththAction/
th/tr/theadtrtdAvailable training different name/tdtdNo
training record found./tdtdbutton type=button
id=2_8
class=remove_training

Remove from plan/button
/td/trtrtdFailed mandatory training/tdtdFailed
class on 07/05/2011/tdtdbutton type=button
id=2_9
class=remove_training

Remove from plan/button
/td/tr/table');

And here's the header:
HTTP/1.1 200 OK
X-Powered-By: web2py
Set-Cookie: session_id_trainingtracker=127.0.0.1-
ba65f53a-95e5-4d84-8f8d-643aaa256331; Path=/
Expires: Fri, 15 Jul 2011 11:40:36 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Content-Type: text/html; charset=utf-8
Date: Fri, 15 Jul 2011 11:40:36 GMT
Server: Rocket 1.2.2 Python/2.7.1+
Content-Length: 579
Connection: keep-alive


Re: [web2py] Help : SQLFORM.factory with multiple submit button ?

2011-07-15 Thread Patrick Installe
Solved :-)

I respond to myself :-) I was looking in the wrong direction :-(

Thank for the previous reponses, but in my case they doesn't fit since I
construct a graph instead of a list.

The solution template that works for me  :

In the controler :

def widget_submit_button(field,value):
# widget for additional form button
item = INPUT(_type='submit', _name=field, _value=value, value=value)
return (SPAN(item))

...

def form_1():
  #
  form = SQLFORM.factory(Field('btn_back', 'string', default=T(' Back'),
widget=widget_submit_button), submit_button=T('Next '))

  if form.accepts(request.vars, session):
if request.vars.has_key('no_table.'+'btn_back'):
redirect(URL('form_0'))
   redirect(URL('form_2'))

return dict(form=form)

...


in the view I use :
...
{{=form.custom.begin}}
..
{{=form.custom.widget['all_back']}}
{{=form.custom.submit}}
{{=form.custom.end}}
...

--
Patrick Installé (pinsta...@gmal.com)


[web2py] Re: timeout: timed out

2011-07-15 Thread Manuele Pesenti

On 15/07/2011 11:23, Manuele Pesenti wrote:

how could come?


Could it be due to the package?... before uploading the new package I 
downloaded from the portal the old working version and this package can 
be loaded even after uninstallation... not the new one...


any idea??
many thanks
Manuele



Traceback (most recent call last):
File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 442,
in wsgibase
parse_get_post_vars(request, environ)
File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 276,
in parse_get_post_vars
request.body = copystream_progress(request) ### stores request body
File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/main.py, line 144,
in copystream_progress
copystream(source, dest, size, chunk_size)
File /data/www/meteoproject_all/WEB2PY-1.97.1/gluon/fileutils.py, line
366, in copystream
data = src.read(chunk_size)
File /usr/lib64/python2.6/socket.py, line 353, in read
data = self._sock.recv(left)
timeout: timed out

I cannot install a newer version of my app because of this error but I'm
pretty sure that nothing has changed in the web2py (v. 1.97.1)
installation. Any idea?

thanks

Manuele




[web2py] Using T with IS_IN_DB

2011-07-15 Thread Kenneth Lundström

I have a requires with IS_IN_DB like this:
IS_IN_DB(db(db.t_status.id  0), 't_status.id', '%(f_status)s / %(f_name)s')

I´d like to translate the f_name with T(). Is it possible?


Kenneth



[web2py] Re: how to get user name before login is completed

2011-07-15 Thread Anthony
On Friday, July 15, 2011 4:25:47 AM UTC-4, puercoespin wrote: 

 In a view: 

 {{if auth.user_id:}} 
 {{=H4(T('Welcome ') + db.auth_user[auth.user_id].first_name)}} 
 {{pass}

 
I think he just wants the message to flash once upon login, not any time a 
logged in user visits the page. Auth does a redirect after login, so the 
message to be flashed has to be put into session.flash.
 
Anthony


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-15 Thread Anthony
Please submit an issue on Google Code: 
http://code.google.com/p/web2py/issues/list

On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:

 I get this too - a spurious list_records. prepended to the query. 
 Latest web2py 1.97.1 

 -Andy 

 On Jul 12, 10:08 pm, jc j-c...@lineone.net wrote: 
  Hi, 
  Trying to use linkto, so following example in web2py book
 http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re... 
 first, 
  to try to understand. 
  
  I have copied the example with person and dog tables, in particular in 
 def 
  display_form(): I have 
  
  link = URL('list_records') 
  form = SQLFORM(db.person, record, deletable=True, 
upload=url, linkto=link, labels = {'dog.owner':This 
  person's dogs}) 
  
  as described in the book. 
  
  The books says the link generated will be 
  /test/default/list_records/dog?query=dog.owner%3D5 but in fact the link 

  which appears when I visit /test/default/display_form/1 is 
   /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, 
 i.e. 
  there is a spurious list.records and a spurious %3D. Not surprisingly the 

  link doesn't work. Can anybody tell me what I am doing wrong? 
  
  Thanks.



[web2py] Problem with CRUD using fancybox dialog

2011-07-15 Thread Jim Steil

Hi

I have a component on my page that lists a few records.  Clicking on a 
link in the list will take me to a new page where I can edit the record 
using standard crud.  I want this edit page to appear in a modal dialog 
so I'm using the fancybox tool (http://fancybox.net) to display the 
link.  When I edit the record by going to a new page, it works fine, I 
can save the data.  But, when I use fancybox to edit modally, the update 
doesn't take place.


I'm just looking for some help on where to look for the  problem.  Any 
ideas where to begin?


-Jim






Re: [web2py] Problem with CRUD using fancybox dialog

2011-07-15 Thread Kenneth Lundström

Hello Jim,

this is exactly the same thing that I have tried to achieve without much 
luck.


Would it be possible to get a copy of how you have done it. I have no 
ideas to give you why it is not working, atleast not at the moment.



Kenneth


Hi

I have a component on my page that lists a few records.  Clicking on a 
link in the list will take me to a new page where I can edit the 
record using standard crud.  I want this edit page to appear in a 
modal dialog so I'm using the fancybox tool (http://fancybox.net) to 
display the link.  When I edit the record by going to a new page, it 
works fine, I can save the data.  But, when I use fancybox to edit 
modally, the update doesn't take place.


I'm just looking for some help on where to look for the  problem.  Any 
ideas where to begin?


-Jim








[web2py] XSRF attacks

2011-07-15 Thread Carl
Any views/insight for adding (or not adding) one of this approaches to
web2py for its FORMS ?
http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html


[web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Anthony
Is the form being displayed in the fancybox via Ajax? If so, you might try 
including a component (http://web2py.com/book/default/chapter/13#Components), 
or look into Ajax form submission (
http://web2py.com/book/default/chapter/10#Ajax-Form-Submission).
 
Anthony

On Friday, July 15, 2011 9:56:52 AM UTC-4, Jim S wrote:

 Hi 

 I have a component on my page that lists a few records.  Clicking on a 
 link in the list will take me to a new page where I can edit the record 
 using standard crud.  I want this edit page to appear in a modal dialog 
 so I'm using the fancybox tool (http://fancybox.net) to display the 
 link.  When I edit the record by going to a new page, it works fine, I 
 can save the data.  But, when I use fancybox to edit modally, the update 
 doesn't take place. 

 I'm just looking for some help on where to look for the  problem.  Any 
 ideas where to begin? 

  -Jim 


   

[web2py] Re: XSRF attacks

2011-07-15 Thread Anthony
web2py already uses the second method mentioned, as long as you call 
form.accepts(request, 
session) in your form action (you have to pass session to form.accepts 
because it stores the formkey in the session). Note, this also protects 
against double form submission (the formkey is only good for one 
submission).
 
Anthony

On Friday, July 15, 2011 10:38:57 AM UTC-4, Carl wrote:

 Any views/insight for adding (or not adding) one of this approaches to 
 web2py for its FORMS ? 

 http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html



[web2py] Re: XSRF attacks

2011-07-15 Thread Anthony
See http://web2py.com/book/default/chapter/01?search=CSRF and 
http://web2py.com/book/default/chapter/07#Hidden-fields.

On Friday, July 15, 2011 10:49:08 AM UTC-4, Anthony wrote:

 web2py already uses the second method mentioned, as long as you call 
 form.accepts(request, 
 session) in your form action (you have to pass session to form.accepts 
 because it stores the formkey in the session). Note, this also protects 
 against double form submission (the formkey is only good for one 
 submission).
  
 Anthony

 On Friday, July 15, 2011 10:38:57 AM UTC-4, Carl wrote:

 Any views/insight for adding (or not adding) one of this approaches to 
 web2py for its FORMS ? 

 http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html



Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
Although this is working:

db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'instance.id',multiple=True)

Is only showing ids , disregarding of the format defined here:

db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))

IS there any way to fix that?

Thanks,
Nico

On Thu, Jul 14, 2011 at 1:45 PM, Anthony abasta...@gmail.com wrote:
 The default validator for a list:reference field is
 IS_IN_DB(db,'table.id',multiple=True). Instead of db, you can pass a DAL
 Set to that validator to filter the returned list -- something like:

 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==current_profile.type),'instance.id',multiple=True)


 See http://web2py.com/book/default/chapter/06#DAL,-Table,-Field and
 http://web2py.com/book/default/chapter/07#Database-Validators.

 Anthony

 On Wednesday, July 13, 2011 2:39:50 PM UTC-4, Nico Palumbo wrote:

 I have currently this multiselect generated by list:references:

 db.py:


 db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
 r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))
 ...
 db.define_table('audienceInstances', Field('instances','list:reference
 instance'),Field('user',db.auth_user,writable=False, readable=False))

 default.py:

 monitoredInstances = db.audienceInstances(db.audienceInstances.user ==
 auth.user.id)
     #Generates a form for the updation of the list of monitored instances
     instancesForm = SQLFORM(db.audienceInstances, monitoredInstances,
 submit_button='Update', showid=False)
     if instancesForm.accepts(request.vars, session):
         response.flash = 'list updated'
     elif instancesForm.errors:
         response.flash = 'form has errors'

 That shows a list select among all instances. But what if I'd like to
 show a subset of that list, I mean I added a type field in instance
 table, and like to get the instances of the type the user has selected
 in its profile.

 The only way I can think of is creating a separate audienceInstances
 table for each type. Is there any othere way?

 Thanks,
 Nico



Re: [web2py] XSRF attacks

2011-07-15 Thread David J
Web2py supports it out of the nox
On Jul 15, 2011 10:39 AM, Carl m...@carlroach.com wrote:
 Any views/insight for adding (or not adding) one of this approaches to
 web2py for its FORMS ?

http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html


Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Carl Roach
that's excellent news (and thanks for those links).

if I'm defining the HTML of a form in a file in my views/ directory
how do I leverage this gatekeeper?



On 15 July 2011 15:49, Anthony abasta...@gmail.com wrote:
 web2py already uses the second method mentioned, as long as you call
 form.accepts(request, session) in your form action (you have to pass session
 to form.accepts because it stores the formkey in the session). Note, this
 also protects against double form submission (the formkey is only good for
 one submission).

 Anthony
 On Friday, July 15, 2011 10:38:57 AM UTC-4, Carl wrote:

 Any views/insight for adding (or not adding) one of this approaches to
 web2py for its FORMS ?

 http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html


Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Carl Roach
and relately... I'm using Web2py JSON api.

is my site protected out of the box or do I need to pass parameters
in a particular manner?

On 15 July 2011 15:53, Carl Roach m...@carlroach.com wrote:
 that's excellent news (and thanks for those links).

 if I'm defining the HTML of a form in a file in my views/ directory
 how do I leverage this gatekeeper?



 On 15 July 2011 15:49, Anthony abasta...@gmail.com wrote:
 web2py already uses the second method mentioned, as long as you call
 form.accepts(request, session) in your form action (you have to pass session
 to form.accepts because it stores the formkey in the session). Note, this
 also protects against double form submission (the formkey is only good for
 one submission).

 Anthony
 On Friday, July 15, 2011 10:38:57 AM UTC-4, Carl wrote:

 Any views/insight for adding (or not adding) one of this approaches to
 web2py for its FORMS ?

 http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-attacks.html



[web2py] Re: XSRF attacks

2011-07-15 Thread Massimo Di Pierro
To clarify...

crud.create and crud.update have XSRF protection.

SQLFORM with accepts(request,session) has it too.

SQLFORM with accepts(request) and no session passed has no XSRF. This
is intentional to allow passing forms, for example, from other apps.

On Jul 15, 9:53 am, Carl Roach m...@carlroach.com wrote:
 that's excellent news (and thanks for those links).

 if I'm defining the HTML of a form in a file in my views/ directory
 how do I leverage this gatekeeper?

 On 15 July 2011 15:49, Anthony abasta...@gmail.com wrote:







  web2py already uses the second method mentioned, as long as you call
  form.accepts(request, session) in your form action (you have to pass session
  to form.accepts because it stores the formkey in the session). Note, this
  also protects against double form submission (the formkey is only good for
  one submission).

  Anthony
  On Friday, July 15, 2011 10:38:57 AM UTC-4, Carl wrote:

  Any views/insight for adding (or not adding) one of this approaches to
  web2py for its FORMS ?

 http://www.codinghorror.com/blog/2008/10/preventing-csrf-and-xsrf-att...


Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Ross Peoples
Anytime that you use {{=var}} in a view, the var or whatever it is you are 
injecting into the HTML is automatically escaped to prevent injection 
attacks. If you wanted to pass in some pre-formatted HTML, you would have to 
specifically wrap it in an XML() object for it to display properly, 
bypassing the escaping done by web2py.

Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Anthony
On Friday, July 15, 2011 10:53:55 AM UTC-4, Carl wrote: 

 that's excellent news (and thanks for those links). 

 if I'm defining the HTML of a form in a file in my views/ directory
 how do I leverage this gatekeeper?

If you're building forms manually in HTML, you'll still have to call 
form.accepts(..., session) in your action in order to have the formkey (a) 
generated prior to form submission and (b) checked against the session upon 
submission. To include the two hidden fields (_formname and _formkey) in 
your manually created form, you can do:
 
{{=form.hidden_fields()}}
 
 
Anthony


Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Anthony
It might help if you can show the code that generates the list component and 
then populates the fancybox with the edit form.

On Friday, July 15, 2011 10:58:42 AM UTC-4, Jim S wrote:

 Anthony

 Thanks for the reply.  Unfortunately I am not understanding your 
 references.  I am already using a component on my page to list the records.  
 I've attached two screen shots that show what I'm talking about.  If you 
 click on the link in the component it opens the 'Edit Price Backer Item' 
 page.  

 Are you saying I could/should use a component for the edit page as well?  
 Then I'm confused on how that would all work.  I'll reread chapter 10 and 
 see if any lightbulbs come on.  

 Thanks again for the reply, I do appreciate it...

 -Jim

 On 7/15/2011 9:40 AM, Anthony wrote: 

 Is the form being displayed in the fancybox via Ajax? If so, you might try 
 including a component (
 http://web2py.com/book/default/chapter/13#Components), or look into Ajax 
 form submission (
 http://web2py.com/book/default/chapter/10#Ajax-Form-Submission).
  
 Anthony

 On Friday, July 15, 2011 9:56:52 AM UTC-4, Jim S wrote:

 Hi 

 I have a component on my page that lists a few records.  Clicking on a 
 link in the list will take me to a new page where I can edit the record 
 using standard crud.  I want this edit page to appear in a modal dialog 
 so I'm using the fancybox tool (http://fancybox.net) to display the 
 link.  When I edit the record by going to a new page, it works fine, I 
 can save the data.  But, when I use fancybox to edit modally, the update 
 doesn't take place. 

 I'm just looking for some help on where to look for the  problem.  Any 
 ideas where to begin? 

  -Jim 




Re: [web2py] Re: New Plugin: plugin_ckeditor

2011-07-15 Thread Tito Garrido
Thanks! I was able to install it!

I'm not sure why but flash player doesn't work for me... I've uploaded
planets.flv (available on Massimo plugin page) and it didn't work... anybody
able to put flash videos to work using ckeditor?

Regards,

tito

On Fri, Jul 15, 2011 at 8:41 AM, Ross Peoples ross.peop...@gmail.comwrote:

 From BitBucket, download the model, the controller, the view, and the
 static plugin_ckeditor folder to your project.




-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Carl Roach
that is *so* cool. thanks Anthony.

I've modify my controller code to create a form and call accepts():
form = FORM(TEXTAREA(_name='message'), INPUT(_name='email'))
if form.accepts(request.vars, session): etc
and return the form so it's passed to my view

My view is still hand-coded HTML but now I've added
{{=form.hidden_fields()}} to it

sorted.

On 15 July 2011 16:08, Anthony abasta...@gmail.com wrote:
 On Friday, July 15, 2011 10:53:55 AM UTC-4, Carl wrote:

 that's excellent news (and thanks for those links).

 if I'm defining the HTML of a form in a file in my views/ directory
 how do I leverage this gatekeeper?

 If you're building forms manually in HTML, you'll still have to call
 form.accepts(..., session) in your action in order to have the formkey (a)
 generated prior to form submission and (b) checked against the session upon
 submission. To include the two hidden fields (_formname and _formkey) in
 your manually created form, you can do:

 {{=form.hidden_fields()}}


 Anthony


Re: [web2py] Re: XSRF attacks

2011-07-15 Thread Anthony
Note, an alternative to completely hand coding forms is to hand code 
everything but the opening, closing, and widgets, and use form.custom as 
described here: http://web2py.com/book/default/chapter/07#Custom-forms. In 
that case, form.custom.end will include the two hidden fields (as well as 
the closing /form tag).
 
Anthony

On Friday, July 15, 2011 11:24:53 AM UTC-4, Carl wrote:

 that is *so* cool. thanks Anthony. 

 I've modify my controller code to create a form and call accepts():
 form = FORM(TEXTAREA(_name='message'), INPUT(_name='email'))
 if form.accepts(request.vars, session): etc
 and return the form so it's passed to my view 

 My view is still hand-coded HTML but now I've added
 {{=form.hidden_fields()}} to it 

 sorted. 

 On 15 July 2011 16:08, Anthony abas...@gmail.com wrote:
  On Friday, July 15, 2011 10:53:55 AM UTC-4, Carl wrote:
 
  that's excellent news (and thanks for those links).
 
  if I'm defining the HTML of a form in a file in my views/ directory
  how do I leverage this gatekeeper?
 
  If you're building forms manually in HTML, you'll still have to call
  form.accepts(..., session) in your action in order to have the formkey 
 (a)
  generated prior to form submission and (b) checked against the session 
 upon
  submission. To include the two hidden fields (_formname and _formkey) in
  your manually created form, you can do:
 
  {{=form.hidden_fields()}}
 
 
  Anthony

  

[web2py] can we use javascript in sqlform How?

2011-07-15 Thread sagar
I am using sql form
db.py
data=db.define_table('template_properties',
Field('temp_uid', 'string',default=uuid.uuid1(),
writable=False, readable=False),
Field('template_name', default=''),
Field('deadline','datetime'),
Field('type','string',
requires=IS_IN_SET(['onetime','daily','weekly','custom'])),
)


I am using sql form

def add():
 form=SQLFORM(db.template_properties)


I have to add extra textbox once user select custom  value for type
field...








[web2py] Re: can we use javascript in sqlform How?

2011-07-15 Thread Anthony
The id of the 'type' widget will be 'template_properties_type', so you can 
add JS to the page to listen for the selection event and display/create a 
text box whenever 'custom' is selected. If you want the content of the text 
box saved in the table, you should add a field for it, and initially set 
that field as hidden in the form (and use JS to unhide it).
 
Anthony

On Friday, July 15, 2011 11:42:04 AM UTC-4, sagar wrote:

 I am using sql form 
 db.py 
 data=db.define_table('template_properties', 
 Field('temp_uid', 'string',default=uuid.uuid1(), 
 writable=False, readable=False), 
 Field('template_name', default=''), 
 Field('deadline','datetime'), 
 Field('type','string', 
 requires=IS_IN_SET(['onetime','daily','weekly','custom'])), 
 ) 


 I am using sql form 

 def add(): 
  form=SQLFORM(db.template_properties) 


 I have to add extra textbox once user select custom  value for type 
 field... 








Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
I fixed it like this:

db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'instance.id',lambda
r: '%s %s' %
(db.application[r.app].name,db.server[r.server].hostname),multiple=True)


On Fri, Jul 15, 2011 at 2:52 PM, Nicolas Palumbo napalu...@gmail.com wrote:
 Although this is working:
    
 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'instance.id',multiple=True)

 Is only showing ids , disregarding of the format defined here:

 db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
 r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))

 IS there any way to fix that?

 Thanks,
 Nico

 On Thu, Jul 14, 2011 at 1:45 PM, Anthony abasta...@gmail.com wrote:
 The default validator for a list:reference field is
 IS_IN_DB(db,'table.id',multiple=True). Instead of db, you can pass a DAL
 Set to that validator to filter the returned list -- something like:

 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==current_profile.type),'instance.id',multiple=True)


 See http://web2py.com/book/default/chapter/06#DAL,-Table,-Field and
 http://web2py.com/book/default/chapter/07#Database-Validators.

 Anthony

 On Wednesday, July 13, 2011 2:39:50 PM UTC-4, Nico Palumbo wrote:

 I have currently this multiselect generated by list:references:

 db.py:


 db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
 r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))
 ...
 db.define_table('audienceInstances', Field('instances','list:reference
 instance'),Field('user',db.auth_user,writable=False, readable=False))

 default.py:

 monitoredInstances = db.audienceInstances(db.audienceInstances.user ==
 auth.user.id)
     #Generates a form for the updation of the list of monitored instances
     instancesForm = SQLFORM(db.audienceInstances, monitoredInstances,
 submit_button='Update', showid=False)
     if instancesForm.accepts(request.vars, session):
         response.flash = 'list updated'
     elif instancesForm.errors:
         response.flash = 'form has errors'

 That shows a list select among all instances. But what if I'd like to
 show a subset of that list, I mean I added a type field in instance
 table, and like to get the instances of the type the user has selected
 in its profile.

 The only way I can think of is creating a separate audienceInstances
 table for each type. Is there any othere way?

 Thanks,
 Nico




Re: [web2py] Re: Get date from datetime with DAL

2011-07-15 Thread Angelo Compagnucci
Hi Denes,

thank you for your time!

row.data.date() could be the solution to the problem, but it forces me
to traverse the table returned by the query and build another table
with dates instead of datetimes... Not the best solution in speed and
elegance!

I think that a query like the one I made it's really common. I have a
timestamp and I want to count the occurences of a determined event by
date exctracted by the timestamp. I think that excrating the date (or
the time) from a datetime it's really a speedy operation if
accomplished by the database, and should be supported by all major
databases ( I think really all databases!).

By the way I resolved with this quick and dirty hack:

rows = db(db.test).select(db.test.data[:10])

slicing the first 10 character is enough for me!

If anyoune intrested, I'll explore te possibility to add a .date() and
a .time() to FIeld object, or find a way to concatenate .year()
.month() .day()!

Thank you!

2011/7/13 DenesL denes1...@yahoo.ca:
 Hi Angelo,

 sorry, I missed the datetime in the title (duh!).

 The date function belongs to the datetime object so it would be
 available in the rows only, the field does not have it:

 for row in rows:
  print row.data.date()

 Note that the year month day hour minute second functions might not be
 available in all DBs since the SQL implementation varies.

 By the way, the MSSQL adapter has it wrong in 1.94.5, I have to check
 on the newer versions.
 Hmmm... that means I have never came across the need for those
 functions.

 If you are only working with SQLite then adding date() or time() would
 not be hard and they seem like sensible options. Maybe even add them
 to other adapters as well.

 Is the row.data.date() option enough for you?.

 Denes.


 On Jul 12, 5:39 pm, Angelo Compagnucci angelo.compagnu...@gmail.com
 wrote:
 Sorry for being pedantic!

 I made an empty application with only a table in the model defined as:

 db.define_table('test',Field('data','datetime'))

 and inserted some datetimes.

 then I made a method in the controller:

 def getdata():
     rows = db(db.test).select()
     return dict(rows=rows)

 and it works.

 It works also:

 def getdata():
     rows = db(db.test).select(db.test.data.year())
     return dict(rows=rows)

 but if I try:

 def getdata():
     rows = db(db.test).select(db.test.data.date())
     return dict(rows=rows)

 web2py throws an exception with the message:

 File /home/angelo/DEV/web2py/applications/welcome/controllers/default.py,
 line 13, in getdata
     rows = db(db.test.ALL).select(db.test.data.data())
 AttributeError: 'Field' object has no attribute 'date'

 So what's wrong?

 Thank you!

 2011/7/12 pbreit pbreitenb...@gmail.com:







  I believe datetime is a Python datetime.datetime object and gets validated
  by IS_DATETIME().
 http://docs.python.org/library/datetime.html#datetime.datetime
 http://web2py.com/book/default/chapter/07?search=IS_DATETIME


Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Anthony
The table format string/function should be stored in its ._format attribute, 
so you might also be able to do:
 
db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),
 
'instance.id',db.instance._format,multiple=True)
 
 
Maybe that should actually be the default when label=None.
 
Anthony
 

On Friday, July 15, 2011 11:56:13 AM UTC-4, Nico Palumbo wrote:

 I fixed it like this:
 
 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'
 instance.id',lambda
 r: '%s %s' %
 (db.application[r.app].name,db.server[r.server].hostname),multiple=True) 


 On Fri, Jul 15, 2011 at 2:52 PM, Nicolas Palumbo napa...@gmail.com 
 wrote:
  Although this is working:

  
 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'
 instance.id',multiple=True)
 
  Is only showing ids , disregarding of the format defined here:
 
  
 db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
  r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))
 
  IS there any way to fix that?
 
  Thanks,
  Nico
 
  On Thu, Jul 14, 2011 at 1:45 PM, Anthony abas...@gmail.com wrote:
  The default validator for a list:reference field is
  IS_IN_DB(db,'table.id',multiple=True). Instead of db, you can pass a 
 DAL
  Set to that validator to filter the returned list -- something like:
 
  
 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==current_profile.type),'
 instance.id',multiple=True)
 
 
  See http://web2py.com/book/default/chapter/06#DAL,-Table,-Field and
  http://web2py.com/book/default/chapter/07#Database-Validators.
 
  Anthony
 
  On Wednesday, July 13, 2011 2:39:50 PM UTC-4, Nico Palumbo wrote:
 
  I have currently this multiselect generated by list:references:
 
  db.py:
 
 
  
 db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda
  r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname))
  ...
  db.define_table('audienceInstances', Field('instances','list:reference
  instance'),Field('user',db.auth_user,writable=False, readable=False))
 
  default.py:
 
  monitoredInstances = db.audienceInstances(db.audienceInstances.user ==
  auth.user.id)
  #Generates a form for the updation of the list of monitored 
 instances
  instancesForm = SQLFORM(db.audienceInstances, monitoredInstances,
  submit_button='Update', showid=False)
  if instancesForm.accepts(request.vars, session):
  response.flash = 'list updated'
  elif instancesForm.errors:
  response.flash = 'form has errors'
 
  That shows a list select among all instances. But what if I'd like to
  show a subset of that list, I mean I added a type field in instance
  table, and like to get the instances of the type the user has selected
  in its profile.
 
  The only way I can think of is creating a separate audienceInstances
  table for each type. Is there any othere way?
 
  Thanks,
  Nico
 
 



Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Anthony
On Friday, July 15, 2011 12:27:19 PM UTC-4, Anthony wrote: 

 The table format string/function should be stored in its ._format 
 attribute, so you might also be able to do:
  
 db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),
  
 'instance.id',db.instance._format,multiple=True)

 
 
In fact, it looks like this is what the DAL does by default -- but since you 
have overridden the default validator, you have to specify 
db.instance._format explicitly.
 
Anthony
 


[web2py] Getting a reproducible web2py internal error

2011-07-15 Thread Gary Herron
Has anyone seen this error, or know what it means?  Any advice, 
workaround or solution would be greatly appreciated.


On a machine (somewhere in the cloud), I'm trying to get a small web2py 
site working and I'm running into a persistent reproducible bug that's 
killing me.


The error I get is:
  OperationalError:  unable to open database file

This eventually occurs on any application I try to create, but I've been 
able to reproduce it several times with the following set of actions:


   Download a fresh copy of web2py for windows, extract, and run
   Create a new application named test
   In test's admin interface create two auth_user's and one auth_group
   Attempt to create a auth_membership -- instead of the form I get the
   above error.

The system I'm running on is a Microsoft Windows Server 2003 R2
On both a Linux/Ubuntu and a Windows XP machine everything works well.

Thanks for any help

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



[web2py] Problem using load with powertables

2011-07-15 Thread Roberto Perdomo
Hi, i am using powertables an i like load a table using
{{=LOAD(c='default',f='finction',args='',extension='html',ajax=False,ajax_trap=False)}},
but the table not show details when click the green plus button.

The error is: Cannot read property '_aData' of undefined.

I load the table inside a tab, inside other page, but the error persist.

I dont know what happen, I appreciate your suggestions.


[web2py] Pagination

2011-07-15 Thread contatogilson...@gmail.com
Hello guys,

I was wondering if anyone knows any plugin for web2py which makes data
paging.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


Re: [web2py] Pagination

2011-07-15 Thread Gary Herron

On 07/15/2011 10:32 AM, contatogilson...@gmail.com wrote:

Hello guys,

I was wondering if anyone knows any plugin for web2py which makes data 
paging.

_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



Both webgrid (a web2py plugin) and jqgrid (jquery plugin) layout tables 
of data with pagination.


--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
works perfect. Thanks!


[web2py] list:string - IS_IN_SET

2011-07-15 Thread Jim Steil

Hi

Having another problem today with the following:

table defined as:

priceBackerItem = db.define_table('priceBackerItem',
Field('priceBackerItemId', 'id'),
Field('priceBackerId', db.priceBacker, required=True, 
label='Price Backer'),
Field('itemType', 'list:string', required=True, label='Item 
Type'),

Field('sequence', 'integer'),
Field('description', 'text'),
Field('price', 'decimal(9,2)', label='15-Day Price'),
Field('subscript', 'text'))

priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation 
Price Adjustment',

'Medication Price Adjustment'],
zero='choose one',multiple=False)

Using CRUD, when the update form displays, it never displays the current 
value of item type.  The reason is (my best guess) that when I look in 
the database (mysql), I see the values as:


|Medication Price Adjustment| or
|Special Formulation Price Adjustment|

...including the vertical lines in the text.

Any advice?

-Jim



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Jim Steil
Found this one myself.  Don't use 'list:string'.  This is just a regular 
string field.


On 7/15/2011 12:55 PM, Jim Steil wrote:

Hi

Having another problem today with the following:

table defined as:

priceBackerItem = db.define_table('priceBackerItem',
Field('priceBackerItemId', 'id'),
Field('priceBackerId', db.priceBacker, required=True, 
label='Price Backer'),
Field('itemType', 'list:string', required=True, 
label='Item Type'),

Field('sequence', 'integer'),
Field('description', 'text'),
Field('price', 'decimal(9,2)', label='15-Day Price'),
Field('subscript', 'text'))

priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation 
Price Adjustment',

'Medication Price Adjustment'],
zero='choose one',multiple=False)

Using CRUD, when the update form displays, it never displays the 
current value of item type.  The reason is (my best guess) that when I 
look in the database (mysql), I see the values as:


|Medication Price Adjustment| or
|Special Formulation Price Adjustment|

...including the vertical lines in the text.

Any advice?

-Jim



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Anthony
And if you did need list:string, then I think you'd want to set 
multiple=True in the IS_IN_SET validator.

On Friday, July 15, 2011 2:05:21 PM UTC-4, Jim S wrote:

 Found this one myself.  Don't use 'list:string'.  This is just a regular 
 string field. 

 On 7/15/2011 12:55 PM, Jim Steil wrote:
  Hi
 
  Having another problem today with the following:
 
  table defined as:
 
  priceBackerItem = db.define_table('priceBackerItem',
  Field('priceBackerItemId', 'id'),
  Field('priceBackerId', db.priceBacker, required=True, 
  label='Price Backer'),
  Field('itemType', 'list:string', required=True, 
  label='Item Type'),
  Field('sequence', 'integer'),
  Field('description', 'text'),
  Field('price', 'decimal(9,2)', label='15-Day Price'),
  Field('subscript', 'text'))
 
  priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
  priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation 
  Price Adjustment',
  'Medication Price Adjustment'],
  zero='choose one',multiple=False)
 
  Using CRUD, when the update form displays, it never displays the 
  current value of item type.  The reason is (my best guess) that when I 
  look in the database (mysql), I see the values as:
 
  |Medication Price Adjustment| or
  |Special Formulation Price Adjustment|
 
  ...including the vertical lines in the text.
 
  Any advice?
 
  -Jim
 



Re: [web2py] Pagination

2011-07-15 Thread contatogilson...@gmail.com
They are not good when you have thousands of records to be consulted. Do I
need anyplugin that calls the paging of data via the database.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


[web2py] Re: Good jQuery UI Library

2011-07-15 Thread stargate
Thank everybody for the help. I have been also looking into this

http://angularjs.org/

Not a UI library but a JavaScript MVC

On Jul 15, 7:57 am, Ross Peoples ross.peop...@gmail.com wrote:
 I have evaluated several UI libraries. ExtJS is the nicest, but you can only
 use it for open source projects, otherwise you have to buy it. QooXDoo looks
 cool, but wouldn't integrate into web2py very well if you wanted to
 completely replace jQuery. Then you have YUI (Yahoo User Interface), which
 is kind of nice, and probably the easiest library to integrate.

 But I agree with Phyo that jQuery UI is really the best, easiest option.
 Plus, some of the jQuery plugins are really nice. Unfortunately, using
 jQuery's site to search for plugins is terrible. And plugin quality can
 range from horrible to excellent.


[web2py] Re: Get date from datetime with DAL

2011-07-15 Thread DenesL
Hi Angelo,

On Jul 15, 12:12 pm, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Hi Denes,

 thank you for your time!

 row.data.date() could be the solution to the problem, but it forces me
 to traverse the table returned by the query and build another table
 with dates instead of datetimes... Not the best solution in speed and
 elegance!

 I think that a query like the one I made it's really common. I have a
 timestamp and I want to count the occurences of a determined event by
 date exctracted by the timestamp. I think that excrating the date (or
 the time) from a datetime it's really a speedy operation if
 accomplished by the database, and should be supported by all major
 databases ( I think really all databases!).

 By the way I resolved with this quick and dirty hack:

 rows = db(db.test).select(db.test.data[:10])

that dirty hack fails for the MSSQL adapter in 1.97.1:

 rr=db2(db2.test).select(db2.test.data[:10])
Traceback (most recent call last):
  File console, line 1, in module
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 5394, in select
return self.db._adapter.select(self.query,fields,attributes)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1176, in select
rows = response(sql)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1166, in response
self.execute(sql)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1251, in execute
return self.log_execute(*a, **b)
  File C:\w2p\web2py_1.97.1_src\gluon\dal.py, line 1246, in
log_execute
ret = self.cursor.execute(*a,**b)
ProgrammingError: ('42000', '[42000] [Microsoft][ODBC SQL Server
Driver][SQL Ser
ver]Argument data type datetime is invalid for argument 1 of substring
function.
 (8116) (SQLExecDirectW)')

the SQL command issued is:

 db2._lastsql
'SELECT  SUBSTRING(test.data,1,(11 - 1)) FROM test WHERE (test.id 
0);'

in the case of SQLite the command is:

 db._lastsql
'SELECT  SUBSTR(test.data,1,(11 - 1)) FROM test WHERE (test.id  0);'

so you see it all depends on the DB backend, and we would have to
check if all the other DBs do have such functions.
The MSSQL error could be a bug.

Also note how the content of each row differs from a 'standard'
select:

 rr=db(db.test).select(db.test.data)
 print rr[0]
Row {'data': datetime.datetime(2011, 7, 15, 14, 34, 18)}

 rr=db(db.test).select(db.test.data[:10])
 print rr[0]
Row {'_extra': Row {'SUBSTR(test.data,1,(11 - 1))': u'2011-07-15'}}




 slicing the first 10 character is enough for me!

 If anyoune intrested, I'll explore te possibility to add a .date() and
 a .time() to FIeld object, or find a way to concatenate .year()
 .month() .day()!

 Thank you!


[web2py] Re: Good jQuery UI Library

2011-07-15 Thread Mengu
why qooxdoo would not integrate into web2py? it would fit awesome
without any problems. :)

On Jul 15, 2:57 pm, Ross Peoples ross.peop...@gmail.com wrote:
 I have evaluated several UI libraries. ExtJS is the nicest, but you can only
 use it for open source projects, otherwise you have to buy it. QooXDoo looks
 cool, but wouldn't integrate into web2py very well if you wanted to
 completely replace jQuery. Then you have YUI (Yahoo User Interface), which
 is kind of nice, and probably the easiest library to integrate.

 But I agree with Phyo that jQuery UI is really the best, easiest option.
 Plus, some of the jQuery plugins are really nice. Unfortunately, using
 jQuery's site to search for plugins is terrible. And plugin quality can
 range from horrible to excellent.


Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Anthony
On Friday, July 15, 2011 1:15:55 PM UTC-4, Jim S wrote: 

 Watching firebug I don't see anything happen.  No validation runs because 
 even if I have an error on my form, it goes away.  When I setup my form 
 using CRUD, I set the 'next' parameter to the same Edit Price Backer form 
 that is displayed before the modal is show.  However, I don't think it is 
 even getting called.  It would appear as though the Edit Price Backer page 
 is redisplayed, but I don't know what is triggering it.  You're probably 
 right in assuming that the form on the initial page is being submitted.   
 But, if I put a value in the form (edit price backer) and click submit on 
 the modal (edit price backer item) form, neither of the forms save their 
 values.

 Is there a way with CRUD to specify your form name?  I couldn't find it.

 
After the form is created (e.g., form=crud() or form=crud.create(...)), the 
name should be stored in form.formname, and you can change that to something 
else if you'd like.
 
Anthony
 


[web2py] Re: Pagination

2011-07-15 Thread Anthony
Have you seen this section in the book: 
http://web2py.com/book/default/chapter/12#Pagination?
 
The PowerTable plugin uses DataTables, which allows server-side processing, 
including pagination. jqGrid also allows server-side pagination.
 
Anthony

On Friday, July 15, 2011 1:32:53 PM UTC-4, Gilson Filho Brazil wrote:

 Hello guys,

 I was wondering if anyone knows any plugin for web2py which makes data 
 paging.
 _
 *Gilson Filho* 
 *Web Developer
 http://gilsondev.com*



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Jim Steil

Ok, I updated my table def here to be

Field('itemType', length=50, required=True, label='Item Type'),

, ran with migrate=False, fake_migrate=True and everything works.  When 
I remove migrate=False, fake_migrate=True, then I get the following 
traceback:


Traceback(most recent call last):
  Filegluon/restricted.py,line184,inrestricted
  FileC:/dev/web2py/applications/InfoCenter/models/db.py  
http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py,line372,inmodule
  Filegluon/dal.py,line4213,indefine_table
  Filegluon/dal.py,line641,increate_table
  Filegluon/dal.py,line696,inmigrate_table
  Filegluon/dal.py,line4570,in__getitem__
KeyError:'itemtype'


Thoughts?

-Jim


On 7/15/2011 1:05 PM, Jim Steil wrote:
Found this one myself.  Don't use 'list:string'.  This is just a 
regular string field.


On 7/15/2011 12:55 PM, Jim Steil wrote:

Hi

Having another problem today with the following:

table defined as:

priceBackerItem = db.define_table('priceBackerItem',
Field('priceBackerItemId', 'id'),
Field('priceBackerId', db.priceBacker, required=True, 
label='Price Backer'),
Field('itemType', 'list:string', required=True, 
label='Item Type'),

Field('sequence', 'integer'),
Field('description', 'text'),
Field('price', 'decimal(9,2)', label='15-Day Price'),
Field('subscript', 'text'))

priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation 
Price Adjustment',

'Medication Price Adjustment'],
zero='choose one',multiple=False)

Using CRUD, when the update form displays, it never displays the 
current value of item type.  The reason is (my best guess) that when 
I look in the database (mysql), I see the values as:


|Medication Price Adjustment| or
|Special Formulation Price Adjustment|

...including the vertical lines in the text.

Any advice?

-Jim



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Anthony
Not sure about that -- check out 
http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations.

On Friday, July 15, 2011 3:09:37 PM UTC-4, Jim S wrote:

 Ok, I updated my table def here to be

 Field('itemType', length=50, required=True, label='Item Type'), 

 , ran with migrate=False, fake_migrate=True and everything works.  When I 
 remove migrate=False, fake_migrate=True, then I get the following traceback:

 Traceback (most recent call last):
   File gluon/restricted.py, line 184, in restricted
   File C:/dev/web2py/applications/InfoCenter/models/db.py 
 http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py, line 372, 
 in module
   File gluon/dal.py, line 4213, in define_table
   File gluon/dal.py, line 641, in create_table
   File gluon/dal.py, line 696, in migrate_table
   File gluon/dal.py, line 4570, in __getitem__
 KeyError: 'itemtype'


 Thoughts?

 -Jim


 On 7/15/2011 1:05 PM, Jim Steil wrote: 

 Found this one myself.  Don't use 'list:string'.  This is just a regular 
 string field. 

 On 7/15/2011 12:55 PM, Jim Steil wrote: 

 Hi 

 Having another problem today with the following: 

 table defined as: 

 priceBackerItem = db.define_table('priceBackerItem', 
 Field('priceBackerItemId', 'id'), 
 Field('priceBackerId', db.priceBacker, required=True, 
 label='Price Backer'), 
 Field('itemType', 'list:string', required=True, label='Item 
 Type'), 
 Field('sequence', 'integer'), 
 Field('description', 'text'), 
 Field('price', 'decimal(9,2)', label='15-Day Price'), 
 Field('subscript', 'text')) 

 priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY() 
 priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation Price 
 Adjustment', 
 'Medication Price Adjustment'], 
 zero='choose one',multiple=False) 

 Using CRUD, when the update form displays, it never displays the current 
 value of item type.  The reason is (my best guess) that when I look in the 
 database (mysql), I see the values as: 

 |Medication Price Adjustment| or 
 |Special Formulation Price Adjustment| 

 ...including the vertical lines in the text. 

 Any advice? 

 -Jim 



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Jim Steil

Did that already and couldn't find anything.


On 7/15/2011 2:16 PM, Anthony wrote:
Not sure about that -- check out 
http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations.


On Friday, July 15, 2011 3:09:37 PM UTC-4, Jim S wrote:

Ok, I updated my table def here to be

Field('itemType', length=50, required=True, label='Item Type'),

, ran with migrate=False, fake_migrate=True and everything works. 
When I remove migrate=False, fake_migrate=True, then I get the

following traceback:

Traceback(most recent call last):
   Filegluon/restricted.py,line184,inrestricted
   FileC:/dev/web2py/applications/InfoCenter/models/db.py  
http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py,line372,inmodule
   Filegluon/dal.py,line4213,indefine_table
   Filegluon/dal.py,line641,increate_table
   Filegluon/dal.py,line696,inmigrate_table
   Filegluon/dal.py,line4570,in__getitem__
KeyError:'itemtype'


Thoughts?

-Jim


On 7/15/2011 1:05 PM, Jim Steil wrote:

Found this one myself.  Don't use 'list:string'.  This is just a
regular string field.

On 7/15/2011 12:55 PM, Jim Steil wrote:

Hi

Having another problem today with the following:

table defined as:

priceBackerItem = db.define_table('priceBackerItem',
Field('priceBackerItemId', 'id'),
Field('priceBackerId', db.priceBacker,
required=True, label='Price Backer'),
Field('itemType', 'list:string', required=True,
label='Item Type'),
Field('sequence', 'integer'),
Field('description', 'text'),
Field('price', 'decimal(9,2)', label='15-Day Price'),
Field('subscript', 'text'))

priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
priceBackerItem.itemType.requires = IS_IN_SET(['Special
Formulation Price Adjustment',
  'Medication Price Adjustment'],
  zero='choose one',multiple=False)

Using CRUD, when the update form displays, it never displays the
current value of item type.  The reason is (my best guess) that
when I look in the database (mysql), I see the values as:

|Medication Price Adjustment| or
|Special Formulation Price Adjustment|

...including the vertical lines in the text.

Any advice?

-Jim



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Jim Steil
I just went and recreated my db from scratch and then sync'd my old 
records over.  No big deal this time...



On 7/15/2011 2:15 PM, Jim Steil wrote:

Did that already and couldn't find anything.


On 7/15/2011 2:16 PM, Anthony wrote:
Not sure about that -- check out 
http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations.


On Friday, July 15, 2011 3:09:37 PM UTC-4, Jim S wrote:

Ok, I updated my table def here to be

Field('itemType', length=50, required=True, label='Item Type'),

, ran with migrate=False, fake_migrate=True and everything
works.  When I remove migrate=False, fake_migrate=True, then I
get the following traceback:

Traceback(most recent call last):
   Filegluon/restricted.py,line184,inrestricted
   FileC:/dev/web2py/applications/InfoCenter/models/db.py  
http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py,line372,inmodule
   Filegluon/dal.py,line4213,indefine_table
   Filegluon/dal.py,line641,increate_table
   Filegluon/dal.py,line696,inmigrate_table
   Filegluon/dal.py,line4570,in__getitem__
KeyError:'itemtype'


Thoughts?

-Jim


On 7/15/2011 1:05 PM, Jim Steil wrote:

Found this one myself.  Don't use 'list:string'.  This is just a
regular string field.

On 7/15/2011 12:55 PM, Jim Steil wrote:

Hi

Having another problem today with the following:

table defined as:

priceBackerItem = db.define_table('priceBackerItem',
Field('priceBackerItemId', 'id'),
Field('priceBackerId', db.priceBacker,
required=True, label='Price Backer'),
Field('itemType', 'list:string', required=True,
label='Item Type'),
Field('sequence', 'integer'),
Field('description', 'text'),
Field('price', 'decimal(9,2)', label='15-Day Price'),
Field('subscript', 'text'))

priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY()
priceBackerItem.itemType.requires = IS_IN_SET(['Special
Formulation Price Adjustment',
  'Medication Price Adjustment'],
  zero='choose one',multiple=False)

Using CRUD, when the update form displays, it never displays
the current value of item type.  The reason is (my best guess)
that when I look in the database (mysql), I see the values as:

|Medication Price Adjustment| or
|Special Formulation Price Adjustment|

...including the vertical lines in the text.

Any advice?

-Jim



Re: [web2py] SOLVED - list:string - IS_IN_SET

2011-07-15 Thread Anthony
Looks like it has something to do with the use of an uppercase letter in 
itemType (the keyerror indicates it is looking for 'itemtype' -- no 
uppercase). Maybe related to 
https://groups.google.com/d/topic/web2py/tziBAOJFzJE/discussion.
 
Anthony

On Friday, July 15, 2011 3:23:21 PM UTC-4, Jim S wrote:

 I just went and recreated my db from scratch and then sync'd my old records 
 over.  No big deal this time...


 On 7/15/2011 2:15 PM, Jim Steil wrote: 

 Did that already and couldn't find anything.


 On 7/15/2011 2:16 PM, Anthony wrote: 

 Not sure about that -- check out 
 http://web2py.com/book/default/chapter/06#Fixing-Broken-Migrations.

 On Friday, July 15, 2011 3:09:37 PM UTC-4, Jim S wrote:

 Ok, I updated my table def here to be

 Field('itemType', length=50, required=True, label='Item Type'), 

 , ran with migrate=False, fake_migrate=True and everything works.  When I 
 remove migrate=False, fake_migrate=True, then I get the following traceback:

 Traceback (most recent call last):
   File gluon/restricted.py, line 184, in restricted
   File C:/dev/web2py/applications/InfoCenter/models/db.py 
 http://127.0.0.1:8000/admin/default/edit/InfoCenter/models/db.py, line 
 372, in module
   File gluon/dal.py, line 4213, in define_table
   File gluon/dal.py, line 641, in create_table
   File gluon/dal.py, line 696, in migrate_table
   File gluon/dal.py, line 4570, in __getitem__
 KeyError: 'itemtype'


 Thoughts?

 -Jim


 On 7/15/2011 1:05 PM, Jim Steil wrote: 

 Found this one myself.  Don't use 'list:string'.  This is just a regular 
 string field. 

 On 7/15/2011 12:55 PM, Jim Steil wrote: 

 Hi 

 Having another problem today with the following: 

 table defined as: 

 priceBackerItem = db.define_table('priceBackerItem', 
 Field('priceBackerItemId', 'id'), 
 Field('priceBackerId', db.priceBacker, required=True, 
 label='Price Backer'), 
 Field('itemType', 'list:string', required=True, label='Item 
 Type'), 
 Field('sequence', 'integer'), 
 Field('description', 'text'), 
 Field('price', 'decimal(9,2)', label='15-Day Price'), 
 Field('subscript', 'text')) 

 priceBackerItem.priceBackerItemId.requires = IS_NOT_EMPTY() 
 priceBackerItem.itemType.requires = IS_IN_SET(['Special Formulation Price 
 Adjustment', 
 'Medication Price Adjustment'], 
 zero='choose one',multiple=False) 

 Using CRUD, when the update form displays, it never displays the current 
 value of item type.  The reason is (my best guess) that when I look in the 
 database (mysql), I see the values as: 

 |Medication Price Adjustment| or 
 |Special Formulation Price Adjustment| 

 ...including the vertical lines in the text. 

 Any advice? 

 -Jim 



[web2py] Re: Good jQuery UI Library

2011-07-15 Thread Ross Peoples
If you were to remove jQuery and replace with QooXDoo, you would have to 
rewrite the AJAX, LOAD, and JS validation code. Basically, everything in 
web2py_ajax.js

Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Jim Steil
Hey, I think i got it working.  Using fancybox I can specify to open in 
an iframe.  When I do so, things react as you'd expect.  I still have 
some work to do with formatting and flow, but I now have the updates 
working.


Thanks again for helping out, without the help I don't think I could 
have thought it through this far...


-Jim

On 7/15/2011 2:02 PM, Anthony wrote:

On Friday, July 15, 2011 1:15:55 PM UTC-4, Jim S wrote:

Watching firebug I don't see anything happen.  No validation runs
because even if I have an error on my form, it goes away.  When I
setup my form using CRUD, I set the 'next' parameter to the same
Edit Price Backer form that is displayed before the modal is
show.  However, I don't think it is even getting called.  It would
appear as though the Edit Price Backer page is redisplayed, but I
don't know what is triggering it.  You're probably right in
assuming that the form on the initial page is being submitted.  
But, if I put a value in the form (edit price backer) and click

submit on the modal (edit price backer item) form, neither of the
forms save their values.

Is there a way with CRUD to specify your form name?  I couldn't
find it.

After the form is created (e.g., form=crud() or 
form=crud.create(...)), the name should be stored in form.formname, 
and you can change that to something else if you'd like.

Anthony


Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Anthony
Glad you got it working. An iframe sounds like the simplest solution.

On Friday, July 15, 2011 3:37:25 PM UTC-4, Jim S wrote:

 Hey, I think i got it working.  Using fancybox I can specify to open in an 
 iframe.  When I do so, things react as you'd expect.  I still have some work 
 to do with formatting and flow, but I now have the updates working.

 Thanks again for helping out, without the help I don't think I could have 
 thought it through this far...

 -Jim

 On 7/15/2011 2:02 PM, Anthony wrote: 

 On Friday, July 15, 2011 1:15:55 PM UTC-4, Jim S wrote: 

 Watching firebug I don't see anything happen.  No validation runs because 
 even if I have an error on my form, it goes away.  When I setup my form 
 using CRUD, I set the 'next' parameter to the same Edit Price Backer form 
 that is displayed before the modal is show.  However, I don't think it is 
 even getting called.  It would appear as though the Edit Price Backer page 
 is redisplayed, but I don't know what is triggering it.  You're probably 
 right in assuming that the form on the initial page is being submitted.   
 But, if I put a value in the form (edit price backer) and click submit on 
 the modal (edit price backer item) form, neither of the forms save their 
 values.

 Is there a way with CRUD to specify your form name?  I couldn't find it.

  
 After the form is created (e.g., form=crud() or form=crud.create(...)), the 
 name should be stored in form.formname, and you can change that to something 
 else if you'd like.
  
 Anthony
  



Re: [web2py] Problem using load with powertables

2011-07-15 Thread Bruno Rocha
The problem is that the JavaScript necessary to load data to table is not
being loaded in the component, I will try to reproduce it here to test.

I never tested PowerTable plugin within a component or ajax modals, I need
to test to see what to do with Java Script needed to load.

Can you open an issue on bitbucket?

https://bitbucket.org/rochacbruno/powertable/issues?status=newstatus=open

On Fri, Jul 15, 2011 at 2:30 PM, Roberto Perdomo roberto...@gmail.comwrote:

 Hi, i am using powertables an i like load a table using
 {{=LOAD(c='default',f='finction',args='',extension='html',ajax=False,ajax_trap=False)}},
 but the table not show details when click the green plus button.

 The error is: Cannot read property '_aData' of undefined.

 I load the table inside a tab, inside other page, but the error persist.

 I dont know what happen, I appreciate your suggestions.





-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] Pagination

2011-07-15 Thread Bruno Rocha
PowerGrid does that http://labs.blouweb.com/PowerGrid

I hope to release for download within a week or two... sorry, I have too
much JavaScript to clear before make the plugin public.

or, if you want to test it at your own risk.. I can send to you by email.

On Fri, Jul 15, 2011 at 3:17 PM, contatogilson...@gmail.com 
contatogilson...@gmail.com wrote:

 They are not good when you have thousands of records to be consulted. Do I
 need anyplugin that calls the paging of data via the database.

 _
 *Gilson Filho*
 *Web Developer
 http://gilsondev.com*






-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] Problem using load with powertables

2011-07-15 Thread Roberto Perdomo
OK, thanks.

I need to place many tables inside different tabs of jquery ui, exist other
way to do that without load?

2011/7/15 Bruno Rocha rochacbr...@gmail.com

 The problem is that the JavaScript necessary to load data to table is not
 being loaded in the component, I will try to reproduce it here to test.

 I never tested PowerTable plugin within a component or ajax modals, I need
 to test to see what to do with Java Script needed to load.

 Can you open an issue on bitbucket?

 https://bitbucket.org/rochacbruno/powertable/issues?status=newstatus=open

 On Fri, Jul 15, 2011 at 2:30 PM, Roberto Perdomo roberto...@gmail.comwrote:

 Hi, i am using powertables an i like load a table using
 {{=LOAD(c='default',f='finction',args='',extension='html',ajax=False,ajax_trap=False)}},
 but the table not show details when click the green plus button.

 The error is: Cannot read property '_aData' of undefined.

 I load the table inside a tab, inside other page, but the error persist.

 I dont know what happen, I appreciate your suggestions.





 --



 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]
 [ Aprenda a programar: http://CursoDePython.com.br ]
 [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
 [ Consultoria em desenvolvimento web: http://www.blouweb.com ]




Re: [web2py] Pagination

2011-07-15 Thread Anthony
Is PowerGrid intended to have a different purpose from PowerTable, or is it 
just an alternative grid plugin? What are the differences?
 
Anthony

On Friday, July 15, 2011 3:52:39 PM UTC-4, rochacbruno wrote:

 PowerGrid does that http://labs.blouweb.com/PowerGrid 

 I hope to release for download within a week or two... sorry, I have too 
 much JavaScript to clear before make the plugin public.

 or, if you want to test it at your own risk.. I can send to you by email.

 On Fri, Jul 15, 2011 at 3:17 PM, contatog...@gmail.com 
 contatog...@gmail.com wrote:

 They are not good when you have thousands of records to be consulted. Do 
 I need anyplugin that calls the paging of data via the database. 
  
 _
 *Gilson Filho* 
 *Web Developer
 http://gilsondev.com*






 -- 
  


  --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]
 [ Aprenda a programar: http://CursoDePython.com.br ] 
 [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
 [ Consultoria em desenvolvimento web: http://www.blouweb.com ]



Re: [web2py] Pagination

2011-07-15 Thread Bruno Rocha
On Fri, Jul 15, 2011 at 5:16 PM, Anthony abasta...@gmail.com wrote:

 Is PowerGrid intended to have a different purpose from PowerTable, or is it
 just an alternative grid plugin? What are the differences?


PowerGrid is not only a grid plugin, besides the name it is a Paginator. One
can use it to paginate anything.

Main differences:

PowerGrid is tableless | PowerTable is based on SQLTABLE
PowerGrid is JSON based (server side data binding) | PowerTable does not
have server side data binding yet
PowerGrid is very lightweight

PowerGrid has a template system based in pure html, you can set the layout
for any element by writing a string and passinf it as template, with that
you can paginate blog posts, paginate pictures, texts, grid data, lists..
anything that you have in database.

I hope to release with a good documentation in one or two weeks.


Re: [web2py] Pagination

2011-07-15 Thread Anthony
Very cool. Thanks for the breakdown.
 
Anthony

On Friday, July 15, 2011 4:31:57 PM UTC-4, rochacbruno wrote:

 On Fri, Jul 15, 2011 at 5:16 PM, Anthony abas...@gmail.com wrote:
  
 Is PowerGrid intended to have a different purpose from PowerTable, or is 
 it just an alternative grid plugin? What are the differences?


 PowerGrid is not only a grid plugin, besides the name it is a Paginator. 
 One can use it to paginate anything.

 Main differences:

 PowerGrid is tableless | PowerTable is based on SQLTABLE
 PowerGrid is JSON based (server side data binding) | PowerTable does not 
 have server side data binding yet
 PowerGrid is very lightweight

 PowerGrid has a template system based in pure html, you can set the layout 
 for any element by writing a string and passinf it as template, with that 
 you can paginate blog posts, paginate pictures, texts, grid data, lists.. 
 anything that you have in database.

 I hope to release with a good documentation in one or two weeks.
  



[web2py] missing STYLE in sqlhtml.py

2011-07-15 Thread Carlos
Hi,

Just to let you know that STYLE is missing in sqlhtml.py, which is required 
when using renderstyle for SQLTABLE.

   from html import STYLE

Thanks,

   Carlos



Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Jim Steil

Ok, two last things stumping me now.

1.  How do I reload my component using javascript
2.  I have a CRUD form open in my iframe.  When I click submit it want 
it to submit and if it updates, close the iframe. If not, redisplay with 
errors showing (it does this part already, just don't want to lose it 
when I recode to close on update)


-Jim

On 7/15/2011 2:46 PM, Anthony wrote:

Glad you got it working. An iframe sounds like the simplest solution.

On Friday, July 15, 2011 3:37:25 PM UTC-4, Jim S wrote:

Hey, I think i got it working.  Using fancybox I can specify to
open in an iframe.  When I do so, things react as you'd expect.  I
still have some work to do with formatting and flow, but I now
have the updates working.

Thanks again for helping out, without the help I don't think I
could have thought it through this far...

-Jim

On 7/15/2011 2:02 PM, Anthony wrote:

On Friday, July 15, 2011 1:15:55 PM UTC-4, Jim S wrote:

Watching firebug I don't see anything happen.  No validation
runs because even if I have an error on my form, it goes
away.  When I setup my form using CRUD, I set the 'next'
parameter to the same Edit Price Backer form that is
displayed before the modal is show.  However, I don't think
it is even getting called.  It would appear as though the
Edit Price Backer page is redisplayed, but I don't know what
is triggering it.  You're probably right in assuming that the
form on the initial page is being submitted.   But, if I put
a value in the form (edit price backer) and click submit on
the modal (edit price backer item) form, neither of the forms
save their values.

Is there a way with CRUD to specify your form name?  I
couldn't find it.

After the form is created (e.g., form=crud() or
form=crud.create(...)), the name should be stored in
form.formname, and you can change that to something else if you'd
like.
Anthony




[web2py] Re: Getting a reproducible web2py internal error

2011-07-15 Thread Massimo Di Pierro
OperationalErrors originate from database, not web2py. Are you using
sqlite? It could be a file permission issue.

On Jul 15, 12:23 pm, Gary Herron gher...@digipen.edu wrote:
 Has anyone seen this error, or know what it means?  Any advice,
 workaround or solution would be greatly appreciated.

 On a machine (somewhere in the cloud), I'm trying to get a small web2py
 site working and I'm running into a persistent reproducible bug that's
 killing me.

 The error I get is:
    OperationalError:  unable to open database file

 This eventually occurs on any application I try to create, but I've been
 able to reproduce it several times with the following set of actions:

     Download a fresh copy of web2py for windows, extract, and run
     Create a new application named test
     In test's admin interface create two auth_user's and one auth_group
     Attempt to create a auth_membership -- instead of the form I get the
     above error.

 The system I'm running on is a Microsoft Windows Server 2003 R2
 On both a Linux/Ubuntu and a Windows XP machine everything works well.

 Thanks for any help

 --
 Gary Herron, PhD.
 Department of Computer Science
 DigiPen Institute of Technology
 (425) 895-4418


Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Anthony
On Friday, July 15, 2011 5:42:43 PM UTC-4, Jim S wrote: 

 Ok, two last things stumping me now.

 1.  How do I reload my component using javascript

 
First, when you initially call LOAD() to create the component, explicitly 
specify the 'target' argument, which will become the id of the div that will 
contain the component content (otherwise, web2py will create a random id). 
Then, at any time, on the client side you can update the content of the 
component by calling web2py_component(url, target), which is a Javascript 
function in /static/js/web2py_ajax.js. The 'url' should be the URL of the 
component action (it can even be a different component from the one 
originally loaded into the div), and the 'target' should be the target your 
originally specified when creating the component.
 

 2.  I have a CRUD form open in my iframe.  When I click submit it want it 
 to submit and if it updates, close the iframe. If not, redisplay with errors 
 showing (it does this part already, just don't want to lose it when I recode 
 to close on update)

 
Does fancybox offer a way to close the iframe modal via Javascript? If your 
iframe includes a component, you can have the component return some 
Javascript via response.js. If it's just loading a regular page, then I 
suppose the page could include some JS to be executed when it loads.
 
Anthony
 


[web2py] pythoncom isn't in frozen sys.path.

2011-07-15 Thread António Ramos
Can someone explain why i have this error a lot?

I google it and seems that
del sys.frozen resolves the problem but the next time i run web2py i have
the same error

thank you

António


Re: [web2py] Re: Getting a reproducible web2py internal error

2011-07-15 Thread Gary Herron
Yes, I am using sqlite.   And I'm using web2py straight out of the box 
(so to speak) -- just a straight download and unzip.  And the problem is 
more pervasive then originally mentioned:Any attempt to insert a 
record into any table that has a reference Field results in the 
error.I've checked all the file permissions as created by the unzip 
and I've also explicitly set all the file permissions, but either way, I 
get the same behavior.


I'm beginning to suspect that it's the machine's problem (virtual 
machine, since it's in the cloud) and not web2py or even the database.  
Is there an easy way, outside of web2py to test the database for correct 
functioning?



On 07/15/2011 03:00 PM, Massimo Di Pierro wrote:

OperationalErrors originate from database, not web2py. Are you using
sqlite? It could be a file permission issue.

On Jul 15, 12:23 pm, Gary Herrongher...@digipen.edu  wrote:

Has anyone seen this error, or know what it means?  Any advice,
workaround or solution would be greatly appreciated.

On a machine (somewhere in the cloud), I'm trying to get a small web2py
site working and I'm running into a persistent reproducible bug that's
killing me.

The error I get is:
OperationalError:  unable to open database file

This eventually occurs on any application I try to create, but I've been
able to reproduce it several times with the following set of actions:

 Download a fresh copy of web2py for windows, extract, and run
 Create a new application named test
 In test's admin interface create two auth_user's and one auth_group
 Attempt to create a auth_membership -- instead of the form I get the
 above error.

The system I'm running on is a Microsoft Windows Server 2003 R2
On both a Linux/Ubuntu and a Windows XP machine everything works well.

Thanks for any help

--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



[web2py] Re: Message to the creator of Tenthrow regarding Paypal

2011-07-15 Thread howesc
Andrew,

what's the specific problem you are having (you can email just me if you 
prefer)

i guess i need to learn how to create web2py plugin files, haven't done that 
yet

realistically it will be aug before i get to trying to make a further 
generalization of the code posted on the slice due to other work 
commitments.  i can try and help debug in the meantime though

christian


[web2py] request - mmodal examples

2011-07-15 Thread niknok
I just discovered this modal plugin: web2py.com/plugins/default/
mmodal

Sorry for being a little slow, but would someone please post an
example of how I can use crud inside modals?


[web2py] Re: Python 3 and the future of web2py

2011-07-15 Thread FirefighterBlu3
for the record, i -only- use py3.  python 3.2 came out almost half a
year ago and i deployed it on my pack of servers a couple months ago.
everything i do is in 3.2 now.  previously i used 3.1.  i've ported a
few projects to py3 for my own uses - tried to provide patches but
many packages are dormant.  our data centers have quite a mix of
installations, even back to the ancient 2.4.  it really isn't -that-
hard to write code that runs on both 3.2 and 2.4.  performance?  i've
heard that mention of the py3 running slower than py2, but that water
went under the bridge a long time back and it seems to me more like a
religious misdirection than a legitimate argument.  it depends what
you're doing and how you're doing it.  i can make py2 code abysmally
slow and py3 code scream.  many of us py3 people have ported things
already but there's such a stalwart opposition to updating, that we
sound like a lonely broken record when we provide patches.

what's better in 3 than 2?  i don't know off the top of my head.  it's
been forever since i wrote in py2 and i played with the new and
improved in py3 so far back, that it's not new and improved any more,
and used so frequently, that i couldn't set it apart from anything
else.

my current project is wsgi focused.  py3 has a wsgi module built into
it.  it just works, beautifully.  i store millions of rows of data in
psql and generate a bunch of PDF and html reports based on thousands
of servers.  i've wanted to use web2py, but i don't have the free time
at present and i don't have any of my server farm that runs py2 to
bridge anything and i can't abscond with customer datacenter servers.

so please don't think that nobody uses py3.  you'll probably find very
few people -here- talk about py3, mostly because your project doesn't
support it and the general consensus seems to be that you'll get
around to it - some day, as another project.  if you spend all your
time in the orange grove, you probably won't find many cherry trees.
:-}

-david


[web2py] Re: Python 3 and the future of web2py

2011-07-15 Thread Massimo Di Pierro
+1

On Jul 13, 11:26 am, Bruno Rocha rochacbr...@gmail.com wrote:
 May be, the new project could be a kind of merge with Bottle 
 (http://bottlepy.org/docs/dev/, Web2py libs fits perfectly with Bottle, and
 bottle has a very nice base system. Maybe we cam have a bottle2py-project
 with Python3 as goal.


Re: [web2py] Re: Problem with CRUD using fancybox dialog

2011-07-15 Thread Jim Steil

Thanks Anthony

I'm out for the next 10 days but will get on this straight away when I 
get back.  Thanks again for all the help.


-Jim


On 7/15/2011 5:09 PM, Anthony wrote:

On Friday, July 15, 2011 5:42:43 PM UTC-4, Jim S wrote:

Ok, two last things stumping me now.

1.  How do I reload my component using javascript

First, when you initially call LOAD() to create the component, 
explicitly specify the 'target' argument, which will become the id of 
the div that will contain the component content (otherwise, web2py 
will create a random id). Then, at any time, on the client side you 
can update the content of the component by calling 
web2py_component(url, target), which is a Javascript function in 
/static/js/web2py_ajax.js. The 'url' should be the URL of the 
component action (it can even be a different component from the one 
originally loaded into the div), and the 'target' should be the target 
your originally specified when creating the component.


2.  I have a CRUD form open in my iframe.  When I click submit it
want it to submit and if it updates, close the iframe. If not,
redisplay with errors showing (it does this part already, just
don't want to lose it when I recode to close on update)

Does fancybox offer a way to close the iframe modal via Javascript? If 
your iframe includes a component, you can have the component return 
some Javascript via response.js. If it's just loading a regular page, 
then I suppose the page could include some JS to be executed when it 
loads.

Anthony


[web2py] Re: Python 3 and the future of web2py

2011-07-15 Thread Luther Goh Lu Feng
I'm all for having not spending effort to move to Python 3 due to
resource constraints etc.

However, I am curious as to whether having a minimum viable python 3
port will help bring more eyeballs/users to web2py, since hardly any
python web frameworks have moved to Python 3.

The main development effort will still be on web2py. But I am hoping
that any marketing effect of the python 3 port will spill over to
web2py.

On Jul 16, 9:16 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 +1

 On Jul 13, 11:26 am, Bruno Rocha rochacbr...@gmail.com wrote:







  May be, the new project could be a kind of merge with Bottle 
  (http://bottlepy.org/docs/dev/, Web2py libs fits perfectly with Bottle, and
  bottle has a very nice base system. Maybe we cam have a bottle2py-project
  with Python3 as goal.