[web2py] Re: SQLFORM.grid and export; some proposals

2013-05-23 Thread Nguyen Minh Tuan

>
> Hi,

 
I want to use export feature in SQLFORM.grid, but it doesn't work when 
query in self reference table.
 
db.py :
 
auth.settings.extra_fields['auth_user'] = [ 

   Field('LineManager', 'reference auth_user'),
.
 
 
controller.py :
 
lineMng = db.auth_user.with_alias('lineMng')
query = ((db.auth_user.id >= 1) & (db.auth_user.LineManager == 
lineMng.id))
 
fields = [db.auth_user.id,
  db.auth_user.FullName,
 ..
  lineMng.FullName ]
grid = SQLFORM.grid( query = query,
field_id = db.auth_user.id,
fields=fields,
 
csv=True)
 
In view, export part is not displayed.
How can I solve this?
 
Thanks in advance,
Regards,
 

-- 

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




[web2py] Problems with parameter-based routing

2013-05-23 Thread Marian
I wanted to switch from pattern-based routing on a Windows IIS7 Server with 
isapi_wsgi to a parameter-based routing to benefit from nicer urls but it 
is not working.
It either says invalid request or the server stucks in an endless loop.

My functioning pattern based routing. As you can see I need to remove the 
prefix 'applications'.
default_application = 'imagecontest'
default_controller = 'default'
default_function = 'index'
 
routes_in=(('/applications/(?P.*)','/\g'),)
routes_out=(('/(?P.*)','/applications/\g'),)


What I tried...
Invalid request (even without the path_prefix):
routers = dict(
BASE=dict(
default_application = 'imagecontest',
path_prefix = 'applications',
)
)



Endless loop:
routers = dict(
BASE=dict(
path_prefix = 'applications',
)
)

Am I doing something wrong?

-- 

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




[web2py] Re: Memory leak, SQLite, Windows (7, 2008)

2013-05-23 Thread Niphlod


Il giorno giovedì 23 maggio 2013 02:46:21 UTC+2, Simon Ashley ha scritto:
>
> Thanks Simone,
>
> A little more on this. 
> Seems to to be an issue with windows consuming memory and grinding the 
> system to semi halt. 
> The characteristic isn't there in Linux. (ubuntu under vmware hosted by 
> win7) 
>
> Are you sure on 
> db(query).update(**arguments)
>
> ? (seems to fall over with too many tables selected. Was my original 
> hesitation in doing an update on the results of a join)
>



hum ? i was referring to changing your code from 
row = db(query)
row.update_record(**arguments)


to
db(query).update(**arguments) 

what works in the first works in the latter.

As for updates involving multiple tables (i.e. updating a table with values 
from another one) as ex'plained earlier is a viable solution (albeit non 
present in DAL's code, but achievable with executesql) only on database 
supporting it. SQLite doesn't.

-- 

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




[web2py] request.get_vars

2013-05-23 Thread Domagoj Kovač
{{export_get_vars = request.get_vars}}
{{export_get_vars.export_format = "csv"}}
{{export_get_vars.export_format = "xls"}}
{{=request.get_vars}}
I have a code like this, i dont understand what is going on. I assign 
request.get_vars to export_get_vars, when i add seomething to 
export_get_vars request.get_vars is also changed, How is this possible?

Example above outputs: 


Althought my url is:
http://127.0.0.1:8000/init/entry_value/grid/13

-- 

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




[web2py] Re: request.get_vars

2013-05-23 Thread David Marko
I think that request.get_vars return the reference to Storage object not 
its copy. So adding something to your variable de-facto adds items to 
former Storage.

Dne čtvrtek, 23. května 2013 11:00:40 UTC+2 Domagoj Kovač napsal(a):
>
> {{export_get_vars = request.get_vars}}
> {{export_get_vars.export_format = "csv"}}
> {{export_get_vars.export_format = "xls"}}
> {{=request.get_vars}}
> I have a code like this, i dont understand what is going on. I assign 
> request.get_vars to export_get_vars, when i add seomething to 
> export_get_vars request.get_vars is also changed, How is this possible?
>
> Example above outputs: 
> 
>
> Althought my url is:
> http://127.0.0.1:8000/init/entry_value/grid/13
>

-- 

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




[web2py] Making RSS feed auto-detectable?

2013-05-23 Thread Lamps902
I've added the following RSS feed function to my default controller:

def updatefeed():
list_of_rss_entry_dicts = [ dict(title = data_set.f_headline, 
   link = 'http://' + settings.domain_name, 
   description = data_set.f_content)
for data_set in db(db.t_news).select(orderby
=db.t_news.created_on)[-3:]]

return dict(title=settings.title + ' RSS feed',
link=settings.domain_name,
description=settings.title + ' RSS feed',
entries=list_of_rss_entry_dicts) 

I put this line into the header of my layout.html file:



The feed seems to be working fine when accessed from 
default/updatefeed.rss, but it cannot be detected from the site's home page 
(for example, by Firefox's Sage plugin). Any ideas on how to fix this? 
Thanks.

-- 

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




[web2py] Re: request.get_vars

2013-05-23 Thread Anthony
This is how Python works. In Python, variable names act like labels that 
are attached to objects in memory.

>>> export_get_vars = request.get_vars
>>> export_get_vars is request.get_vars
True
>>> id(request.get_vars)
54474840L
>>> id(export_get_vars)
54474840L

As you can see above, export_get_vars and request.get_vars are just two 
different labels that point to the same object in memory (a 
gluon.storage.Storage object in this case). If you mutate the object (in 
your case by adding elements to it), both variables will still refer to 
that same mutated object.

If you want to create a separate copy of request.get_vars that is an 
entirely new object, you have to do so explicitly:

import copy
export_get_vars = copy.copy(request.get_vars)

or

from gluon.storage import Storage
export_get_vars = Storage(request.get_vars)

or

export_get_vars = request.get_vars.copy()  # this returns a dictionary 
rather than a new Storage object

Note, the above options will only create a shallow copy -- if 
request.get_vars happens to contain an item that is a list, the copy will 
still point to the original list (i.e., the list itself will not be 
copied). There is a copy.deepcopy() function, but it doesn't work with 
Storage objects, so if you need a deep copy, you'll have to implement that 
manually.

Anthony

>

-- 

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




[web2py] Re: Issues with rendering wiki in html.

2013-05-23 Thread villas
Hi Alan,

On a general note (for future consideration),   it is useful to have some 
records in markmin and others in html.  To achieve this I think we really 
need to add a 'render_type' field to accompany the raw data.  Then we can 
really mix it up.

In one implementation,  I also added an option for mixed Html and Markmin.  
Admittedly this is 'Frankenstein' data,  but it still renders well.  With 
an extra bit of work from say Beautifulsoup,  you would never know!

I know many will think this is too ugly,  but in some cases we do have some 
very ugly content originating from various places but still wish to view it 
as best we can with a minimum of remedial work.

IMO  the "on/off switch" for Html does not provide enough flexibility for 
this,  but a few alterations could make it so. 

Best wishes,  D


On Wednesday, May 22, 2013 6:58:00 PM UTC+1, Alan Etkin wrote:
>
> Also as this maybe important.  In my init/model/db.py  I have the 
>> following after auth tables are defined:
>>
> auth.wiki(resolve=False)
>>
>
> The auth.wiki method arguments set the Wiki object options the first time, 
> and further configs must be changed with the auth.settings.wiki.option 
> syntax. render="markmin" is the default option and AFAIK is not updated 
> once it was created in the model. Try auth.wiki(resolve=False, 
> render="html"). That should solve the problem.
>
>

-- 

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




[web2py] Twitter post function producing HTTP 401 error

2013-05-23 Thread Lamps902
I've added the Twitter posting function to my app, in the form in which 
it's presented in the book - 
http://www.web2py.com/books/default/chapter/29/14?search=twitter#Twitter-API. 
When calling this function with the username supplied in the Twitter 
Account menu's username field, my twitter password, and a generic message 
(i.e. "message"), I get an "HTTP Error 401: Unauthorized" message. Any 
suggestions as to how to fix this? Thanks.

-- 

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




[web2py] Re: Twitter post function producing HTTP 401 error

2013-05-23 Thread Anthony
I think Twitter no longer supports basic authentication (we should probably 
update the book).

Anthony

On Thursday, May 23, 2013 9:03:54 AM UTC-4, Lamps902 wrote:
>
> I've added the Twitter posting function to my app, in the form in which 
> it's presented in the book - 
> http://www.web2py.com/books/default/chapter/29/14?search=twitter#Twitter-API. 
> When calling this function with the username supplied in the Twitter 
> Account menu's username field, my twitter password, and a generic message 
> (i.e. "message"), I get an "HTTP Error 401: Unauthorized" message. Any 
> suggestions as to how to fix this? Thanks.

-- 

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




[web2py] show mandatory fields

2013-05-23 Thread Manuele Pesenti
Hello!
I found this tricky way to have in evidence required fields in a grid
defined like the following:


def dressMandatory(grid, table):
""" Special representation for mandatory fields in grid """

for fieldname in table.fields:
myid = '_'.join((table._tablename, fieldname, ))
# icon = I(_class="icon-warning-sign")
app = '' # SPAN(icon, _class="add-on") if
table[fieldname].required else ''
class_value = "control-group warning" if
table[fieldname].required else ''
grid.elements('#%s' % myid, replace=lambda el:
DIV(DIV(TAG.nobr(el, app), _class="input-append"),
_class=class_value))grid =

mygrid = SQLFORM.smartgrid(db.mytable)

dressMandatory(mygrid, db.mytable)



Can you help to do the same with a form like that:

form = SQLFORM.factory(db.mytable)

Thank you in advance

Cheers

Manuele

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Massimo Di Pierro
No, but why?

On Wednesday, 22 May 2013 23:16:20 UTC-5, Abhishek Gupta wrote:
>
> Hi,
>
> Is there an easy way to disable the logs generated in databases/sql.log 
> other than editing gluon/dal.py?
>
> Regards
> Abhishek Gupta
> Co-founder, Zumbl
>  

-- 

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




Re: [web2py] Re: How to store data records for recurrent jQuery call

2013-05-23 Thread 冷春辉
Thank you Calvin and Alan. I'm not familiar with JSON and not much content
in the book at the moment. I will do my research based on your suggestions.

Regards,
Lio


On Wed, May 22, 2013 at 1:09 AM, Alan Etkin  wrote:

> You could then write some javascript to populate block 2 using the rec
>> object created...
>>
>
> I think this alternative should do what you want too:
>
> (in a view)
>
> {{=SCRIPT("""
> var myRows = %(rows)s;
> """ % dict(rows=.select().as_json()))}}
>
>
> Then you can access the record values in myRows[n].fieldname from the
> jQuery event handlers.
>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/9qu4EI8iOWY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




[web2py] Re: show mandatory fields

2013-05-23 Thread Manuele Pesenti
I beg your pardon... here it is the corrispondent solution for the
form... but maybe you have better ideas

def dressMandatoryInForm(form, *tabs):
""" Special representation for mandatory fields in form """

tabs_fields = [[t[f] for f in t.fields if f != t._id.name] for t in
tabs]
fields_list = sum(tabs_fields[1:], tabs_fields[0])
#count = 0
m = form.elements()[0].elements
for field in fields_list:
if field.writable and field.readable and not field.compute:
if field.required:
m('#no_table_%s' % field.name, replace=lambda el:
DIV(DIV(el, _class="input-append"), _class="control-group warning"))

Il 23/05/13 15:18, Manuele Pesenti ha scritto:
> Hello!
> I found this tricky way to have in evidence required fields in a grid
> defined like the following:
>
> 
> def dressMandatory(grid, table):
> """ Special representation for mandatory fields in grid """
>
> for fieldname in table.fields:
> myid = '_'.join((table._tablename, fieldname, ))
> # icon = I(_class="icon-warning-sign")
> app = '' # SPAN(icon, _class="add-on") if
> table[fieldname].required else ''
> class_value = "control-group warning" if
> table[fieldname].required else ''
> grid.elements('#%s' % myid, replace=lambda el:
> DIV(DIV(TAG.nobr(el, app), _class="input-append"),
> _class=class_value))grid =
>
> mygrid = SQLFORM.smartgrid(db.mytable)
>
> dressMandatory(mygrid, db.mytable)
> 
>
>
> Can you help to do the same with a form like that:
>
> form = SQLFORM.factory(db.mytable)
>
> Thank you in advance
>
> Cheers
>
> Manuele

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Anthony
I believe sql.log only records the SQL for migrations (i.e., table 
creation, altering tables, and truncating tables), so logging will be 
disabled if you disable migrations.

Anthony

On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:
>
> Hi,
>
> Is there an easy way to disable the logs generated in databases/sql.log 
> other than editing gluon/dal.py?
>
> Regards
> Abhishek Gupta
> Co-founder, Zumbl
>  

-- 

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




[web2py] Re: Simple Postgres Exercise and ValueError: invalid literal for int() with base 10: 'SELECT'

2013-05-23 Thread ewong1111
The sql.log only said that the table was effectively created (it was), just 
couldn't read or write to it after.  
 
Are you using psycopg2?  I was just using the pg8000 that comes with 
web2py, however someone informed me that web2py is broken as shipped (!) 
and sure enough, after installing psycopg2 my code worked.  I can't believe 
they would ship a product that does not work...and this is such basic 
functionality!  If this is true, they really need to a) Not include pg8000 
with their next release and b) Put some kind of blaring warning message 
with the current release that you NEED psycopg2 to be able to work with 
postgres.  Sure wasted my time!

On Wednesday, May 22, 2013 12:39:50 PM UTC-7, Niphlod wrote:

> the code you posted (of course, correctly spaced in the controller 
> function) works without problems.
> Check your database/sql.log for details about the table being effectively 
> created
>
> On Wednesday, May 22, 2013 8:14:41 PM UTC+2, ewon...@gmail.com wrote: 
>>
>> What I really wanted to do was connect to an existing postgres database 
>> and read/display the data, but I kept getting this error: ValueError: 
>> invalid 
>> literal for int() with base 10: 'SELECT' 
>>  
>> I've pared down to some stupidly simple code that works with sqlite, but 
>> when I change to use my postgres database, I still get that error!  
>> This is what I have:
>> *db.py*: Just create a table called mydata with one field of type 
>> string.  For this example I'm trying, table mydata does not yet exist in my 
>> postgres db.
>>  
>>  db = DAL('postgres://dbuser:dbu...@xxx.xx.xxx.xx/erinstest',pool_size=1,
>> check_reserved=['all']) 
>>  
>> #db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])   
>>
>> db.define_table('mydata',   
>>
>> Field('det_data_type', 'string', length=32))
>>
>>   
>> *default.py*: Insert something into the mydata table and query/return 
>> everything from the table.
>>  
>>  def index():  
>> response.flash = T("Welcome to web2py!") 
>> db.mydata.insert(det_data_type="type1") 
>> pkts = db().select(db.mydata.ALL)  
>> return dict(pkts=pkts)
>>  
>>  
>>  
>> *default/index.html*: Display each of the results from the query of the 
>> mydata table.
>>  {{ for pkt in pkts: }} 
>> {{=pkt.id}} 
>> {{=pkt.det_data_type}} 
>> {{pass}}  
>>  
>> When I run this, the mydata table is created in my postgres database (so 
>> I assume my connection is working at least somewhat correctly), but nothing 
>> is inserted into it and the ValueError comes up.  After doing this, I also 
>> tried inserting something into the table (outside of web2py) and then 
>> commented out the line in default.py that inserts into the table to see if 
>> I could just display what was in mydata table.  Same error.  What am I 
>> doing wrong?
>>  
>> I am using web2py v2.4.6 and postgres 8.4.13.
>>  
>>  
>>
>>

-- 

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




[web2py] Re: Twitter post function producing HTTP 401 error

2013-05-23 Thread Lamps902
Thanks, Anthony. Are you aware of any viable web2py solutions to making 
Twitter posts? Would it be a good idea just to use some python Twitter 
module?

>

-- 

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




[web2py] Re: rss feed

2013-05-23 Thread greaneym
Thank you, Massimo,

After reading a lot more about feedparser and xlml,
I began going through xlml examples but figured that feedparser was already
doing most of what I needed, so I found this on stackoverflow,
http://stackoverflow.com/questions/11157894/less-painful-way-to-parse-a-rss-feed-with-lxml

and read more docs on feedparser entries.

and reading the html "view source" of the rss feed from rss_aggregator, I 
found that 'title' and 'summary' contained what I needed.

With feedparser selections, I can display the current weather from NOAA 
page. 

The only problem is that I don't understand how to reformat so uuencoded? 
details don't get left in the view. I've made attempts to translate or 
reformat or use helpers but so not getting the plain string that I want to 
view.

To get a current weather report from NOAA and display it, here is my 
solution.

1. http://w1.weather.gov/xml/current_obs/ Go here and select airport 
location closest
 to desired destination
2. select state Illinois, Find, Select Chicago Midway Airport, select RSS 
3. copy the feed uri path from the uri window,
 feed://w1.weather.gov/xml/current_obs/KMDW.rss
This will go into the feedparser.py function.

rename rss_aggregator() in feedparser.py to weatherfeed()

def weatherfeed():
import datetime
import gluon.contrib.rss2 as rss2
import gluon.contrib.feedparser as feedparser
# get the location closest to desired location first
# and enter rss path below
d = feedparser.parse('feed://w1.weather.gov/xml/current_obs/KMDW.rss')
#this returns items but they are unicode values
#wdict = d
#print "wdict contains",wdict
#print "wdict is type",type(wdict)
#print "title",wdict['feed']['title']
for entry in d['entries']:
  #print "feed title", d['feed']['title']
  #print "title type", type(d['feed']['title'])
  #print "bozo", d.bozo
  #print "headers" , d.headers.get('Content-type')
  strt_summary =  entry.get('summary', '')
  t_summary = str(strt_summary)
  strt_conditions = entry.get('title', '')
  t_conditions = str(strt_conditions)
  print "t_conditions", t_conditions
  #typesummary = type(t_summary)
  print "t_conditions", t_conditions
  #typesummary = type(t_summary)
#return dict(t_conditions=t_conditions,t_summary=t_summary)
return (t_conditions,t_summary)

I left in my commented print statements so other people trying it out can 
see contents of the lists and dictionaries.


For the default/index.html view

 NOAA Weather Service
{{=LOAD('default','weatherfeed')}}


{{pass}}


This contains almost what I need but I can't figure out how to get the 
unicode or extra chars out. I could use "tr" or some regexp but is there a 
simpler way to do it with a helper?


thanks,
Margaret

-- 

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




[web2py] Re: Twitter post function producing HTTP 401 error

2013-05-23 Thread Anthony
I don't think web2py has anything built in, so just check the Twitter API 
docs and/or find an existing Python module to help.

Anthony

On Thursday, May 23, 2013 10:24:04 AM UTC-4, Lamps902 wrote:
>
> Thanks, Anthony. Are you aware of any viable web2py solutions to making 
> Twitter posts? Would it be a good idea just to use some python Twitter 
> module?
>
>>

-- 

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




[web2py] Re: Twitter post function producing HTTP 401 error

2013-05-23 Thread Lamps902
Trying to get it running with this one: 
https://pypi.python.org/pypi/twitter. Thanks!

On Thursday, May 23, 2013 9:58:34 AM UTC-5, Anthony wrote:
>
> I don't think web2py has anything built in, so just check the Twitter API 
> docs and/or find an existing Python module to help.
>
> Anthony
>
> On Thursday, May 23, 2013 10:24:04 AM UTC-4, Lamps902 wrote:
>>
>> Thanks, Anthony. Are you aware of any viable web2py solutions to making 
>> Twitter posts? Would it be a good idea just to use some python Twitter 
>> module?
>>
>>>

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Abhishek Gupta
Anthony, that souns good, thanks.
Massimo, our sql.log grows to almost 1GB each day. I used fake_migrate=True
for all the tables.

Regards
Abhishek Gupta
Co-founder, Zumbl

Zumbl   |
Facebook  |
 Twitter   |
LinkedIn


On 23 May 2013 19:25, Anthony  wrote:

> I believe sql.log only records the SQL for migrations (i.e., table
> creation, altering tables, and truncating tables), so logging will be
> disabled if you disable migrations.
>
> Anthony
>
>
> On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:
>>
>> Hi,
>>
>> Is there an easy way to disable the logs generated in databases/sql.log
>> other than editing gluon/dal.py?
>>
>> Regards
>> Abhishek Gupta
>> Co-founder, Zumbl
>>
>

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




[web2py] REF: Bare Ajax Login

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

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

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

~/
Human Knowledge belongs to the world! - AntiTrust

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

/~

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Arnon Marcus
On the contrary. I think information about testing using web2py, in conjuction 
with various testing-frameworks/tools, is highly relevant in the book, along 
with common testing-practices, and the way they apply when testing with web2py.

The book, in that case, would act as an information-centralization tool. So 
it's not about the book. Its about information-centralization/consolidation, 
for the sake of research-efficiency, and prevention of duplication-of-efforts. 
There may be other tools/platforms that can searve this role.

The book might be a less-efficient way than others, in terms of how frequent it 
is updated.

I am deliberatelty refraining from specific suggestions, because the actual 
solution-implementation is less important than understanding the problem. The 
need is more important than the strategy for meeting it.

Where I think a book is a terrible option, is when concearning exposure of 
frequently-updating information. Say, announcement of a feature-project that is 
underway, This should belong to a "news-feed", a newsletter, or both.

The 2 worlds might meet, say, as an announcement for additions to the book, 
with links to the chapters.

The FAQ is really old and dated, so I think it should be updated as well. And 
it uses some usefull categories, that should be retargeted to a newsfeed.

-- 

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




[web2py] installing Pandas in site-packages

2013-05-23 Thread gthwang5

I am running into issues installing pandas (or any third-party module). 

Basically, my python on my windows machine sits on c:\python27\, and pandas 
is installed in c:\python27\Lib\Site-Packages\pandas

Now, when I try to include pandas in my web2py app, however, I am getting 
an error saying it can't import it. 

I am assuming that web2py does not use my local python but its own. 

How do I get around this issue and either a) have web2py use my local 
python interpreter and its modules  or b) install python directly
to my web2py app's module's folder?   This is a noob question, sorry, but 
on windows or any environment I am not sure how to 
do a installation that's not to the python PATH and in some custom location.

Thanks,

-- 

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




[web2py] How to force Auth module to disable Password encryption!

2013-05-23 Thread Ahmad Faiyaz
Hello,
I am new on web2py. I am using it to develop a Programming Contest 
Management system. Now on a ONSITE Programming Contest , we have to 
distribute username and password printed on paper. So i have implemented a 
function which will generate user accounts automatically then print the 
passwords on a PDF. Web2py uses encrpytion to store the password, which is 
not retrievable. Now i can have a different table to store the passwords, 
but when i use use Auth to modify the password, i will be unable to update 
my own table. What to do now ? How i can disable encryption on auth_user 
table ? Can anyone help !!

-- 

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




[web2py] Pandas installation

2013-05-23 Thread gthwang5
How do install Pandas on web2py?

-- 

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




[web2py] third party modules installation

2013-05-23 Thread gthwang5
Hi, 

I am currently hosting my site that I'm developing from my Windows 8 
machine. 

I have my python installed in my computer at c:\python27\ and all the 
libraries get installed to c:\python27\site-packages I believe.

According to the web2py doc, it says in order to use third party modules, I 
need to install the module again straight into my web2py/site-packages 
folder.

However, this seems impossible because easy-install just keeps installing 
to c:\python27\site-packages.

Is there a solution? Thanks

-- 

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




[web2py] Re: Issues with rendering wiki in html.

2013-05-23 Thread Alan Etkin

>
> On a general note (for future consideration),   it is useful to have some 
> records in markmin and others in html.  To achieve this I think we really 
> need to add a 'render_type' field to accompany the raw data.  Then we can 
> really mix it up.
>
 
I have suggested the same here (without mixing html/markmin):

https://groups.google.com/d/msg/web2py-developers/smnu-k7G6iE/EV3CdD_j3nEJ

-- 

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




[web2py] Re: REF: Bare Ajax Login

2013-05-23 Thread Derek
You did read the book before you asked, yes?

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

On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:
>
> Is there a way of using a pure Ajax request to web2py authentication and 
> create a session for a successfully logged in user?
>
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Anthony
Are you doing something that requires fake migrations every day (presumably 
multiple times per day)? Are the *.table files getting deleted?

On Thursday, May 23, 2013 12:04:32 PM UTC-4, Abhishek Gupta wrote:
>
> Anthony, that souns good, thanks.
> Massimo, our sql.log grows to almost 1GB each day. I used 
> fake_migrate=True for all the tables.
>
> Regards
> Abhishek Gupta
> Co-founder, Zumbl
>  
> Zumbl   |  Facebook 
>  | 
>  Twitter   |  
> LinkedIn
>  
>
> On 23 May 2013 19:25, Anthony > wrote:
>
>> I believe sql.log only records the SQL for migrations (i.e., table 
>> creation, altering tables, and truncating tables), so logging will be 
>> disabled if you disable migrations.
>>
>> Anthony
>>
>>
>> On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:
>>>
>>> Hi,
>>>
>>> Is there an easy way to disable the logs generated in databases/sql.log 
>>> other than editing gluon/dal.py?
>>>
>>> Regards
>>> Abhishek Gupta
>>> Co-founder, Zumbl
>>>  
>>
>

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Abhishek Gupta
No, we aren't doing anything that requires fake_migrations to be true. I
did it because of the peculiar needs that we had :

Live Server - One domain - One database
Dev Server - Multiple domains/web2py installations - Shared database

Generally, when we make any change in db, I set migrate=True for that table
which make changes to the shared database, and then, manually migrate the
table using SQL syntax to the live server. But I think migrate=False should
work equally well too, and I shouldn't thus be required to worry about the
logging.

Regards
Abhishek Gupta
Co-founder, Zumbl

Zumbl   |
Facebook  |
 Twitter   |
LinkedIn


On 23 May 2013 23:23, Anthony  wrote:

> Are you doing something that requires fake migrations every day
> (presumably multiple times per day)? Are the *.table files getting deleted?
>
>
> On Thursday, May 23, 2013 12:04:32 PM UTC-4, Abhishek Gupta wrote:
>
>> Anthony, that souns good, thanks.
>> Massimo, our sql.log grows to almost 1GB each day. I used
>> fake_migrate=True for all the tables.
>>
>> Regards
>> Abhishek Gupta
>> Co-founder, Zumbl
>>
>> Zumbl   |  
>> Facebook  |
>>  Twitter   |  
>> LinkedIn
>>
>>
>> On 23 May 2013 19:25, Anthony  wrote:
>>
>>> I believe sql.log only records the SQL for migrations (i.e., table
>>> creation, altering tables, and truncating tables), so logging will be
>>> disabled if you disable migrations.
>>>
>>> Anthony
>>>
>>>
>>> On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:

 Hi,

 Is there an easy way to disable the logs generated in databases/sql.log
 other than editing gluon/dal.py?

 Regards
 Abhishek Gupta
 Co-founder, Zumbl

>>>
>>

-- 

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




Re: [web2py] Re: Testing your app using py.test

2013-05-23 Thread Anthony
We can update the book as frequently as we like. I think this is the place 
for announcements (there's also the Twitter feed). Aside from that, I 
suppose we could maintain some kind of framework roadmap document, but we 
don't really have a formal roadmap process, and I'm not sure there is a 
desire to adopt one.

Anthony

On Thursday, May 23, 2013 12:47:35 PM UTC-4, Arnon Marcus wrote:
>
> On the contrary. I think information about testing using web2py, in 
> conjuction with various testing-frameworks/tools, is highly relevant in the 
> book, along with common testing-practices, and the way they apply when 
> testing with web2py.
>
> The book, in that case, would act as an information-centralization tool. 
> So it's not about the book. Its about 
> information-centralization/consolidation, for the sake of 
> research-efficiency, and prevention of duplication-of-efforts. There may be 
> other tools/platforms that can searve this role.
>
> The book might be a less-efficient way than others, in terms of how 
> frequent it is updated.
>
> I am deliberatelty refraining from specific suggestions, because the 
> actual solution-implementation is less important than understanding the 
> problem. The need is more important than the strategy for meeting it.
>
> Where I think a book is a terrible option, is when concearning exposure of 
> frequently-updating information. Say, announcement of a feature-project 
> that is underway, This should belong to a "news-feed", a newsletter, or 
> both.
>
> The 2 worlds might meet, say, as an announcement for additions to the 
> book, with links to the chapters.
>
> The FAQ is really old and dated, so I think it should be updated as well. 
> And it uses some usefull categories, that should be retargeted to a 
> newsfeed.
>
>

-- 

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




[web2py] Re: installing Pandas in site-packages

2013-05-23 Thread Anthony
If you have Python installed on your machine and want web2py to use that 
version of Python, then simply download the source version of web2py and 
run that instead of using the Windows or Mac binaries. The binaries include 
their own standalone Python interpreter, so they won't see any modules you 
have installed in your machine's Python. If you already have Python on the 
machine, there's really no reason to run the web2py binaries anyway.

Anthony

On Thursday, May 23, 2013 11:34:38 AM UTC-4, gthwang5 wrote:
>
>
> I am running into issues installing pandas (or any third-party module). 
>
> Basically, my python on my windows machine sits on c:\python27\, and 
> pandas is installed in c:\python27\Lib\Site-Packages\pandas
>
> Now, when I try to include pandas in my web2py app, however, I am getting 
> an error saying it can't import it. 
>
> I am assuming that web2py does not use my local python but its own. 
>
> How do I get around this issue and either a) have web2py use my local 
> python interpreter and its modules  or b) install python directly
> to my web2py app's module's folder?   This is a noob question, sorry, but 
> on windows or any environment I am not sure how to 
> do a installation that's not to the python PATH and in some custom 
> location.
>
> Thanks,
>
>

-- 

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




[web2py] Re: REF: Bare Ajax Login

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

Anthony

On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:
>
> You did read the book before you asked, yes?
>
>
> http://www.web2py.com/book/default/chapter/09#Access-Control-and-Basic-Authentication
>
> On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:
>>
>> Is there a way of using a pure Ajax request to web2py authentication and 
>> create a session for a successfully logged in user?
>>
>> -- 
>>
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is 
>> all - Thomas Carlyle 1795-1881
>>
>> /~ 
>>
>

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Anthony
I was just wondering because I think writing to sql.log should only happen 
when there are actual changes to the table definitions (or if the *.table 
files are deleted or become corrupted). If you're not making any changes to 
the schema or touching the *.table files, I wouldn't think the sql.log file 
would fill up so quickly. What do you see in it?

Anthony

On Thursday, May 23, 2013 1:58:39 PM UTC-4, Abhishek Gupta wrote:
>
> No, we aren't doing anything that requires fake_migrations to be true. I 
> did it because of the peculiar needs that we had :
>
> Live Server - One domain - One database
> Dev Server - Multiple domains/web2py installations - Shared database
>
> Generally, when we make any change in db, I set migrate=True for that 
> table which make changes to the shared database, and then, manually migrate 
> the table using SQL syntax to the live server. But I think migrate=False 
> should work equally well too, and I shouldn't thus be required to worry 
> about the logging.
>
> Regards
> Abhishek Gupta
> Co-founder, Zumbl
>  
> Zumbl   |  Facebook 
>  | 
>  Twitter   |  
> LinkedIn
>  
>
> On 23 May 2013 23:23, Anthony > wrote:
>
>> Are you doing something that requires fake migrations every day 
>> (presumably multiple times per day)? Are the *.table files getting deleted?
>>
>>
>> On Thursday, May 23, 2013 12:04:32 PM UTC-4, Abhishek Gupta wrote:
>>
>>> Anthony, that souns good, thanks.
>>> Massimo, our sql.log grows to almost 1GB each day. I used 
>>> fake_migrate=True for all the tables.
>>>
>>> Regards
>>> Abhishek Gupta
>>> Co-founder, Zumbl
>>>  
>>> Zumbl   |  
>>> Facebook  | 
>>>  Twitter   |  
>>> LinkedIn
>>>  
>>>
>>> On 23 May 2013 19:25, Anthony  wrote:
>>>
 I believe sql.log only records the SQL for migrations (i.e., table 
 creation, altering tables, and truncating tables), so logging will be 
 disabled if you disable migrations.

 Anthony


 On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:
>
> Hi,
>
> Is there an easy way to disable the logs generated in 
> databases/sql.log other than editing gluon/dal.py?
>
> Regards
> Abhishek Gupta
> Co-founder, Zumbl
>  

>>>
>

-- 

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




[web2py] Re: Turning off SQL Logging

2013-05-23 Thread Abhishek Gupta
No, .table files aren't deleted or corrupted. Most of the output are of the
type

timestamp: XXX
ALTER TABLE YYY DROP COLUMN ZZZ;
faked!

Regards
Abhishek Gupta
Co-founder, Zumbl

Zumbl   |
Facebook  |
 Twitter   |
LinkedIn


On 23 May 2013 23:42, Anthony  wrote:

> I was just wondering because I think writing to sql.log should only happen
> when there are actual changes to the table definitions (or if the *.table
> files are deleted or become corrupted). If you're not making any changes to
> the schema or touching the *.table files, I wouldn't think the sql.log file
> would fill up so quickly. What do you see in it?
>
> Anthony
>
>
> On Thursday, May 23, 2013 1:58:39 PM UTC-4, Abhishek Gupta wrote:
>
>> No, we aren't doing anything that requires fake_migrations to be true. I
>> did it because of the peculiar needs that we had :
>>
>> Live Server - One domain - One database
>> Dev Server - Multiple domains/web2py installations - Shared database
>>
>> Generally, when we make any change in db, I set migrate=True for that
>> table which make changes to the shared database, and then, manually migrate
>> the table using SQL syntax to the live server. But I think migrate=False
>> should work equally well too, and I shouldn't thus be required to worry
>> about the logging.
>>
>> Regards
>> Abhishek Gupta
>> Co-founder, Zumbl
>>
>> Zumbl   |  
>> Facebook  |
>>  Twitter   |  
>> LinkedIn
>>
>>
>> On 23 May 2013 23:23, Anthony  wrote:
>>
>>> Are you doing something that requires fake migrations every day
>>> (presumably multiple times per day)? Are the *.table files getting deleted?
>>>
>>>
>>> On Thursday, May 23, 2013 12:04:32 PM UTC-4, Abhishek Gupta wrote:
>>>
 Anthony, that souns good, thanks.
 Massimo, our sql.log grows to almost 1GB each day. I used
 fake_migrate=True for all the tables.

 Regards
 Abhishek Gupta
 Co-founder, Zumbl

 Zumbl   |  
 Facebook  |
  Twitter   |  
 LinkedIn


 On 23 May 2013 19:25, Anthony  wrote:

> I believe sql.log only records the SQL for migrations (i.e., table
> creation, altering tables, and truncating tables), so logging will be
> disabled if you disable migrations.
>
> Anthony
>
>
> On Thursday, May 23, 2013 12:16:20 AM UTC-4, Abhishek Gupta wrote:
>>
>> Hi,
>>
>> Is there an easy way to disable the logs generated in
>> databases/sql.log other than editing gluon/dal.py?
>>
>> Regards
>> Abhishek Gupta
>> Co-founder, Zumbl
>>
>

>>

-- 

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




[web2py] how to use library in web2py

2013-05-23 Thread Nam Soo In
I am trying to use library from http://grabz.it/api/python/
I put library in controller and module and import GrabzItClinet 
I basically copy the whole directory(GrabzIt) into controller and module 
The error says
Cannot import module 'GrabzItClient'

-- 

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




[web2py] Re: how to use library in web2py

2013-05-23 Thread Anthony
If you want to do:

import GrabzItClient

then it looks like you need to put these 4 
filesdirectly
 in the /yourapp/modules folder (don't put another sub-folder in 
that folder).

Anthony

On Thursday, May 23, 2013 2:22:21 PM UTC-4, Nam Soo In wrote:
>
> I am trying to use library from http://grabz.it/api/python/
> I put library in controller and module and import GrabzItClinet 
> I basically copy the whole directory(GrabzIt) into controller and module 
> The error says
> Cannot import module 'GrabzItClient'
>  Dose anybody knows how to add lib into web2py?
>
> I am really new to web2py 
>
> Thank you in advance.
>

-- 

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




[web2py] Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread bracquet
In my views, I have:

{{=A('click for more information', _href=URL("myCallback", args=[1]))}}


When the anchor button is clicked, my callback will do some lookup and 
processing in the db, and then will redirect to a new page populated with 
the new information:

def search_results():
resultSet = request.args(0)
# Build HTML helpers using resultSet
div = DIV(.)

return dict(div=div)

def myButton():
 # Figure out the id from the request
 someId = request.args(0)

 # get some data from db using the id
 resultSet = db()


 # want to redirect to another page with the new data in the resultSet
redirect(URL('search_results', args=resultSet))

But doing the redirect with the resultSet args will screw up the URL and 
I'll end up with an invalid request. 

I've thought of two ways around this:

1) Create a temporary session variable and store the resultSet there. Once 
I'm done with the data, I'll explicitly clear it.

2) Instead of doing the database logic in the callback, pass the id to the 
search_results() and do the database logic there.

I'm hesitant to adopt the first option because it seems messy to create a 
bunch of session variables for temporary things (unless this is standard 
practice?).

The second option seems okay, but I'm afraid that the code will become too 
specific to that particular anchor tag. That is, if I create a new anchor 
tag to do some other search, the database logic may be different than the 
one inside the search_results(). For this, I guess the better question 
should be if the database logic code should live in the callback function 
or in the target redirect controller function?


In spite of this, what would be the clean or proper way of sending data 
with a redirect from a callback function?

-- 

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




Re: [web2py] How to force Auth module to disable Password encryption!

2013-05-23 Thread Vinicius Assef
Using stadard web2py registration and authentication, you cannot disable it.

You must write your own registration and authentication routines or
change your workflow to register and print your cards.



On Thu, May 23, 2013 at 5:44 AM, Ahmad Faiyaz  wrote:
> Hello,
> I am new on web2py. I am using it to develop a Programming Contest
> Management system. Now on a ONSITE Programming Contest , we have to
> distribute username and password printed on paper. So i have implemented a
> function which will generate user accounts automatically then print the
> passwords on a PDF. Web2py uses encrpytion to store the password, which is
> not retrievable. Now i can have a different table to store the passwords,
> but when i use use Auth to modify the password, i will be unable to update
> my own table. What to do now ? How i can disable encryption on auth_user
> table ? Can anyone help !!
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

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




[web2py] Re: How to force Auth module to disable Password encryption!

2013-05-23 Thread Anthony
After auth.define_tables(), I think:

db.auth_user.password.requires = None  # or some other validator, such as 
IS_STRONG()

should do it. By default, the password field has a CRYPT() validator, which 
does the hashing -- this would remove/replace that validator.

However, this is not a good practice. I can see why you might initially 
want to have the plain text of temporary passwords to distribute, but once 
a user logs in and updates the password, why do you continue to need the 
plain text of the updated password?

Anthony

On Thursday, May 23, 2013 4:44:52 AM UTC-4, Ahmad Faiyaz wrote:
>
> Hello,
> I am new on web2py. I am using it to develop a Programming Contest 
> Management system. Now on a ONSITE Programming Contest , we have to 
> distribute username and password printed on paper. So i have implemented a 
> function which will generate user accounts automatically then print the 
> passwords on a PDF. Web2py uses encrpytion to store the password, which is 
> not retrievable. Now i can have a different table to store the passwords, 
> but when i use use Auth to modify the password, i will be unable to update 
> my own table. What to do now ? How i can disable encryption on auth_user 
> table ? Can anyone help !!
>

-- 

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




[web2py] monitoring your web app

2013-05-23 Thread samuel bonilla
for web2py.

http://newrelic.com/lp/python-monitoring?utm_source=REMK&utm_medium=remarketing&utm_content=rpm&utm_campaign=RPM&utm_term=graph250&mpc=TA-REMK-RPM-EN-0-NewLP-textad&gclid=COWghpP7rLcCFYWf4AodWlQAAA

-- 

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




[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread Anthony
Why do you need to redirect at all? You can just call the search_results() 
function directly from the myButton() function:

def search_results(resultSet):
div = DIV(.)
return dict(div=div)

def myButton():
someId = request.args(0)
resultSet = db()
return search_results(resultSet)

If the search_results() function is needed in other controllers, you could 
define it in a model file or in a module and import it. Note, functions 
that take arguments (as search_results does above) are not exposed as 
actions accessible via URL -- they are for internal use only (same for a 
function that begins with a double underscore, even if it doesn't take any 
arguments).

Anthony

On Thursday, May 23, 2013 2:51:24 PM UTC-4, brac...@gmail.com wrote:
>
> In my views, I have:
>
> {{=A('click for more information', _href=URL("myCallback", args=[1]))}}
>
>
> When the anchor button is clicked, my callback will do some lookup and 
> processing in the db, and then will redirect to a new page populated with 
> the new information:
>
> def search_results():
> resultSet = request.args(0)
> # Build HTML helpers using resultSet
> div = DIV(.)
>
> return dict(div=div)
>
> def myButton():
>  # Figure out the id from the request
>  someId = request.args(0)
>
>  # get some data from db using the id
>  resultSet = db()
>
>
>  # want to redirect to another page with the new data in the resultSet
> redirect(URL('search_results', args=resultSet))
>
> But doing the redirect with the resultSet args will screw up the URL and 
> I'll end up with an invalid request. 
>
> I've thought of two ways around this:
>
> 1) Create a temporary session variable and store the resultSet there. Once 
> I'm done with the data, I'll explicitly clear it.
>
> 2) Instead of doing the database logic in the callback, pass the id to the 
> search_results() and do the database logic there.
>
> I'm hesitant to adopt the first option because it seems messy to create a 
> bunch of session variables for temporary things (unless this is standard 
> practice?).
>
> The second option seems okay, but I'm afraid that the code will become too 
> specific to that particular anchor tag. That is, if I create a new anchor 
> tag to do some other search, the database logic may be different than the 
> one inside the search_results(). For this, I guess the better question 
> should be if the database logic code should live in the callback function 
> or in the target redirect controller function?
>
>
> In spite of this, what would be the clean or proper way of sending data 
> with a redirect from a callback function?
>

-- 

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




[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread bracquet
search_results() will have to be exposed since I want to display the 
results on a different page (in search_results.html). I think returning the 
div using your suggestion would still be on the same page?



On Thursday, May 23, 2013 3:38:17 PM UTC-4, Anthony wrote:
>
> Why do you need to redirect at all? You can just call the search_results() 
> function directly from the myButton() function:
>
> def search_results(resultSet):
> div = DIV(.)
> return dict(div=div)
>
> def myButton():
> someId = request.args(0)
> resultSet = db()
> return search_results(resultSet)
>
> If the search_results() function is needed in other controllers, you could 
> define it in a model file or in a module and import it. Note, functions 
> that take arguments (as search_results does above) are not exposed as 
> actions accessible via URL -- they are for internal use only (same for a 
> function that begins with a double underscore, even if it doesn't take any 
> arguments).
>
> Anthony
>
> On Thursday, May 23, 2013 2:51:24 PM UTC-4, brac...@gmail.com wrote:
>>
>> In my views, I have:
>>
>> {{=A('click for more information', _href=URL("myCallback", args=[1]))}}
>>
>>
>> When the anchor button is clicked, my callback will do some lookup and 
>> processing in the db, and then will redirect to a new page populated with 
>> the new information:
>>
>> def search_results():
>> resultSet = request.args(0)
>> # Build HTML helpers using resultSet
>> div = DIV(.)
>>
>> return dict(div=div)
>>
>> def myButton():
>>  # Figure out the id from the request
>>  someId = request.args(0)
>>
>>  # get some data from db using the id
>>  resultSet = db()
>>
>>
>>  # want to redirect to another page with the new data in the 
>> resultSet
>> redirect(URL('search_results', args=resultSet))
>>
>> But doing the redirect with the resultSet args will screw up the URL and 
>> I'll end up with an invalid request. 
>>
>> I've thought of two ways around this:
>>
>> 1) Create a temporary session variable and store the resultSet there. 
>> Once I'm done with the data, I'll explicitly clear it.
>>
>> 2) Instead of doing the database logic in the callback, pass the id to 
>> the search_results() and do the database logic there.
>>
>> I'm hesitant to adopt the first option because it seems messy to create a 
>> bunch of session variables for temporary things (unless this is standard 
>> practice?).
>>
>> The second option seems okay, but I'm afraid that the code will become 
>> too specific to that particular anchor tag. That is, if I create a new 
>> anchor tag to do some other search, the database logic may be different 
>> than the one inside the search_results(). For this, I guess the better 
>> question should be if the database logic code should live in the callback 
>> function or in the target redirect controller function?
>>
>>
>> In spite of this, what would be the clean or proper way of sending data 
>> with a redirect from a callback function?
>>
>

-- 

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




[web2py] Postgres users beware auth.signature is_active; bad problem, easy to fix

2013-05-23 Thread Cliff Kachinske
auth.signature appends a "boolean" field called is_active to a table.  The 
default is True.

Under the covers it's not really boolean, it's char(1).  When you insert a 
record, is_active is set to "t".  That's right, a lowercase t.

Today I had the kind of problem where queries were missing records.  It 
turns out that the DAL was emitting queries looking for 'T' in is_active.

The queries were missing records because Postgres is case sensitive in char 
fields.  

I don't really understand why the dal adapters for Postgres transmogrify 
boolean fields to char(1) when Postgres supports boolean fields.  The nice 
thing about that is Postgres boolean fields do not care about case.

The easy fix for this problem is make sure that any fields you have defined 
as boolean in your models are also boolean in Postgres.

-- 

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




[web2py] Append() multiple components to html helper

2013-05-23 Thread Ian W. Scott
Is there a way to append multiple components to an HTML helper in a single 
append() call, or do we have to use a separate append() call for each 
component?

I'm trying to append four components to a SPAN helper held in the variable 
"wrapper." I've tried it this way:

wrapper.append(new_component_1, new_component_2, new_component_3, 
new_component_4)

But the append() function seems to want only one argument. The code above 
raises an error, saying that I've submitted too many arguments.

Thanks!

-- 

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




[web2py] Re: Append() multiple components to html helper

2013-05-23 Thread Anthony
The .components attribute of the helper is a Python list, so you can use 
all the standard list methods, such as .extend():

wrapper.components.extend([new_component_1, new_component_2, new_component_3
, new_component_4])

Perhaps we should add an .extend() method directly to the helpers, as we 
already have .append() and .insert().

Anthony


On Thursday, May 23, 2013 5:49:34 PM UTC-4, Ian W. Scott wrote:
>
> Is there a way to append multiple components to an HTML helper in a single 
> append() call, or do we have to use a separate append() call for each 
> component?
>
> I'm trying to append four components to a SPAN helper held in the variable 
> "wrapper." I've tried it this way:
>
> wrapper.append(new_component_1, new_component_2, new_component_3, 
> new_component_4)
>
> But the append() function seems to want only one argument. The code above 
> raises an error, saying that I've submitted too many arguments.
>
> Thanks!
>
>

-- 

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




[web2py] dynamic dal query

2013-05-23 Thread António Ramos
hello
i have 4 functions to do the same query.
db(db.mytable1.id>0).select()
db(db.mytable2.id>0).select()
db(db.mytable3.id>0).select()
db(db.mytable4.id>0).select()

Maybe i can use only one like this


def f1(table_to_query):
row=db(db[table_to_query].id>0).select()

it does not work


what is the correct syntax?


in console i can see that the next  code works
table_to_query='mytable'
print db[table_to_query].fields
output
['id','field1','field2',etc]

-- 

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




[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread Anthony
But presumably the myButton() function does not have its own view given 
that it was originally written to always redirect to another URL. In that 
case, why not just make the myButton.html view render the search results as 
desired? If you want a search_results.html view to be used from multiple 
functions, that's no problem either -- here are three options:

def search_results(resultSet):
div = DIV(.)
response.view = 'default/search_results.html'
return dict(div=div)

So, any time the search_results() function is called by another function, 
it sets the view to search_results.html. Or, you can set the view within 
the calling function:

def myButton():
someId = request.args(0)
resultSet = db()
response.view = 'default/search_results.html'
return search_results(resultSet)

Or you could include the search_results view in another view. For example, 
in myButton.html, you can do:

{{extend 'layout.html'}}
{{include 'default/search_results.html'}}

Anthony
 

On Thursday, May 23, 2013 4:02:29 PM UTC-4, brac...@gmail.com wrote:
>
> search_results() will have to be exposed since I want to display the 
> results on a different page (in search_results.html). I think returning the 
> div using your suggestion would still be on the same page?
>
>
>
> On Thursday, May 23, 2013 3:38:17 PM UTC-4, Anthony wrote:
>>
>> Why do you need to redirect at all? You can just call the 
>> search_results() function directly from the myButton() function:
>>
>> def search_results(resultSet):
>> div = DIV(.)
>> return dict(div=div)
>>
>> def myButton():
>> someId = request.args(0)
>> resultSet = db()
>> return search_results(resultSet)
>>
>> If the search_results() function is needed in other controllers, you 
>> could define it in a model file or in a module and import it. Note, 
>> functions that take arguments (as search_results does above) are not 
>> exposed as actions accessible via URL -- they are for internal use only 
>> (same for a function that begins with a double underscore, even if it 
>> doesn't take any arguments).
>>
>> Anthony
>>
>> On Thursday, May 23, 2013 2:51:24 PM UTC-4, brac...@gmail.com wrote:
>>>
>>> In my views, I have:
>>>
>>> {{=A('click for more information', _href=URL("myCallback", args=[1]))}}
>>>
>>>
>>> When the anchor button is clicked, my callback will do some lookup and 
>>> processing in the db, and then will redirect to a new page populated with 
>>> the new information:
>>>
>>> def search_results():
>>> resultSet = request.args(0)
>>> # Build HTML helpers using resultSet
>>> div = DIV(.)
>>>
>>> return dict(div=div)
>>>
>>> def myButton():
>>>  # Figure out the id from the request
>>>  someId = request.args(0)
>>>
>>>  # get some data from db using the id
>>>  resultSet = db()
>>>
>>>
>>>  # want to redirect to another page with the new data in the 
>>> resultSet
>>> redirect(URL('search_results', args=resultSet))
>>>
>>> But doing the redirect with the resultSet args will screw up the URL and 
>>> I'll end up with an invalid request. 
>>>
>>> I've thought of two ways around this:
>>>
>>> 1) Create a temporary session variable and store the resultSet there. 
>>> Once I'm done with the data, I'll explicitly clear it.
>>>
>>> 2) Instead of doing the database logic in the callback, pass the id to 
>>> the search_results() and do the database logic there.
>>>
>>> I'm hesitant to adopt the first option because it seems messy to create 
>>> a bunch of session variables for temporary things (unless this is standard 
>>> practice?).
>>>
>>> The second option seems okay, but I'm afraid that the code will become 
>>> too specific to that particular anchor tag. That is, if I create a new 
>>> anchor tag to do some other search, the database logic may be different 
>>> than the one inside the search_results(). For this, I guess the better 
>>> question should be if the database logic code should live in the callback 
>>> function or in the target redirect controller function?
>>>
>>>
>>> In spite of this, what would be the clean or proper way of sending data 
>>> with a redirect from a callback function?
>>>
>>

-- 

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




[web2py] Re: dynamic dal query

2013-05-23 Thread Anthony
That should work if you are passing in the name of the table as a string. 
If you're passing in the table object itself, then it should be:

row=db(table_to_query.id>0).select()

As an aside, it helps if you report the error or traceback (or explain in 
more detail than "does not work").

Anthony

On Thursday, May 23, 2013 6:22:00 PM UTC-4, Ramos wrote:
>
> hello 
> i have 4 functions to do the same query.
> db(db.mytable1.id>0).select()
> db(db.mytable2.id>0).select()
> db(db.mytable3.id>0).select()
> db(db.mytable4.id>0).select()
>
> Maybe i can use only one like this
>
>
> def f1(table_to_query):
> row=db(db[table_to_query].id>0).select()
>
> it does not work
>
>
> what is the correct syntax?
>
>
> in console i can see that the next  code works
> table_to_query='mytable'
> print db[table_to_query].fields
> output
> ['id','field1','field2',etc]
>
>
>

-- 

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




[web2py] Re: rss feed

2013-05-23 Thread greaneym
I figured out a solutiion.  It may not be the most appropriate, though,

in the controller, here is what gets returned:

return(XML(t_conditions + t_summary))

and in the view, 
{{ =(XML(LOAD('default','weatherfeed')))}}

This prints out the image and text with no extraneous characters.

On Thursday, May 23, 2013 9:52:06 AM UTC-5, greaneym wrote:
>
> Thank you, Massimo,
>
> After reading a lot more about feedparser and xlml,
> I began going through xlml examples but figured that feedparser was already
> doing most of what I needed, so I found this on stackoverflow,
>
> http://stackoverflow.com/questions/11157894/less-painful-way-to-parse-a-rss-feed-with-lxml
>
> and read more docs on feedparser entries.
>
> and reading the html "view source" of the rss feed from rss_aggregator, I 
> found that 'title' and 'summary' contained what I needed.
>
> With feedparser selections, I can display the current weather from NOAA 
> page. 
>
> The only problem is that I don't understand how to reformat so uuencoded? 
> details don't get left in the view. I've made attempts to translate or 
> reformat or use helpers but so not getting the plain string that I want to 
> view.
>
> To get a current weather report from NOAA and display it, here is my 
> solution.
>
> 1. http://w1.weather.gov/xml/current_obs/ Go here and select airport 
> location closest
>  to desired destination
> 2. select state Illinois, Find, Select Chicago Midway Airport, select RSS 
> 3. copy the feed uri path from the uri window,
>  feed://w1.weather.gov/xml/current_obs/KMDW.rss
> This will go into the feedparser.py function.
>
> rename rss_aggregator() in feedparser.py to weatherfeed()
>
> def weatherfeed():
> import datetime
> import gluon.contrib.rss2 as rss2
> import gluon.contrib.feedparser as feedparser
> # get the location closest to desired location first
> # and enter rss path below
> d = feedparser.parse('feed://w1.weather.gov/xml/current_obs/KMDW.rss')
> #this returns items but they are unicode values
> #wdict = d
> #print "wdict contains",wdict
> #print "wdict is type",type(wdict)
> #print "title",wdict['feed']['title']
> for entry in d['entries']:
>   #print "feed title", d['feed']['title']
>   #print "title type", type(d['feed']['title'])
>   #print "bozo", d.bozo
>   #print "headers" , d.headers.get('Content-type')
>   strt_summary =  entry.get('summary', '')
>   t_summary = str(strt_summary)
>   strt_conditions = entry.get('title', '')
>   t_conditions = str(strt_conditions)
>   print "t_conditions", t_conditions
>   #typesummary = type(t_summary)
>   print "t_conditions", t_conditions
>   #typesummary = type(t_summary)
> #return dict(t_conditions=t_conditions,t_summary=t_summary)
> return (t_conditions,t_summary)
>
> I left in my commented print statements so other people trying it out can 
> see contents of the lists and dictionaries.
>
>
> For the default/index.html view
>
>  NOAA Weather Service
> {{=LOAD('default','weatherfeed')}}
> 
> 
> {{pass}}
> 
>
> This contains almost what I need but I can't figure out how to get the 
> unicode or extra chars out. I could use "tr" or some regexp but is there a 
> simpler way to do it with a helper?
>
>
> thanks,
> Margaret
>
>

-- 

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




[web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Matt
Hi there,

I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
mac, Python 2.7.2, no external JSON library installed.

Sending the following data via PUT, application/json; charset=UTF-8:

{"id": 3}

results in a JSON parser error occurring at main.py:

if is_json:
try:
logging.info('before') <--- my addition
json_vars = sj.load(body)
logging.info('after') <--- my addition
body.seek(0)
except Exception, e: <--- my addition
logging.exception(e) <--- my addition
# incoherent request bodies can still be parsed "ad-hoc"
json_vars = {}
pass
# update vars and get_vars with what was posted as json
request.get_vars.update(json_vars)
request.vars.update(json_vars)

INFO 2013-05-24 00:07:21,100 main.py:337] before
INFO 2013-05-24 00:07:21,100 main.py:338] 
ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
decoded
Traceback (most recent call last):
  File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
json_vars = sj.load(body)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
 
line 278, in load
**kw)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
 
line 326, in loads
return _default_decoder.decode(s)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
 
line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
 
line 384, in raw_decode
raise ValueError("No JSON object could be decoded")

Appears to be related to the id() function for some reason, as changing the 
attribute name to anything other than "id" works fine. 

Help on built-in function id in module __builtin__:

id(...)

id(object) -> integer

Return the identity of an object.  This is guaranteed to be unique among
simultaneously existing objects.  (Hint: it's the object's memory
address.)

If I explicitly force it to use contrib.simplejson. i.e. change the top of 
main.py

try:
import simplejson as sj #external installed library
except:
try:
import contrib.simplejson as sj #pure python library <--- Pasted.
except:
import contrib.simplejson as sj #pure python library

I get the same result.

Any ideas?

Thanks in advance,
Matt

-- 

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




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Jonathan Lundell
On 23 May 2013, at 5:35 PM, Matt  wrote:
> Hi there,
> 
> I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on mac, 
> Python 2.7.2, no external JSON library installed.
> 
> Sending the following data via PUT, application/json; charset=UTF-8:
> 
> {"id": 3}
> 
> results in a JSON parser error occurring at main.py:
> 
> if is_json:
> try:
> logging.info('before')<--- my addition
> json_vars = sj.load(body)
> logging.info('after') <--- my addition
> body.seek(0)
> except Exception, e:  <--- my addition
> logging.exception(e)  <--- my addition
> # incoherent request bodies can still be parsed "ad-hoc"
> json_vars = {}
> pass
> # update vars and get_vars with what was posted as json
> request.get_vars.update(json_vars)
> request.vars.update(json_vars)
> 
> INFO 2013-05-24 00:07:21,100 main.py:337] before
> INFO 2013-05-24 00:07:21,100 main.py:338]  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'>
> ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be decoded
> Traceback (most recent call last):
>   File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
> json_vars = sj.load(body)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  line 278, in load
> **kw)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  line 326, in loads
> return _default_decoder.decode(s)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  line 366, in decode
> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  line 384, in raw_decode
> raise ValueError("No JSON object could be decoded")
> 
> Appears to be related to the id() function for some reason, as changing the 
> attribute name to anything other than "id" works fine. 
> 
> Help on built-in function id in module __builtin__:
> 
> id(...)
> 
> id(object) -> integer
> 
> Return the identity of an object.  This is guaranteed to be unique among
> simultaneously existing objects.  (Hint: it's the object's memory
> address.)
> 
> If I explicitly force it to use contrib.simplejson. i.e. change the top of 
> main.py
> 
> try:
> import simplejson as sj #external installed library
> except:
> try:
> import contrib.simplejson as sj #pure python library  <--- Pasted.
> except:
> import contrib.simplejson as sj #pure python library
> 
> I get the same result.
> 
> Any ideas?
> 

FWIW, json.loads('{"id": 3}') works fine.

I'd try logging body.read() before the json.load call, and see what json is 
actually getting. You could follow that with body.seek(0) if you want, but 
since it's going to crash anyway...

-- 

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




[web2py] Re: Referencing auth_user custom field in another table

2013-05-23 Thread Chris Teodorski
Anthony,

How do I set them to writable when I need them to be?  I'm attempting to 
update them in a controller and I'm not sure how to do it

Chris


On Monday, 20 May 2013 12:19:32 UTC-4, Anthony wrote:
>
> Setting a field's "writable" attribute to False prevents users from 
> inputting values in forms, and setting the "readable" attribute to False 
> prevents the field from appearing at all. Note, you can set these 
> attributes dynamically, so they can default to False, but you can 
> selectively set them to True in particular contexts.
>
> Anthony
>
> On Monday, May 20, 2013 12:13:48 PM UTC-4, Chris Teodorski wrote:
>>
>> Sorry - it is a one to one relationship.  So if I include it as part of 
>> the auth_user table -- I will need to prevent users form directly editing 
>> the challenge fields (and not expose them on registration) -- so I guess I 
>> now need to figure out how to do that.
>>
>> Thanks again for the help.
>>
>>
>> On Monday, 20 May 2013 11:43:13 UTC-4, Anthony wrote:
>>>
>>> I assumed this was a one-to-many relationship, but given that it is 
>>> actually one-to-one, you certainly could just put the t_teams fields 
>>> directly in the auth_user table.
>>>
>>> Anthony
>>>
>>> On Monday, May 20, 2013 10:02:11 AM UTC-4, Chris Teodorski wrote:

 Let me try again to explain what I'm striving for and see if that helps 
 you guys help me.  I'm really trying to explain as concisely as possible, 
 without explaining the nitty gritty of what I'm trying to do.

 In my ideal situation, when a user registers, they create a team name 
 as part of the registration process.  When registration occurs a row is 
 added to the the t_teams table which contains a field for their team name 
 and their status on all of the challenges.   

 Now that I'm explaining it -- perhaps the 'right' solution is to just 
 add the extra fields to the auth_user table and not bother with having a 
 secondary table.

 Chris




 On Monday, 20 May 2013 09:47:14 UTC-4, Chris Teodorski wrote:
>
> I'm going to give this a try -- but I'm honestly not sure exactly what 
> this field definition does.  I'm going to play with it a bit and RTFM to 
> see if I can figure it out.
>
>
>
> On Monday, 20 May 2013 09:26:23 UTC-4, Anthony wrote:
>>
>> Would it work for you to just have a foreign key reference to the 
>> auth_user primary key, which is the id field? You could set the 
>> "represent" 
>> attribute of the "name" field to display the "team_name" value from the 
>> referenced auth_user record.
>>
>> db.define_table('t_teams',
>> Field('name', db.auth_user,
>>   requires=IS_IN_DB(db, 'auth_user.id', '%s(team_name)s'),
>>   represent=lambda id, r: db.auth_user(id).team_name))
>>
>> Anthony
>>
>> On Monday, May 20, 2013 7:49:49 AM UTC-4, Chris Teodorski wrote:
>>>
>>> What I'm trying to do -- and obviously not explaining well is to 
>>> have t_teams.name to be a foreign key for the field custom field in 
>>> auth_users.
>>>
>>> Does that explain it any better?
>>>
>>> On Monday, 20 May 2013 02:59:00 UTC-4, Niphlod wrote:

 uhm. 
 what do you want (as examples) in auth_user.team_name and what on 
 t_teams.name ?
 if you want e.g. "a-team" in auth_user.team_name and "a-team" in 
 t_teams.name, and a record in t_teams must exist only with a 
 "name" that is one of the team_name values of the auth_user table 
 (i.e. you 
 have to create the user BEFORE the t_teams), then you can't create 
 that 
 reference.

 You should use a Field('name', requires=IS_IN_DB(db, 
 'auth_user.team_name'))






-- 

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




[web2py] Re: Referencing auth_user custom field in another table

2013-05-23 Thread Chris Teodorski
So I'm stuck again and once again -- appreciate any help.  What I'm doing 
it pretty simple, I think.  The code runs fine -- no error messages, but 
the field isn't updated as I expect.  So something is borked.  flag 
contains an integer from 1-16.  The field in the db is called f_chal1, 
f_chal2, etc.

def update_scoreboard(flag):
team = auth.user.id
print flag
print team
challenge = 'f_chal' + str(flag)
print challenge
row = db(db.auth_user.id == team).select().first()
db.auth_user.challenge.writable=True
print row
row.challenge = True
row.update_record()
db.commit()


On Sunday, 19 May 2013 22:38:48 UTC-4, Chris Teodorski wrote:
>
> I will try my best here to explain what I'm after -- I'm clueless on how 
> to do it.  I added a custom field to db.auth_user called team_name.  Each 
> registered user should have a unique team name.  
>
> In a seperate table, I have a team name and a list of challenges, 
> 1,2,3,etc.I want the team name of this table to reference the team_name 
> in auth_user.  I've tried several different variations -- but each time I 
> seem to either hang web2py or I get "keyed tables can only reference 
> other keyed tables".
>  
> my additions to auth_user look like 
> this: auth.settings.extra_fields['auth_user'] = [Field('team_name')]
> my other table definition looks like this at the moment -- but I've tried 
> other ways:
> db.define_table('t_teams',
> Field('name', db.auth_user.team_name),
> Field('f_chal1', type='boolean',
>   label=T('Chal1')),
> Field('f_chal2', type='boolean',
>   label=T('Chal2')),
> Field('f_chal3', type='boolean',
>   label=T('Chal3')),
> Field('f_chal4', type='boolean',
>   label=T('Chal4')),
>
> Thanks again for all the help.
>
> Chris
>
>
>
>

-- 

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




Re: [web2py] Re: How to force Auth module to disable Password encryption!

2013-05-23 Thread Vinicius Assef
Good point, Anthony.

I didn't remember the password was encrypted in a validator.

Shame on me, guys. ;-)


On Thu, May 23, 2013 at 4:29 PM, Anthony  wrote:
> After auth.define_tables(), I think:
>
> db.auth_user.password.requires = None  # or some other validator, such as
> IS_STRONG()
>
> should do it. By default, the password field has a CRYPT() validator, which
> does the hashing -- this would remove/replace that validator.
>
> However, this is not a good practice. I can see why you might initially want
> to have the plain text of temporary passwords to distribute, but once a user
> logs in and updates the password, why do you continue to need the plain text
> of the updated password?
>
> Anthony
>
> On Thursday, May 23, 2013 4:44:52 AM UTC-4, Ahmad Faiyaz wrote:
>>
>> Hello,
>> I am new on web2py. I am using it to develop a Programming Contest
>> Management system. Now on a ONSITE Programming Contest , we have to
>> distribute username and password printed on paper. So i have implemented a
>> function which will generate user accounts automatically then print the
>> passwords on a PDF. Web2py uses encrpytion to store the password, which is
>> not retrievable. Now i can have a different table to store the passwords,
>> but when i use use Auth to modify the password, i will be unable to update
>> my own table. What to do now ? How i can disable encryption on auth_user
>> table ? Can anyone help !!
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

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




[web2py] Re: Referencing auth_user custom field in another table

2013-05-23 Thread Anthony

>
> auth.user.challenge.writable=True 


First, you're working with the wrong object there. auth.user is just a Row 
object holding the db.auth_user record of the current logged in user. It's 
keys/attributes hold values, not DAL Fields -- so it doesn't make sense to 
set "writable" attributes on them. Instead, you probably want to work with 
the db.auth_user table and its fields. Actually, given that the error 
message refers to a Table object, I assume you did use db.auth_user in the 
real code and the above is a typo.

Second, in Python, you can't use variables to access attributes of objects 
via dot syntax as above. In general, you would use the getattr() function 
for that:

getattr(db.auth_user, challenge).writable = True

However, in this case, db.auth_user is a Table object, and its fields can 
be accessed like a dictionary:

db.auth_user[challenge].writable = True

You'll have the same problem with the subsequent row.challenge, which 
should instead be row[challenge] (note, a Row object also acts like a 
dictionary).

A couple other problems. First, there isn't actually any need to set the 
writable attribute of the challenge field -- that attribute only determines 
whether the field is made writable in SQLFORM's, which you are not using 
here -- it doesn't affect inserts and updates done outside of forms, as in 
this case. Second, there is no need to first retrieve the record and then 
update the field value -- instead, just do a direct update:

db(db.auth_user.id == team).update(**{challenge: True})

Note, because the field name is in a variable, we have to update using a 
dictionary constructed via the {} notation (for more details, see 
here
).

Another method is:

db.auth_user(team) = {challenge: True}

Anthony

-- 

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




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Matt
Thanks for your response.

Unfortunately that example isn't quite the same as how json is processed 
from the body in main.py. I.e. it's using cStringIO I think. 

I can put together an example that highlights this I guess.

On Friday, May 24, 2013 12:53:14 PM UTC+12, Jonathan Lundell wrote:
>
> On 23 May 2013, at 5:35 PM, Matt > wrote:
>
> Hi there,
>
> I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
> mac, Python 2.7.2, no external JSON library installed.
>
> Sending the following data via PUT, application/json; charset=UTF-8:
>
> {"id": 3}
>
> results in a JSON parser error occurring at main.py:
>
> if is_json:
> try:
> logging.info('before') <--- my addition
> json_vars = sj.load(body)
> logging.info('after') <--- my addition
> body.seek(0)
> except Exception, e: <--- my addition
> logging.exception(e) <--- my addition
> # incoherent request bodies can still be parsed "ad-hoc"
> json_vars = {}
> pass
> # update vars and get_vars with what was posted as json
> request.get_vars.update(json_vars)
> request.vars.update(json_vars)
>
> INFO 2013-05-24 00:07:21,100 main.py:337] before
> INFO 2013-05-24 00:07:21,100 main.py:338]  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'>
> ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
> decoded
> Traceback (most recent call last):
>   File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
> json_vars = sj.load(body)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  
> line 278, in load
> **kw)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  
> line 326, in loads
> return _default_decoder.decode(s)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  
> line 366, in decode
> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  
> line 384, in raw_decode
> raise ValueError("No JSON object could be decoded")
>
> Appears to be related to the id() function for some reason, as changing 
> the attribute name to anything other than "id" works fine. 
>
> Help on built-in function id in module __builtin__:
>
> id(...)
>
> id(object) -> integer
>
> Return the identity of an object.  This is guaranteed to be unique 
> among
> simultaneously existing objects.  (Hint: it's the object's memory
> address.)
>
> If I explicitly force it to use contrib.simplejson. i.e. change the top of 
> main.py
>
> try:
> import simplejson as sj #external installed library
> except:
> try:
> import contrib.simplejson as sj #pure python library <--- Pasted.
> except:
> import contrib.simplejson as sj #pure python library
>
> I get the same result.
>
> Any ideas?
>
>
> FWIW, json.loads('{"id": 3}') works fine.
>
> I'd try logging body.read() before the json.load call, and see what json 
> is actually getting. You could follow that with body.seek(0) if you want, 
> but since it's going to crash anyway...
>

-- 

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




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Jonathan Lundell
On 23 May 2013, at 7:52 PM, Matt  wrote:
> Thanks for your response.
> 
> Unfortunately that example isn't quite the same as how json is processed from 
> the body in main.py. I.e. it's using cStringIO I think. 

Right. That's why I think it'd be useful to see what body.read()  returns 
(reading the cStringIO stream).

> 
> I can put together an example that highlights this I guess.
> 
> On Friday, May 24, 2013 12:53:14 PM UTC+12, Jonathan Lundell wrote:
> On 23 May 2013, at 5:35 PM, Matt  wrote:
>> Hi there,
>> 
>> I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
>> mac, Python 2.7.2, no external JSON library installed.
>> 
>> Sending the following data via PUT, application/json; charset=UTF-8:
>> 
>> {"id": 3}
>> 
>> results in a JSON parser error occurring at main.py:
>> 
>> if is_json:
>> try:
>> logging.info('before')   <--- my addition
>> json_vars = sj.load(body)
>> logging.info('after')<--- my addition
>> body.seek(0)
>> except Exception, e: <--- my addition
>> logging.exception(e) <--- my addition
>> # incoherent request bodies can still be parsed "ad-hoc"
>> json_vars = {}
>> pass
>> # update vars and get_vars with what was posted as json
>> request.get_vars.update(json_vars)
>> request.vars.update(json_vars)
>> 
>> INFO 2013-05-24 00:07:21,100 main.py:337] before
>> INFO 2013-05-24 00:07:21,100 main.py:338] > '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'>
>> ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be decoded
>> Traceback (most recent call last):
>>   File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
>> json_vars = sj.load(body)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>>  line 278, in load
>> **kw)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>>  line 326, in loads
>> return _default_decoder.decode(s)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>>  line 366, in decode
>> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>>  line 384, in raw_decode
>> raise ValueError("No JSON object could be decoded")
>> 
>> Appears to be related to the id() function for some reason, as changing the 
>> attribute name to anything other than "id" works fine. 
>> 
>> Help on built-in function id in module __builtin__:
>> 
>> id(...)
>> 
>> id(object) -> integer
>> 
>> Return the identity of an object.  This is guaranteed to be unique among
>> simultaneously existing objects.  (Hint: it's the object's memory
>> address.)
>> 
>> If I explicitly force it to use contrib.simplejson. i.e. change the top of 
>> main.py
>> 
>> try:
>> import simplejson as sj #external installed library
>> except:
>> try:
>> import contrib.simplejson as sj #pure python library <--- Pasted.
>> except:
>> import contrib.simplejson as sj #pure python library
>> 
>> I get the same result.
>> 
>> Any ideas?
>> 
> 
> FWIW, json.loads('{"id": 3}') works fine.
> 
> I'd try logging body.read() before the json.load call, and see what json is 
> actually getting. You could follow that with body.seek(0) if you want, but 
> since it's going to crash anyway...
> 
> -- 
>  



-- 

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




[web2py] Re: third party modules installation

2013-05-23 Thread Massimo Di Pierro
This is fine. Just use the web2py source distribution, not the web2py 
windows binary.

On Wednesday, 22 May 2013 22:31:37 UTC-5, gthwang5 wrote:
>
> Hi, 
>
> I am currently hosting my site that I'm developing from my Windows 8 
> machine. 
>
> I have my python installed in my computer at c:\python27\ and all the 
> libraries get installed to c:\python27\site-packages I believe.
>
> According to the web2py doc, it says in order to use third party modules, 
> I need to install the module again straight into my web2py/site-packages 
> folder.
>
> However, this seems impossible because easy-install just keeps installing 
> to c:\python27\site-packages.
>
> Is there a solution? Thanks
>

-- 

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




[web2py] Re: Pandas installation

2013-05-23 Thread Massimo Di Pierro
Install python source and install the pandas libraries as you normally 
would (pip., easy_install)

On Wednesday, 22 May 2013 22:55:22 UTC-5, gthwang5 wrote:
>
> How do install Pandas on web2py?

-- 

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




[web2py] Re: Issues with rendering wiki in html.

2013-05-23 Thread Massimo Di Pierro
I think you submitted a patch one. Do you stil have it?

On Thursday, 23 May 2013 12:28:06 UTC-5, Alan Etkin wrote:
>
> On a general note (for future consideration),   it is useful to have some 
>> records in markmin and others in html.  To achieve this I think we really 
>> need to add a 'render_type' field to accompany the raw data.  Then we can 
>> really mix it up.
>>
>  
> I have suggested the same here (without mixing html/markmin):
>
> https://groups.google.com/d/msg/web2py-developers/smnu-k7G6iE/EV3CdD_j3nEJ
>
>

-- 

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




[web2py] Re: Postgres users beware auth.signature is_active; bad problem, easy to fix

2013-05-23 Thread Massimo Di Pierro
This is a backward compatibility issues. The fact that it inserts a 't' 
instead of a 'T' is more of a concern to me. How was the query built?

The source clearly says:
   TRUE = 'T'
   FALSE = 'F'

On Thursday, 23 May 2013 16:21:18 UTC-5, Cliff Kachinske wrote:
>
> auth.signature appends a "boolean" field called is_active to a table.  The 
> default is True.
>
> Under the covers it's not really boolean, it's char(1).  When you insert a 
> record, is_active is set to "t".  That's right, a lowercase t.
>
> Today I had the kind of problem where queries were missing records.  It 
> turns out that the DAL was emitting queries looking for 'T' in is_active.
>
> The queries were missing records because Postgres is case sensitive in 
> char fields.  
>
> I don't really understand why the dal adapters for Postgres transmogrify 
> boolean fields to char(1) when Postgres supports boolean fields.  The nice 
> thing about that is Postgres boolean fields do not care about case.
>
> The easy fix for this problem is make sure that any fields you have 
> defined as boolean in your models are also boolean in Postgres.
>

-- 

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




[web2py] Re: BUG in JSON parsing in main.py

2013-05-23 Thread Massimo Di Pierro
Please open a ticket about this.

On Thursday, 23 May 2013 19:35:08 UTC-5, Matt wrote:
>
> Hi there,
>
> I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
> mac, Python 2.7.2, no external JSON library installed.
>
> Sending the following data via PUT, application/json; charset=UTF-8:
>
> {"id": 3}
>
> results in a JSON parser error occurring at main.py:
>
> if is_json:
> try:
> logging.info('before') <--- my addition
> json_vars = sj.load(body)
> logging.info('after') <--- my addition
> body.seek(0)
> except Exception, e: <--- my addition
> logging.exception(e) <--- my addition
> # incoherent request bodies can still be parsed "ad-hoc"
> json_vars = {}
> pass
> # update vars and get_vars with what was posted as json
> request.get_vars.update(json_vars)
> request.vars.update(json_vars)
>
> INFO 2013-05-24 00:07:21,100 main.py:337] before
> INFO 2013-05-24 00:07:21,100 main.py:338]  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'>
> ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
> decoded
> Traceback (most recent call last):
>   File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
> json_vars = sj.load(body)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  
> line 278, in load
> **kw)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>  
> line 326, in loads
> return _default_decoder.decode(s)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  
> line 366, in decode
> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>  
> line 384, in raw_decode
> raise ValueError("No JSON object could be decoded")
>
> Appears to be related to the id() function for some reason, as changing 
> the attribute name to anything other than "id" works fine. 
>
> Help on built-in function id in module __builtin__:
>
> id(...)
>
> id(object) -> integer
>
> Return the identity of an object.  This is guaranteed to be unique 
> among
> simultaneously existing objects.  (Hint: it's the object's memory
> address.)
>
> If I explicitly force it to use contrib.simplejson. i.e. change the top of 
> main.py
>
> try:
> import simplejson as sj #external installed library
> except:
> try:
> import contrib.simplejson as sj #pure python library <--- Pasted.
> except:
> import contrib.simplejson as sj #pure python library
>
> I get the same result.
>
> Any ideas?
>
> Thanks in advance,
> Matt
>

-- 

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




[web2py] Mismatch between code in tickets and controller

2013-05-23 Thread Alex Heyden
I've been using Web2Py successfully for this project since about September. 
Recently, I restarted the server because something in the process had my 
CPU pegged to 100%. Since then, I've been unable to update my controller 
file. I normally upload my updated code to the server and run a script to 
move the new controller file into place and copy the old one away for safe 
keeping. This didn't seem to do anything for me because the tickets that 
Web2Py is generating still show the old code, so I tried the online editor. 
My updated code was there. I changed some single quotes to double quotes 
and saved the file, but the tickets still show the old code. I've tried 
updating and restarting the server. Any suggestions?

Thanks in advance!

-- 

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




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

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

> Basic authentication won't do anything with the session -- it requires
> sending the credentials on every request -- probably not what's desired
> here. Instead, the very next section in the book may help:
> http://www.web2py.com/book/default/chapter/09#Manual-Authentication. You
> can post the login credentials via Ajax and then use auth.login_bare() to
> handle the login.
>
> Anthony
>
> On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:
>>
>> You did read the book before you asked, yes?
>>
>> http://www.web2py.com/book/**default/chapter/09#Access-**
>> Control-and-Basic-**Authentication
>>
>> On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:
>>>
>>> Is there a way of using a pure Ajax request to web2py authentication and
>>> create a session for a successfully logged in user?
>>>
>>> --
>>> ..**..**
>>> ...
>>> Teddy Lubasi Nyambe
>>> Opensource Zambia
>>> Lusaka, ZAMBIA
>>>
>>> Cell: +260 97 7760473
>>> website: http://www.opensource.org.zm
>>>
>>> ~/
>>> Human Knowledge belongs to the world! - AntiTrust
>>>
>>> Man is a tool-using animal. Without tools he is nothing, with tools he
>>> is all - Thomas Carlyle 1795-1881
>>>
>>> /~
>>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




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

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

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

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

> Of course read the book, auth.login_bare() manages my sessions
> automatically? Will check it out thanx
> On 23 May 2013 20:09, "Anthony"  wrote:
>
>> Basic authentication won't do anything with the session -- it requires
>> sending the credentials on every request -- probably not what's desired
>> here. Instead, the very next section in the book may help:
>> http://www.web2py.com/book/default/chapter/09#Manual-Authentication. You
>> can post the login credentials via Ajax and then use auth.login_bare() to
>> handle the login.
>>
>> Anthony
>>
>> On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:
>>>
>>> You did read the book before you asked, yes?
>>>
>>> http://www.web2py.com/book/**default/chapter/09#Access-**
>>> Control-and-Basic-**Authentication
>>>
>>> On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:

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

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

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

 ~/
 Human Knowledge belongs to the world! - AntiTrust

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

 /~

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

-- 

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




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

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

> Why I asked cause a 2 months or so Massimo contributed to a similar thread
> and this is what he wrote:
>
> Should we offer something like {{=auth.ajax_login()}} helper which submits
> to /user/login? If would not be difficult to write.
> How should it work?
>
> The guy who hd asked a question on pure Ajax login had used
> auth.login_bare() and from my assessment he seemed to hv challenges with it.
> On 24 May 2013 05:46, "Teddy Nyambe"  wrote:
>
>> Of course read the book, auth.login_bare() manages my sessions
>> automatically? Will check it out thanx
>> On 23 May 2013 20:09, "Anthony"  wrote:
>>
>>> Basic authentication won't do anything with the session -- it requires
>>> sending the credentials on every request -- probably not what's desired
>>> here. Instead, the very next section in the book may help:
>>> http://www.web2py.com/book/default/chapter/09#Manual-Authentication.
>>> You can post the login credentials via Ajax and then use auth.login_bare()
>>> to handle the login.
>>>
>>> Anthony
>>>
>>> On Thursday, May 23, 2013 1:39:13 PM UTC-4, Derek wrote:

 You did read the book before you asked, yes?

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

 On Thursday, May 23, 2013 9:49:21 AM UTC-7, software.ted wrote:
>
> Is there a way of using a pure Ajax request to web2py authentication
> and create a session for a successfully logged in user?
>
> --
> ..**..**
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he
> is all - Thomas Carlyle 1795-1881
>
> /~
>
  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>

-- 

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




[web2py] handle request.args string value contain a space

2013-05-23 Thread 黄祥
hi folks,

is there anyone know how to handle request.args string value contain a 
space?

e.g.
models/menu.py
if request.controller=='default':
response.menu = [
(T('Home'), False, URL('default', 'index'), []),
]

services = db(db.service).select(orderby=db.service.id)
services_menu = [] 
for service in services: 
services_menu.append((T(service.title), False, 
   URL('default', 'service', 
args=service.title)))

response.menu += [
(T('Service'), False, None, services_menu) 
]

controllers/default.py
def service():
row=db.service(db.service.title==request.args(0)) or 
redirect(URL('index'))
return dict(row=row)

code above is work fine, only if the request.args(0) value doesn't contain 
a space, but if contain a space it become checkmate, lol. any 
recommendation, solution or advice how to solve this?

thank you very much before

-- 

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




[web2py] Re: BUG in JSON parsing in main.py

2013-05-23 Thread Matt
Have figured it out now.

I'm using the restful decorator to expose some web services.

In the example given in the book it shows:

@request.restful()
def api():
response.view = 'generic.json'
def GET(tablename,id):
if not tablename=='person': raise HTTP(400)
return dict(person = db.person(id))
def POST(tablename,**fields):
if not tablename=='person': raise HTTP(400)
return db.person.validate_and_insert(**fields)
return locals()


Now the subtle error here is that if you name one of your variables "id" it 
will cause errors when the decorator executes this action. It evidently 
invokes the id function somehow. Leading to some very weird problems.

i.e.

def PUT(id, **vars):
   logging.info(vars)  <-- Vars would be None.

The fix was to do this instead:

def PUT(client_id, **vars):
   logging.info(vars)  <--- Vars would be the expected translated JSON.
   
Perhaps the book could be updated to reflect this.

Thanks for your help,
Matt

On Friday, May 24, 2013 3:08:06 PM UTC+12, Massimo Di Pierro wrote:
>
> Please open a ticket about this.
>
> On Thursday, 23 May 2013 19:35:08 UTC-5, Matt wrote:
>>
>> Hi there,
>>
>> I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
>> mac, Python 2.7.2, no external JSON library installed.
>>
>> Sending the following data via PUT, application/json; charset=UTF-8:
>>
>> {"id": 3}
>>
>> results in a JSON parser error occurring at main.py:
>>
>> if is_json:
>> try:
>> logging.info('before') <--- my addition
>> json_vars = sj.load(body)
>> logging.info('after') <--- my addition
>> body.seek(0)
>> except Exception, e: <--- my addition
>> logging.exception(e) <--- my addition
>> # incoherent request bodies can still be parsed "ad-hoc"
>> json_vars = {}
>> pass
>> # update vars and get_vars with what was posted as json
>> request.get_vars.update(json_vars)
>> request.vars.update(json_vars)
>>
>> INFO 2013-05-24 00:07:21,100 main.py:337] before
>> INFO 2013-05-24 00:07:21,100 main.py:338] > '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'>
>> ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
>> decoded
>> Traceback (most recent call last):
>>   File "/Projects/www/app/gluon/main.py", line 340, in parse_get_post_vars
>> json_vars = sj.load(body)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>>  
>> line 278, in load
>> **kw)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
>>  
>> line 326, in loads
>> return _default_decoder.decode(s)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>>  
>> line 366, in decode
>> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
>>  
>> line 384, in raw_decode
>> raise ValueError("No JSON object could be decoded")
>>
>> Appears to be related to the id() function for some reason, as changing 
>> the attribute name to anything other than "id" works fine. 
>>
>> Help on built-in function id in module __builtin__:
>>
>> id(...)
>>
>> id(object) -> integer
>>
>> Return the identity of an object.  This is guaranteed to be unique 
>> among
>> simultaneously existing objects.  (Hint: it's the object's memory
>> address.)
>>
>> If I explicitly force it to use contrib.simplejson. i.e. change the top 
>> of main.py
>>
>> try:
>> import simplejson as sj #external installed library
>> except:
>> try:
>> import contrib.simplejson as sj #pure python library <--- Pasted.
>> except:
>> import contrib.simplejson as sj #pure python library
>>
>> I get the same result.
>>
>> Any ideas?
>>
>> Thanks in advance,
>> Matt
>>
>

-- 

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




[web2py] how to link a custom form to a python method

2013-05-23 Thread gthwang5

Hi,  I am a complete web2py noob, so sorry in advance for a potentially 
dumb question. 

*I am trying to create a simple form that has three fields. StartDate, 
EndDate, Symbol*

When I click submit button, I have a python function that 

   - takes these three variables 
   - creates a table ( *no database* query done ) 
   - returns the table to the view

Typically, I would just link a javascript function to the button, call 
$.get, and then create a table on the fly. 

In web2py framework, how do you get a form to call my python function, and 
retrieve a table? Do I still
need javascript? Note: I am not trying to use the form helper function 
because I feel is too restrictive,
and plus the form that it produces does not look good. In addition, the doc 
doesn't specify a) how to 
create a form with multiple fields (not using sqlfactory) b) and *how to 
link a form to a python method *
*or a call. *

-- 

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




[web2py] weird module function call behavior

2013-05-23 Thread gthwang5
I have the following class called "a"

*a.py  *

class  A:

def B ( self, var ):
return var

in my *default.py*

import a

def index():

form = SQLFORM(db.parameters)
datatable = ""

if form.process().accepted:
   datatable = a.A().B("hello world")

return dict(datatable)

*I get the following error: *
 B() takes exactly 1 argument (2 given)

What could be going on here? After two hours I still don't get why B() 
isn't called as it's supposed to be..

-- 

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