[web2py] nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Marian
...but I cannot get it to work. As soon as I start the service via the 
service console, it terminates without an error code. It tried 32/64 bit 
version of nssm, w and w/o quotes for the paths. In procexp I see that the 
python.exe is started but it terminates immediately.

pythonw.exe without AppParameters crashes, python.exe works, but as soon as 
I try an AppParameter like -K APPNAME, it crashes.
I tried python2.7.3 with win32 and also ActiveState Python 2.7.3

Maybe somebody is kind and posts some screenshots of the registry settings 
of a working nssm scheduler service. :)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] web2py with ExtJS - advice required on restructing

2013-04-05 Thread at

HI,

Started working on a project where the team is already working on using 
extjs to develop the views. Each view of web2py application is basically an 
ExtJS application. They've placed extjs library in 
web2py/applications/app/static /extjs and created an extjs_views folder in 
web2py/applications/app/static to place .js files.

I think extjs is not a good choice for developing web2py app views? but 
since they already have invested enough on the project, need an expert 
advice on how should we restructure the whole application in a way that we 
could utilize existing development in extjs.

Thanks  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] jqwidgets and web2py

2013-04-05 Thread puercoespin
Do you know jqwidgets from www.jqwidgets.com? That's a superb jquery based 
widgets, than i think may be included in web2py.

There are a commercial licence, but you can use jQWidgets for free under 
the Creative Commons Attribution-NonCommercial 3.0 
Licensehttp://creativecommons.org/licenses/by-nc/3.0/
.

What do you think?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] jqwidgets and web2py

2013-04-05 Thread António Ramos
and about this one?
http://www.jeasyui.com/index.php


2013/4/5 puercoespin jzaragoza.puercoes...@gmail.com

 Do you know jqwidgets from www.jqwidgets.com? That's a superb jquery
 based widgets, than i think may be included in web2py.

 There are a commercial licence, but you can use jQWidgets for free under
 the Creative Commons Attribution-NonCommercial 3.0 
 Licensehttp://creativecommons.org/licenses/by-nc/3.0/
 .

 What do you think?

 --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and 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: nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Marian
I dug around in the event log and found:

Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for 
service web2py_scheduler_imagecontest4 in C:\Python27\.

Program C:\Python27\pythonw.exe for service web2py_scheduler_imagecontest4 
exited with return code 1.

Killing process tree of process 7296 for service 
web2py_scheduler_imagecontest4 with exit code 1

The scheduler works when used directly with python.

-- 

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




[web2py] REF: Matplotlib Image

2013-04-05 Thread Teddy Nyambe
I have the following code:

fig = plt.figure(1, figsize=(6,6))
ax = fig.add_axes([0.1,0.1,0.8,0.8])

labels = 'Female', 'Male'

fracs = [50,50]

ax.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)
 image_folder=os.path.join(request.folder, 'static/tmp/')
fig.savefig('%stest.png' % image_folder)
return dict(mp_list=mp_list, image_folder= '/init/static/tmp/test.png')

The problem is that the image keeps on being overeritten when i change the
fracs. How do i create a new image each time i refresh the page?

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

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

~/
Human Knowledge belongs to the world! - AntiTrust

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

/~

-- 

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




[web2py] Re: options_std.py/options.py breaks as-is on web2py 2.4.5 + a question

2013-04-05 Thread wprins
Can someone confirm whether the issue with options_std.py/options.py is 
worth filing a bug about?  It may be trivial but it seems unnecessarily 
broken.

Walter

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Niphlod
As soon as I get home I'll make screenshot of the configs  I hadn't any 
problems a few months back, but I'll recheck for sure and post here or on 
web2pyslices.com the steps involved.

On Friday, April 5, 2013 11:34:30 AM UTC+2, Marian wrote:

 I dug around in the event log and found:

 Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for 
 service web2py_scheduler_imagecontest4 in C:\Python27\.

 Program C:\Python27\pythonw.exe for service web2py_scheduler_imagecontest4 
 exited with return code 1.

 Killing process tree of process 7296 for service 
 web2py_scheduler_imagecontest4 with exit code 1

 The scheduler works when used directly with python.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another scheduler Q

2013-04-05 Thread Niphlod
what db are you using ?

On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca wrote:

 i have this setup: 

 2 severs with the same web2py  app installed, each of then run a 
 scheluder worker 

 the problem is that only one of then get jobs, and in 
 db.scheluder_worker the one with do all the work is the only with true 
 in is_ticker field, i just the 2 of em cooperate and pickup the 
 available jobs. 

 P.D: got them in diferent's groups and randomly assing task to the 
 groups. 

 -- 
 Yoel Benítez Fonseca 
 Tel: 573400 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] 'str' object has no attribute 'year' with 2 or more datetime validators

2013-04-05 Thread Daniel González
Hi everyone,

I have noticed that i cannot use 2 or more datetime validators on the
same field.

I'm building a SCRUM project management app. Making the sprints module I
need to validate that a new sprint is inside the project date range, and
at the same time, the sprint doesn't overlaps with other sprints.
So I was using IS_DATETIME_IN_RANGE to check that the date is inside of
the project date range, and made a copy called IS_NOT_DATETIME_IN_RANGE
that I apply at execution time to check that the new sprint is not
inside the range of other sprints.

Trying to do this, I get this error:

  File applications/openmywork/modules/omw/core/model/tableinterface.py, line 
118, in form
return SQLFORM(self.table, record=row_id, _id=form_id)
  File /home/demetrio/devel/web2py_2.3.2/gluon/sqlhtml.py, line 1036, in 
__init__
default = field.formatter(default)
  File /home/demetrio/devel/web2py_2.3.2/gluon/dal.py, line 8723, in formatter
value = item.formatter(value)
  File /home/demetrio/devel/web2py_2.3.2/gluon/validators.py, line 2243, in 
formatter
year = value.year
AttributeError: 'str' object has no attribute 'year'



It seems that the first time that a date validato is executed, it
formats to str, so in the second validator, it cannot recognice it.

Is there any way to make this validation using web2py validators at
execution time?

thanks in advance.
Daniel

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: web2py Talk

2013-04-05 Thread Francisco Costa
also this one: 
http://www.slideshare.net/blackthorne/web2pyweb-development-like-a-boss

On Thursday, April 4, 2013 11:56:20 AM UTC+1, Francisco Costa wrote:

 Hi,

 I'm going to give a briefly presentation about web2py this Saturday: 
 https://tymr.com/event/encontro-python-pt-6-abril-2013-porto/515c6f2a03d36d409716741e

 Are there any great slides/presentations out there that I can use or get 
 inspiration from?

 Francisco Costa
 https://tymr.com


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Marian
That would be awesome. Thanks for the great work! :)

On Friday, April 5, 2013 12:46:36 PM UTC+2, Niphlod wrote:

 As soon as I get home I'll make screenshot of the configs  I hadn't 
 any problems a few months back, but I'll recheck for sure and post here or 
 on web2pyslices.com the steps involved.

 On Friday, April 5, 2013 11:34:30 AM UTC+2, Marian wrote:

 I dug around in the event log and found:

 Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for 
 service web2py_scheduler_imagecontest4 in C:\Python27\.

 Program C:\Python27\pythonw.exe for service 
 web2py_scheduler_imagecontest4 exited with return code 1.

 Killing process tree of process 7296 for service 
 web2py_scheduler_imagecontest4 with exit code 1

 The scheduler works when used directly with python.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] Problem with form.process().accepted ?

2013-04-05 Thread Nguyen Minh Tuan
Hi! I'm newbie with web2py.
I do tutorial in FORM chapter

Model 

db.define_table('person', Field('personname', 'string', requires = 
IS_NOT_EMPTY()))

Controller :

def index():
form = SQLFORM(db.person)

if form.process().accepted:
session.flash = accepted
redirect('default', 'list')
else:
response.flash = input info

return dict(form = form)

View :
--
{{=form}}

When I submit form with empty value (person name), validation does not work.
When I submit form with value, form does not redirect to page I expected.
Can anyone give me ideas?

Thanks,
Tuan.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: web2py Talk

2013-04-05 Thread Alan Etkin


 also this one: 
 http://www.slideshare.net/blackthorne/web2pyweb-development-like-a-boss


And Bruno Rocha's work:

Slides (Demistificando web2py)
http://www.slideshare.net/rochacbruno/desmistificando-web2py-tdc2011

Video (IDE, pra que?)
http://vimeo.com/26387038
 
Perhaps you need to check the license for ways of using it in your own work.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: scheduler init script

2013-04-05 Thread Niphlod
that's the one in the header comments on the scheduler.py itself.
Given that upstart is present in your ubuntu version it's definitely the 
shortest way (and simple, also) to run a service.

On Thursday, April 4, 2013 11:57:01 PM UTC+2, Yoel Benitez Fonseca wrote:

 i have found this script in the web: 


  /etc/init/web2py-scheluder.conf  
 description web2py task scheduler 
 start on (local-filesystems and net-device-up IFACE=eth0) 
 stop on shutdown 

 respawn 
 exec sudo -u www-data python /home/www-data/web2py/web2py.py -K myapp 
 == 

 Is this the best way in ubuntu ? 

 Is necessary some aditional parameters to respawn ? 
 -- 
 Yoel Benítez Fonseca 
 Tel: 573400 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Marian
Hm maybe I have a hint, I found a failed entry in db.scheduler_run:

gluon.shell line 137: sys.exit(1).

When I try to restart the service, I don't get new failed tasks, so I 
cannot say where this specific one came from.




On Friday, April 5, 2013 1:36:37 PM UTC+2, Marian wrote:

 That would be awesome. Thanks for the great work! :)

 On Friday, April 5, 2013 12:46:36 PM UTC+2, Niphlod wrote:

 As soon as I get home I'll make screenshot of the configs  I hadn't 
 any problems a few months back, but I'll recheck for sure and post here or 
 on web2pyslices.com the steps involved.

 On Friday, April 5, 2013 11:34:30 AM UTC+2, Marian wrote:

 I dug around in the event log and found:

 Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for 
 service web2py_scheduler_imagecontest4 in C:\Python27\.

 Program C:\Python27\pythonw.exe for service 
 web2py_scheduler_imagecontest4 exited with return code 1.

 Killing process tree of process 7296 for service 
 web2py_scheduler_imagecontest4 with exit code 1

 The scheduler works when used directly with python.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Problem with form.process().accepted ?

2013-04-05 Thread Anthony


 redirect('default', 'list')


Should be:

redirect(URL('default', 'list'))

When I submit form with empty value (person name), validation does not work.


What do you mean it doesn't work? Do you not see the error message on the 
form? What do you expect, and what happens instead? It works when I try the 
code? 

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: web2py with ExtJS - advice required on restructing

2013-04-05 Thread LightDot
It's hard to answer this without knowing what are the application goals and 
what are the issues you're facing. So... what exactly is a problem with the 
current approach? What would you like to achieve by restructuring?

Regards,
Ales

On Friday, April 5, 2013 8:45:28 AM UTC+2, at wrote:


 HI,

 Started working on a project where the team is already working on using 
 extjs to develop the views. Each view of web2py application is basically an 
 ExtJS application. They've placed extjs library in 
 web2py/applications/app/static /extjs and created an extjs_views folder in 
 web2py/applications/app/static to place .js files.

 I think extjs is not a good choice for developing web2py app views? but 
 since they already have invested enough on the project, need an expert 
 advice on how should we restructure the whole application in a way that we 
 could utilize existing development in extjs.

 Thanks  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] Re: how to send bulk emails with web2py

2013-04-05 Thread ctrlSoft
Amazon Simple Email Service (Amazon SES)
http://aws.amazon.com/ses/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Hi,

i have a problem.

In my models/db.py file i have this code: 

auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
default=False),
   Field('company_id', 'reference 
companies', requires=IS_IN_DB(db,db.companies.id))]

In my models/companies/comanies.py file i have:

db.define_table('companies',
Field('name', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  label=LABEL(T(Naziv), _for=companies_name)),
Field('url_sufix', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  unique=True,
  label=LABEL(T(Url-sufix), _for=companies_url_sufix
)),
Field('logo', 'upload',
  label=LABEL(T(Logo), _for=companies_logo)),
Field('deleted', 'boolean'))

I am receiving an error saying: 
type 'exceptions.AttributeError' 'DAL' object has no attribute 'companies'

What is 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: auth.settings.extra_fields

2013-04-05 Thread ctrlSoft
models are executed in alphabetical order. db.py and after that 
companies.py, you make reference to a non define table. you sould define 
companies table right after auth = Auth(db) and before auth.settings.
extra_fields['auth_user'] =
auth = Auth(db)
#
#
#
#
db.define_table('companies',
Field('name', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  label=LABEL(T(Naziv), _for=companies_name)),
Field('url_sufix', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  unique=True,
  label=LABEL(T(Url-sufix), _for=companies_url_sufix
)),
Field('logo', 'upload',
  label=LABEL(T(Logo), _for=companies_logo)),
Field('deleted', 'boolean'))


auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
default=False),
   Field('company_id', 'reference 
companies', requires=IS_IN_DB(db,db.companies.id))]


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] RadioWidget ignoring formstyle?

2013-04-05 Thread Leonel Câmara
Hey,

I was hoping someone could help me understand what I'm doing wrong.

For some reason, in my SQLFORM.factory created form, even though I had 
specified formstyle='divs'  and everything else was inside divs, my radio 
buttons were still being rendered inside a table.

Which I found odd since in sqlhtml.RadioWidget code one can see:

#widget style
wrappers = dict(
table=(TABLE, TR, TD),
ul=(DIV, UL, LI),
divs=(CAT, DIV, DIV)
)
parent, child, inner = wrappers[attributes.get('style', 'table')]

On closer inspection the attributes to the widget were always going empty. 
After losing a bit of time trying to understand why, I decided to do this 
hammertime style code

from functools import partial  # HAMMERTIME!
divs_radio_widget = partial(SQLFORM.widgets.radio.widget, style='divs')

And this is what I used as a widget. Which solved the problem, of course, 
but I would like to know why isn't the widget getting the style, is it by 
design or something I may be doing 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: auth.settings.extra_fields

2013-04-05 Thread Niphlod
the point is having that db.companies.id evaluated later .
you can pass a string to the is_in_db validator, it shouldn't raise the 
error

IS_IN_DB(db, 'companies.id', '%(name)s')

*should* work giving you a nice dropdown too.

On Friday, April 5, 2013 4:48:33 PM UTC+2, ctrlSoft wrote:

 models are executed in alphabetical order. db.py and after that 
 companies.py, you make reference to a non defined table. you sould define 
 companies table  before auth.settings.extra_fields['auth_user'] =
 auth = Auth(db)
 #
 #
 #
 #
 db.define_table('companies',
 Field('name', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   label=LABEL(T(Naziv), _for=companies_name)),
 Field('url_sufix', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   unique=True,
   label=LABEL(T(Url-sufix), _for=
 companies_url_sufix)),
 Field('logo', 'upload',
   label=LABEL(T(Logo), _for=companies_logo)),
 Field('deleted', 'boolean'))


 auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
 default=False),
Field('company_id', 'reference 
 companies', requires=IS_IN_DB(db,db.companies.id))]

 in db.py


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Thanks guys,

right now my db.py looks like this:

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()

db.define_table('companies',
Field('name', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  label=LABEL(T(Naziv), _for=companies_name)),
Field('url_sufix', 'string',
  required=True,
  requires=IS_NOT_EMPTY(),
  unique=True,
  label=LABEL(T(Url-sufix), 
_for=companies_url_sufix)),
Field('logo', 'upload',
  label=LABEL(T(Logo), _for=companies_logo)),
Field('deleted', 'boolean'))


auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
default=False),
   Field('company_id', 'reference 
companies', requires=IS_IN_DB(db, db.companies.id, '%(name)s'))]

## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

Is there any way i could have my companies definition in 
/companies/companies.py but still do this.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: auth.settings.extra_fields

2013-04-05 Thread Niphlod
Nope.
when auth definition is encountered, if you want to use db.companies.id 
written as it is, db.define_table('companies') should have been executead 
already.
You need to change your IS_IN_DB call to (db, 'companies.id', '%(name)s') 
... notice the ticks around companies.id, it's a string
When you do it that way, the db.companies table will be called not at 
models definition time, but at the time the page is rendered (so, 
allowing all the models to be executed before -- having at your 
disposition the companies table)

On Friday, April 5, 2013 5:11:32 PM UTC+2, Domagoj Kovač wrote:

 Thanks guys,

 right now my db.py looks like this:

 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 db.define_table('companies',
 Field('name', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   label=LABEL(T(Naziv), _for=companies_name)),
 Field('url_sufix', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   unique=True,
   label=LABEL(T(Url-sufix), 
 _for=companies_url_sufix)),
 Field('logo', 'upload',
   label=LABEL(T(Logo), _for=companies_logo)),
 Field('deleted', 'boolean'))


 auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
 default=False),
Field('company_id', 'reference 
 companies', requires=IS_IN_DB(db, db.companies.id, '%(name)s'))]

 ## create all tables needed by auth if not custom tables
 auth.define_tables(username=False, signature=False)

 Is there any way i could have my companies definition in 
 /companies/companies.py but still do this.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: RadioWidget ignoring formstyle?

2013-04-05 Thread Niphlod
Hum. from the book 
...http://web2py.com/books/default/chapter/29/07#Widgets

Sometimes widgets take additional arguments and one needs to specify their 
values. In this case one can use lambda

db.mytable.myfield.widget = lambda field,value: 
SQLFORM.widgets.string.widget(field,value,_style='color:blue')

Widgets are helper factories and their first two arguments are always fieldand 
value. The other arguments can include normal helper attributes such as 
_style, _class, etc. Some widgets also take special arguments. In 
particular SQLFORM.widgets.radio and SQLFORM.widgets.checkboxes take a 
styleargument (not to be confused with 
_style) which can be set to table, ul, or divs in order to match the 
formstyle of the containing form.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] .select(db.table.ALL)

2013-04-05 Thread Annet
I have a question about db.table.ALL

In case of:

db(db.table1.id1).select(db.table1.ALL)

this:

db(db.table1.id1).select()

gives the same result.


In case of:

db((db.table1.id1)(db.table1.refID==db.table2.id)).select(db.table1.ALL,db.table2.ALL)

this:

db((db.table1.id1)(db.table1.refID==db.table2.id)).select()

also gives the same result, however, the moment I replace ALL with a field 
name, I no longer get ALL fields from table2

db((db.table1.id1)(db.table1.refID==db.table2.id)).select(db.table1.id)


Is this correct, and can I leave out the .ALL expression when I need all 
the fields from the joined tables, or
does ALL have a function in this case?


Kind regards,

Annet

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] pre populated SQLFORM.FACTORY does not submit because of upload field

2013-04-05 Thread António Ramos
hello, i´m using a sqlform.factory to edit a record.

The form is prepopulated using this code


row=db((db.trabalhador.id==request.args(0))).select().first()

if row:
for field in row:
if field in db.trabalhador.fields:

print setting -,row[field] , on ,field
db.trabalhador[field].default=row[field]


one of the fields is a required upload field.

The rest of the code
form=SQLFORM.factory(db.trabalhador,db.t_docs,
submit_button=Gravar,

fields=['nome','bi','ncart','ncartval','rfid','apt_medica','apt_medicaval','val_formacao','f_doc'],
table_name='trabalhador',
upload=URL('download')
)
empresa=request.vars['id'] or empresa
extra_but = TR(DIV(A(I(_name='but',_class='icon-camera icon-white'),'
Tirar foto',_class=btn btn-primary,_id =but)))
extra_fp_url = TR(DIV(INPUT(_name='fp_url',_type='hidden',_id='fpurl')))
extra_Aptidao = TR(DIV(A(I(_name='but',_class='icon-file icon-white'),'
',_class=btn btn-primary),_onclick=location.href='+URL(f='download',
args=form.vars.apt_medica)+'))
form[0].insert(-4,extra_Aptidao)
form[0].insert(-1,extra_but)
form[0].insert(-1,extra_fp_url)

 if form.process().accepted:
print accepted form to save or update
print form.vars



When i edit a record i see the upload file. But if i do not change the
upload and save the record i get the error asking me to add the upload file.

I need some help on this.
Thank you

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: .select(db.table.ALL)

2013-04-05 Thread Niphlod
recap:
- db.table1.ALL is just a shortcut to db.table1.field1, db.table1.field2, 
db.table1.field3, etc etc etc
- select() without arguments selects all fields for all tables involved.
- if you pass something explicit to select() , you get just what you asked 
for

tl;dr : exactly what you observed.

ALL is useful, e.g., when you need all fields of table1 but only some 
fields of table2.

Instead of doing 
select(*db.table1.field1, db.table1.field2, db.table1.field3, 
db.table1.field4, db.table1.field5, *
   *db.table2.field1, db.table2.field2* 
)
you can do
select(*db.table1.ALL*, *db.table2.field1, db.table2.field2*)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: auth.settings.extra_fields

2013-04-05 Thread Domagoj Kovač
Thanks man!

On Friday, April 5, 2013 5:30:38 PM UTC+2, Niphlod wrote:

 Nope.
 when auth definition is encountered, if you want to use 
 db.companies.idwritten as it is, db.define_table('companies') should have 
 been executead 
 already.
 You need to change your IS_IN_DB call to (db, 'companies.id', '%(name)s') 
 ... notice the ticks around companies.id, it's a string
 When you do it that way, the db.companies table will be called not at 
 models definition time, but at the time the page is rendered (so, 
 allowing all the models to be executed before -- having at your 
 disposition the companies table)

 On Friday, April 5, 2013 5:11:32 PM UTC+2, Domagoj Kovač wrote:

 Thanks guys,

 right now my db.py looks like this:

 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 db.define_table('companies',
 Field('name', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   label=LABEL(T(Naziv), _for=companies_name)),
 Field('url_sufix', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   unique=True,
   label=LABEL(T(Url-sufix), 
 _for=companies_url_sufix)),
 Field('logo', 'upload',
   label=LABEL(T(Logo), _for=companies_logo)),
 Field('deleted', 'boolean'))


 auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
 default=False),
Field('company_id', 'reference 
 companies', requires=IS_IN_DB(db, db.companies.id, '%(name)s'))]

 ## create all tables needed by auth if not custom tables
 auth.define_tables(username=False, signature=False)

 Is there any way i could have my companies definition in 
 /companies/companies.py but still do this.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: .select(db.table.ALL)

2013-04-05 Thread Annet
Hi,

Thanks for your answer, I just wasn't sure I could leave out the .ALL, now 
I know for sure ...


Annet

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: .select(db.table.ALL)

2013-04-05 Thread Anthony
Note, .ALL is also useful when you don't want to specify any query:

db().select(db.mytable.ALL)

That will give you all the records and all the fields in db.mytable. If you 
do specify a query, then calling .select() with no fields is equivalent to 
using .ALL.

Anthony

On Friday, April 5, 2013 12:58:16 PM UTC-4, Annet wrote:

 Hi,

 Thanks for your answer, I just wasn't sure I could leave out the .ALL, now 
 I know for sure ...


 Annet


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: auth.settings.extra_fields

2013-04-05 Thread Anthony
Note, simply doing (db, 'companies.id', ...) may not completely resolve the 
problem. Even doing that, the db.companies table is only getting defined 
conditionally when the companies controller is called, but the 
db.auth_user table is defined on every request, and it could be used by 
other controllers. If the auth_user table links to another table, it may be 
a good idea to make sure that other table is defined whenever the auth_user 
table is defined (i.e., maybe move the db.companies table definition into 
db.py or some other model that isn't conditionally executed).

Anthony

On Friday, April 5, 2013 11:30:38 AM UTC-4, Niphlod wrote:

 Nope.
 when auth definition is encountered, if you want to use 
 db.companies.idwritten as it is, db.define_table('companies') should have 
 been executead 
 already.
 You need to change your IS_IN_DB call to (db, 'companies.id', '%(name)s') 
 ... notice the ticks around companies.id, it's a string
 When you do it that way, the db.companies table will be called not at 
 models definition time, but at the time the page is rendered (so, 
 allowing all the models to be executed before -- having at your 
 disposition the companies table)

 On Friday, April 5, 2013 5:11:32 PM UTC+2, Domagoj Kovač wrote:

 Thanks guys,

 right now my db.py looks like this:

 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 db.define_table('companies',
 Field('name', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   label=LABEL(T(Naziv), _for=companies_name)),
 Field('url_sufix', 'string',
   required=True,
   requires=IS_NOT_EMPTY(),
   unique=True,
   label=LABEL(T(Url-sufix), 
 _for=companies_url_sufix)),
 Field('logo', 'upload',
   label=LABEL(T(Logo), _for=companies_logo)),
 Field('deleted', 'boolean'))


 auth.settings.extra_fields['auth_user'] = [Field('deleted', 'boolean', 
 default=False),
Field('company_id', 'reference 
 companies', requires=IS_IN_DB(db, db.companies.id, '%(name)s'))]

 ## create all tables needed by auth if not custom tables
 auth.define_tables(username=False, signature=False)

 Is there any way i could have my companies definition in 
 /companies/companies.py but still do this.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Just knew about Server-Sent Events and want to share it with you

2013-04-05 Thread Paolo Caruccio
Well, I just tested version 2.4.5 Stable ts 2013.04.04.21.10.38 and all 
worked for me. What issue have you encountered?
Anyway, the code was and is experimental (for example it doesn't work on 
IE).

If do you want something more tested please try comet messaging included in 
web2py as Derek suggested in an other thread.

Il giorno venerdì 5 aprile 2013 02:26:23 UTC+2, Arnon Marcus ha scritto:

 Can you post the actual files? The w2p can't be imported to the latest 
 web2py...

 Also, some questions:

 1. The way I understand this, an implementation would be via a 
 controller-action that receives the event-stream-request, then responds 
 with a 200 OK and that MIME thing, to affirm the connection. But from 
 that point onward, new responses should be sent over the same open 
 connection. How is the response-object being generated and sent without a 
 request? How does it know where to send it to?

 2. I would like to make a shared-collaborative view for multiple users, 
 that any changed done by one, is reflected automatically in all the others. 
 How would I go about doing that? Since web2py executes on each request, I 
 would have to hold connection-data of all open-connections, in some 
 semi-persistent location - would I have to use some 
 external/internal caching? Is there some automatic session-saving already 
 built-in web2py that can be useful?


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: any good open courses with web2py?

2013-04-05 Thread jjg0
Hi Massimo,

This class looks really interesting.  Do you have any more information on 
what types of projects you typically have students complete, what skill 
level you are expecting students to reach after completing the course, 
maybe a syllabus?  For example do you try to gear your course towards 
getting students ready to start looking for jobs or is this more of a 
lighter intro to get students started?  

As I mentioned before, I'd prefer not to have to pay for a full college 
course with credits and since I work full time I was hoping for something a 
little more self paced.  Have you ever considered setting up some sort of 
alternative for non students to go through at their own pace without grades 
or college credits?  Like something similar to the courses on sites like 
Udemy or Udacity? If this course is the only option, just out of curiosity 
how close are you to hitting your min of 7 interested people?

Thanks,

Jeremiah

On Thursday, April 4, 2013 8:27:40 PM UTC-4, Massimo Di Pierro wrote:

 I was supposed to teach one spring but I did not advertise and 
 was canceled. If there are at least 7 people committed it can still be 
 offered:
 http://www.cdm.depaul.edu/ipd/Programs/Pages/WebDevelopmentwithPython.aspx



 On Thursday, 4 April 2013 18:30:19 UTC-5, Arnon Marcus wrote:

 http://www.youtube.com/playlist?list=PL978B2CE2D788F745

 nJoy! :)



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] Article: Frameworks Round 2

2013-04-05 Thread David Marko
http://www.techempower.com/blog/2013/04/05/frameworks-round-2/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca

El 5.4.2013 6:47 am, Niphlod escribió:

what db are you using ?


postgres, is the same database shared between servers



On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca wrote:


i have this setup:

2 severs with the same web2py  app installed, each of then run a
scheluder worker

the problem is that only one of then get jobs, and in
db.scheluder_worker the one with do all the work is the only with 
true

in is_ticker field, i just the 2 of em cooperate and pickup the
available jobs.

P.D: got them in diferent's groups and randomly assing task to the
groups.

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

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

To unsubscribe from this group and 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: another scheduler Q

2013-04-05 Thread Niphlod
this is the second time the issue is posted and yet I can't find a way to 
reproduce it It's true that I'm running two scheduler processes on the 
same machine vs one scheduler on on machine and the other on another 
separate one, but as far as the assign algorithm is concerned, as long as 
there are two scheduler_workers rows, nothing should change.
Just as a proof, can you confirm that when you start two schedulers on the 
same server you observe the same behaviour ? 

On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel Benitez Fonseca wrote:

 El 5.4.2013 6:47 am, Niphlod escribió: 
  what db are you using ? 

 postgres, is the same database shared between servers 

  
  On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca wrote: 
  
  i have this setup: 
  
  2 severs with the same web2py  app installed, each of then run a 
  scheluder worker 
  
  the problem is that only one of then get jobs, and in 
  db.scheluder_worker the one with do all the work is the only with 
  true 
  in is_ticker field, i just the 2 of em cooperate and pickup the 
  available jobs. 
  
  P.D: got them in diferent's groups and randomly assing task to the 
  groups. 
  
  -- 
  Yoel Benítez Fonseca 
  Tel: 573400 
  

 -- 
 Yoel Benítez Fonseca 
 Tel: 573400 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] Web2py CAS auth.username does not exist. Multiple application with one CAS provider.

2013-04-05 Thread joe smith

I am trying to create a single web2py server with multiple applications 
that each use a single CAS provider to handle user authentication. I keep 
running into a wall when it comes to getting the applications to work with 
the CAS. In particular I get an error from the consumer app that 
auth.username table does not exist. In all my applications I user 
auth.define_tables with username=False and it still tries to look for a 
username. This is true even if all .tables are deleted and reconstructed. I 
read on other posts that copying the .tables from the provider app to the 
consumer app will solve the problem. This does fix it, but is that the best 
solution? It seems to me that it should not be looking for auth.username? 
Any help is appreciated. I am providing an example with two applications 
one a CAS provider, the other a consumer. Only the db.py files have been 
modified from the original scaffold. I am using Web2py2.3.2 (2012-12-17 
15:03:30), Postgres 9.1
The error:*

class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42703', 
'column auth_user.username does not exist') Version  web2py™ (2, 3, 2, 
datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')  Python Python 2.7.3: 
C:\Python27\python.exe  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.

Traceback (most recent call last):
  File C:\wrk\PD\admingui\trunk\gluon\restricted.py, line 212, in restricted
exec ccode in environment
  File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
77, in module
  File C:\wrk\PD\admingui\trunk\gluon\globals.py, line 193, in lambda
self._caller = lambda f: f()
  File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
39, in user
return dict(form=auth())
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1240, in __call__
return getattr(self, args[0])()
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 2090, in login
table_user._filter_fields(cas_user))
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1714, in 
get_or_create_user
user = table_user(**{fieldname: value})
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 7769, in __call__
return self._db(query).select(limitby=(0,1),for_update=for_update, 
orderby=orderby).first()
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 8905, in select
return adapter.select(self.query,fields,attributes)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1631, in select
return self._select_aux(sql,fields,attributes)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1596, in _select_aux
self.execute(sql)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1709, in execute
return self.log_execute(*a, **b)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1703, in log_execute
ret = self.cursor.execute(*a, **b)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 246, in 
_fn
return fn(self, *args, **kwargs)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 317, in 
execute
self._execute(operation, args)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 322, in 
_execute
self.cursor.execute(new_query, *new_args)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 398, 
in execute
self._stmt = PreparedStatement(self.connection, query, statement_name=, 
*[{type: type(x), value: x} for x in args])
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 138, 
in __init__
self._parse_row_desc = self.c.parse(self._statement_name, statement, types)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 943, 
in _fn
return fn(self, *args, **kwargs)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 1104, 
in parse
return reader.handle_messages()
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 929, 
in handle_messages
raise exc
ProgrammingError: ('ERROR', '42703', 'column auth_user.username does not exist')




*My Provider Code:*

# -*- coding: utf-8 -*-

#
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#

if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
#db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db = DAL('postgres://postgres:password@localhost/mydatabase', 
pool_size=1, check_reserved=['all'])
session.connect(request, response, db = db, masterapp = None) 
else:
## connect 

[web2py] Web2py CAS auth.username does not exist. Multiple applications, one CAS provider.

2013-04-05 Thread joe smith
I am writing a number of Web2py applications. The base CAS application is 
an administration system to keep track of users, organizations, groups, 
etc. That part is working fine, but now I want to add additional 
applications that use this administration system as a CAS provider. I have 
been trying to get things to work properly for a week or so without having 
a nice solution. I am using a single Postgres database and trying to use 
the CAS to authenticate. It seems that when I try to use the CAS provider 
from one of the applications I get an error:

class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42703', 
'column auth_user.username does not exist') Version  web2py™ (2, 3, 2, 
datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')  Python Python 2.7.3: 
C:\Python27\python.exe  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.

Traceback (most recent call last):
  File C:\wrk\PD\admingui\trunk\gluon\restricted.py, line 212, in restricted
exec ccode in environment
  File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
77, in module
  File C:\wrk\PD\admingui\trunk\gluon\globals.py, line 193, in lambda
self._caller = lambda f: f()
  File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
39, in user
return dict(form=auth())
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1240, in __call__
return getattr(self, args[0])()
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 2090, in login
table_user._filter_fields(cas_user))
  File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1714, in 
get_or_create_user
user = table_user(**{fieldname: value})
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 7769, in __call__
return self._db(query).select(limitby=(0,1),for_update=for_update, 
orderby=orderby).first()
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 8905, in select
return adapter.select(self.query,fields,attributes)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1631, in select
return self._select_aux(sql,fields,attributes)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1596, in _select_aux
self.execute(sql)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1709, in execute
return self.log_execute(*a, **b)
  File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1703, in log_execute
ret = self.cursor.execute(*a, **b)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 246, in 
_fn
return fn(self, *args, **kwargs)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 317, in 
execute
self._execute(operation, args)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 322, in 
_execute
self.cursor.execute(new_query, *new_args)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 398, 
in execute
self._stmt = PreparedStatement(self.connection, query, statement_name=, 
*[{type: type(x), value: x} for x in args])
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 138, 
in __init__
self._parse_row_desc = self.c.parse(self._statement_name, statement, types)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 943, 
in _fn
return fn(self, *args, **kwargs)
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 1104, 
in parse
return reader.handle_messages()
  File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 929, 
in handle_messages
raise exc
ProgrammingError: ('ERROR', '42703', 'column auth_user.username does not exist')

Can anyone tell me the correct way of integrating multiple applications to 
use a single CAS provider. I have been through all the forum posts and book 
examples. I am always getting table conflicts. In this case it is looking 
for auth.username. But in all applications including this one I have 
auth.define_tables(username=False), but it still looks for it.

Here is my db.py file for cas_provider:


# -*- coding: utf-8 -*-

#
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#

if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
#db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db = DAL('postgres://postgres:password@localhost/mydatabase', pool_size=1, 
check_reserved=['all'])
session.connect(request, response, db = db, masterapp = None) 
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = 

Re: [web2py] Re: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca

El 5.4.2013 2:57 pm, Niphlod escribió:
this is the second time the issue is posted and yet I can't find a way 
to
reproduce it It's true that I'm running two scheduler processes on 
the

same machine vs one scheduler on on machine and the other on another
separate one, but as far as the assign algorithm is concerned, as 
long as

there are two scheduler_workers rows, nothing should change.
Just as a proof, can you confirm that when you start two schedulers on 
the

same server you observe the same behaviour ?


somehow I solved it:

On each server the worker is started with a different group name and 
each task is assigned to a group name randomly chosen from those 
reported in the database:


with n server start the workers like this:

server1: python /home/www-data/web2py/web2py.py -K myapp  # group name 
main

server2: python /home/www-data/web2py/web2py.py -K myapp:srv2
server3: python /home/www-data/web2py/web2py.py -K myapp:srv3
...
serverN: python /home/www-data/web2py/web2py.py -K myapp:srvN


for a group name at random from the available:

def get_groups_names():
rows = db(db.scheduler_worker.id  
0).select(db.scheduler_worker.group_names).as_list()

mylist = []
for row in rows: mylist.extend(row['group_names'])
tmp = set(mylist) #make it a set

return [item for item in tmp]

and to assign a task to a group:

...
scheduler.queue_task(some_task,
  ...,
  group_name=random.choice(get_groups_names())
)
...

After doing that, the WORKERS started working without problems and 
tasks are not waiting if there are WORKERS idle.



On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel Benitez Fonseca wrote:


El 5.4.2013 6:47 am, Niphlod escribió:

what db are you using ?


postgres, is the same database shared between servers



On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca 
wrote:


i have this setup:

2 severs with the same web2py  app installed, each of then run a
scheluder worker

the problem is that only one of then get jobs, and in
db.scheluder_worker the one with do all the work is the only with
true
in is_ticker field, i just the 2 of em cooperate and pickup the
available jobs.

P.D: got them in diferent's groups and randomly assing task to the
groups.

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

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

To unsubscribe from this group and 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: Article: Frameworks Round 2

2013-04-05 Thread Derek
I've said in the past that they were unfair to Ruby because they were using 
their ruby server in dev mode which recompiles code on every access.

This time, I looked more closely at their 'Flask' setup. They are running 
Flask via gunicorn, so you'd think all is good. However, they aren't 
setting the 'worker type'. That means it's the default worker type, which 
is 'sync'. In other words, it's the same as vanilla python. They should 
have set it up with 'gevent' or 'eventlet'. And what do you know, they are 
running it in development mode as well. Flag 'preload' needs to be True in 
order for it to not recompile on every access. 

So, their setup as it is now, can handle exactly 8 requests at once, and it 
recompiles code at every run. No wonder it's slow. Nobody in their right 
mind would deploy their app that way.
With my changed setup, they could handle theoretically 8000 requests at 
once, and it does not recompile at every run.

I've submitted a 'pull request'.


On Friday, April 5, 2013 11:43:42 AM UTC-7, David Marko wrote:

 http://www.techempower.com/blog/2013/04/05/frameworks-round-2/


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Article: Frameworks Round 2

2013-04-05 Thread Derek
I'd also add that it's debatable whether using gunicorn's 'jsonify' is any 
better than json.dumps(). They had to add a shim in to make jsonify work. 
jsonify adds the correct header for json, whereas json.dumps doesn't. I'd 
expect the database performance to take a hit in this setup because of 
their shim, but not by much.

On Friday, April 5, 2013 12:41:47 PM UTC-7, Derek wrote:

 I've said in the past that they were unfair to Ruby because they were 
 using their ruby server in dev mode which recompiles code on every access.

 This time, I looked more closely at their 'Flask' setup. They are running 
 Flask via gunicorn, so you'd think all is good. However, they aren't 
 setting the 'worker type'. That means it's the default worker type, which 
 is 'sync'. In other words, it's the same as vanilla python. They should 
 have set it up with 'gevent' or 'eventlet'. And what do you know, they are 
 running it in development mode as well. Flag 'preload' needs to be True in 
 order for it to not recompile on every access. 

 So, their setup as it is now, can handle exactly 8 requests at once, and 
 it recompiles code at every run. No wonder it's slow. Nobody in their right 
 mind would deploy their app that way.
 With my changed setup, they could handle theoretically 8000 requests at 
 once, and it does not recompile at every run.

 I've submitted a 'pull request'.


 On Friday, April 5, 2013 11:43:42 AM UTC-7, David Marko wrote:

 http://www.techempower.com/blog/2013/04/05/frameworks-round-2/



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: nssm scheduler seems to be a nobrainer...

2013-04-05 Thread Niphlod
that should be it 
http://www.web2pyslices.com/slice/show/1614/nssm-webserver-and-scheduler-as-services-in-windows-oses

On Friday, April 5, 2013 2:35:15 PM UTC+2, Marian wrote:

 Hm maybe I have a hint, I found a failed entry in db.scheduler_run:

 gluon.shell line 137: sys.exit(1).

 When I try to restart the service, I don't get new failed tasks, so I 
 cannot say where this specific one came from.




 On Friday, April 5, 2013 1:36:37 PM UTC+2, Marian wrote:

 That would be awesome. Thanks for the great work! :)

 On Friday, April 5, 2013 12:46:36 PM UTC+2, Niphlod wrote:

 As soon as I get home I'll make screenshot of the configs  I hadn't 
 any problems a few months back, but I'll recheck for sure and post here or 
 on web2pyslices.com the steps involved.

 On Friday, April 5, 2013 11:34:30 AM UTC+2, Marian wrote:

 I dug around in the event log and found:

 Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for 
 service web2py_scheduler_imagecontest4 in C:\Python27\.

 Program C:\Python27\pythonw.exe for service 
 web2py_scheduler_imagecontest4 exited with return code 1.

 Killing process tree of process 7296 for service 
 web2py_scheduler_imagecontest4 with exit code 1

 The scheduler works when used directly with python.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another scheduler Q

2013-04-05 Thread Niphlod
I get that if you manually force them to pick tasks from different groups 
they are processed, but different schedulers with the same group name 
should receive the same amount of tasks anyway.

On Friday, April 5, 2013 9:17:23 PM UTC+2, Yoel Benitez Fonseca wrote:

 El 5.4.2013 2:57 pm, Niphlod escribió: 
  this is the second time the issue is posted and yet I can't find a way 
  to 
  reproduce it It's true that I'm running two scheduler processes on 
  the 
  same machine vs one scheduler on on machine and the other on another 
  separate one, but as far as the assign algorithm is concerned, as 
  long as 
  there are two scheduler_workers rows, nothing should change. 
  Just as a proof, can you confirm that when you start two schedulers on 
  the 
  same server you observe the same behaviour ? 

 somehow I solved it: 

 On each server the worker is started with a different group name and 
 each task is assigned to a group name randomly chosen from those 
 reported in the database: 

 with n server start the workers like this: 

 server1: python /home/www-data/web2py/web2py.py -K myapp  # group name 
 main 
 server2: python /home/www-data/web2py/web2py.py -K myapp:srv2 
 server3: python /home/www-data/web2py/web2py.py -K myapp:srv3 
 ... 
 serverN: python /home/www-data/web2py/web2py.py -K myapp:srvN 


 for a group name at random from the available: 

 def get_groups_names(): 
  rows = db(db.scheduler_worker.id  
 0).select(db.scheduler_worker.group_names).as_list() 
  mylist = [] 
  for row in rows: mylist.extend(row['group_names']) 
  tmp = set(mylist) #make it a set 

  return [item for item in tmp] 

 and to assign a task to a group: 

 ... 
 scheduler.queue_task(some_task, 
..., 
group_name=random.choice(get_groups_names()) 
 ) 
 ... 

 After doing that, the WORKERS started working without problems and 
 tasks are not waiting if there are WORKERS idle. 

  On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel Benitez Fonseca wrote: 
  
  El 5.4.2013 6:47 am, Niphlod escribió: 
  what db are you using ? 
  
  postgres, is the same database shared between servers 
  
  
  On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca 
  wrote: 
  
  i have this setup: 
  
  2 severs with the same web2py  app installed, each of then run a 
  scheluder worker 
  
  the problem is that only one of then get jobs, and in 
  db.scheluder_worker the one with do all the work is the only with 
  true 
  in is_ticker field, i just the 2 of em cooperate and pickup the 
  available jobs. 
  
  P.D: got them in diferent's groups and randomly assing task to the 
  groups. 
  
  -- 
  Yoel Benítez Fonseca 
  Tel: 573400 
  
  
  -- 
  Yoel Benítez Fonseca 
  Tel: 573400 
  

 -- 
 Yoel Benítez Fonseca 
 Tel: 573400 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: any good open courses with web2py?

2013-04-05 Thread Derek
Post your code on github, link to it here, we could provide you a with a 
code review if that's what you're after.

On Thursday, April 4, 2013 6:37:15 AM UTC-7, jjg0 wrote:

 Are there any good self paced learning courses on webdev with web2py?  

 So far I am enjoying learning how to make websites with web2py.  I don't 
 mind spending a little money on courses or learning material, but I really 
 only do this as a hobby so I'm not interested in shelling out several grand 
 for courses that offer college credits, degrees, certificates, or any of 
 those intensive bootcamps.  Looking at other online courses offered that 
 aren't in web2py I see some really good ideas for projects I would like to 
 be able to build.  One site, for example, had a netflix clone as a final 
 project with ruby on rails, complete with commerce and everything you would 
 need.  Unfortunately the site was very expensive and not in web2py:(

 Playing around with php a while back before I found web2py I remember 
 following several teach yourself projects but found them to be incomplete.  
 For example, there were a lot of build a blog tutorials but the end result 
 was a form to enter blog entries and a page that grabbed entries from the 
 db and displayed them.  I didn't like this because the end result was a 
 blog you couldn't actually use, there was no search features, no tagging, 
 no commenting, no user auth, etc.

 I can build simple sites, so I'm not looking for an introductory course. 
 For example, the last site I made with web2py was for my friends school 
 with the following:
 -School information, schedules, location, instructors, etc
 -a blog like feature to post upcoming events. I posted links to only 
 future events on the front page. This behaved similar to a blog
 -a blog for the owner to blog about his school or whatever else he 
 wanted.  Had an archive dropdown menu, comments were working at one point 
 but disabled on request of the owner
 -2 forms for people to signup or ask questions. A pdf page can be 
 generated based on the information provided, and a link is emailed to the 
 owner.  I was originally going to just make a pdf and mail that to the 
 owner as an attachment, but I could never get that working

 This wasn't too hard to make, but I struggled on a few parts and my code 
 may not exactly be best practice.  It would be nice to find tutorials or 
 open courses I could follow with more challenging projects to get me making 
 more complicated sites and breaking any bad habits I may have picked up.  
 Any Suggestions?

 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: web2py with ExtJS - advice required on restructing

2013-04-05 Thread Derek
I'd suggest all the 'views' be placed in static. Your ExtJS should handle 
all the data. Add json services and let the ExtJS consume them. Note that 
you won't get form helpers or the security that web2py provides, but you 
get the authentication, DAL, automatic jsonifying and caching.


On Thursday, April 4, 2013 11:45:28 PM UTC-7, at wrote:


 HI,

 Started working on a project where the team is already working on using 
 extjs to develop the views. Each view of web2py application is basically an 
 ExtJS application. They've placed extjs library in 
 web2py/applications/app/static /extjs and created an extjs_views folder in 
 web2py/applications/app/static to place .js files.

 I think extjs is not a good choice for developing web2py app views? but 
 since they already have invested enough on the project, need an expert 
 advice on how should we restructure the whole application in a way that we 
 could utilize existing development in extjs.

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




Re: [web2py] Re: another scheduler Q

2013-04-05 Thread Niphlod
more on the matter this is the result of 600 queued tasks all in the 
main group, with two different schedulers started with -K appname, with 
postgresql

select assigned_worker_name, status, count(*) as howmany
from scheduler_task
group by assigned_worker_name, status

monster#4772;COMPLETED;285
monster#4751;COMPLETED;315

allright, they are not 300 and 300, but the more tasks they process the 
more the percentage gap will reduce, eventually being a close 50%-50%

On Friday, April 5, 2013 9:58:50 PM UTC+2, Niphlod wrote:

 I get that if you manually force them to pick tasks from different 
 groups they are processed, but different schedulers with the same group 
 name should receive the same amount of tasks anyway.

 On Friday, April 5, 2013 9:17:23 PM UTC+2, Yoel Benitez Fonseca wrote:

 El 5.4.2013 2:57 pm, Niphlod escribió: 
  this is the second time the issue is posted and yet I can't find a way 
  to 
  reproduce it It's true that I'm running two scheduler processes on 
  the 
  same machine vs one scheduler on on machine and the other on another 
  separate one, but as far as the assign algorithm is concerned, as 
  long as 
  there are two scheduler_workers rows, nothing should change. 
  Just as a proof, can you confirm that when you start two schedulers on 
  the 
  same server you observe the same behaviour ? 

 somehow I solved it: 

 On each server the worker is started with a different group name and 
 each task is assigned to a group name randomly chosen from those 
 reported in the database: 

 with n server start the workers like this: 

 server1: python /home/www-data/web2py/web2py.py -K myapp  # group name 
 main 
 server2: python /home/www-data/web2py/web2py.py -K myapp:srv2 
 server3: python /home/www-data/web2py/web2py.py -K myapp:srv3 
 ... 
 serverN: python /home/www-data/web2py/web2py.py -K myapp:srvN 


 for a group name at random from the available: 

 def get_groups_names(): 
  rows = db(db.scheduler_worker.id  
 0).select(db.scheduler_worker.group_names).as_list() 
  mylist = [] 
  for row in rows: mylist.extend(row['group_names']) 
  tmp = set(mylist) #make it a set 

  return [item for item in tmp] 

 and to assign a task to a group: 

 ... 
 scheduler.queue_task(some_task, 
..., 
group_name=random.choice(get_groups_names()) 
 ) 
 ... 

 After doing that, the WORKERS started working without problems and 
 tasks are not waiting if there are WORKERS idle. 

  On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel Benitez Fonseca wrote: 
  
  El 5.4.2013 6:47 am, Niphlod escribió: 
  what db are you using ? 
  
  postgres, is the same database shared between servers 
  
  
  On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca 
  wrote: 
  
  i have this setup: 
  
  2 severs with the same web2py  app installed, each of then run a 
  scheluder worker 
  
  the problem is that only one of then get jobs, and in 
  db.scheluder_worker the one with do all the work is the only with 
  true 
  in is_ticker field, i just the 2 of em cooperate and pickup the 
  available jobs. 
  
  P.D: got them in diferent's groups and randomly assing task to the 
  groups. 
  
  -- 
  Yoel Benítez Fonseca 
  Tel: 573400 
  
  
  -- 
  Yoel Benítez Fonseca 
  Tel: 573400 
  

 -- 
 Yoel Benítez Fonseca 
 Tel: 573400 



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another oracle question :(

2013-04-05 Thread Martin Barnard
Sorry for the delay.

My DAL code would ideally be something like this:

mems=[135123123,135123154,150012323]
rows=odb(odb.player_master.link_id.belongs(mems)).select()


This works, but I know if I scale up to a large list, as I eventually must, 
it will bring complaints  lockout from our oracle dba. The *lastsql* of 
DAL is like this:

SELECT  player_master.link_id, player_master.last_name, 
player_master.first_name 
FROM logismos.player_master WHERE (player_master.link_id IN (135123123,
135123154))


Browsing oracles 
websitehttp://www.oracle.com/technetwork/articles/dsl/prez-python-queries-101587.html,
 
I came across some info on using cx_oracle with bind queries. They have 
some examples:

 named_params = {'dept_id':50, 'sal':1000}
  query1 = cursor.execute('SELECT * FROM employees WHERE 
 department_id=:dept_id AND salary:sal', named_params)
  query2 = cursor.execute('SELECT * FROM employees WHERE 
 department_id=:dept_id AND salary:sal', dept_id=50, sal=1000) When using 
 named bind variables you can check the currently assigned ones using the 
 bindnames() method of the cursor:


  print cursor.bindnames()
 ['DEPT_ID', 'SAL']
 Passing by position is similar but you need to be careful about naming. 
 Variable names are arbitrary so it's easy to mess up queries this way. In 
 the example below, all three queries r1, r2, and r3 are equivalent. The 
 parameters variable must be given as a sequence.


  r1 = cursor.execute('SELECT * FROM locations WHERE country_id=:1 AND 
 city=:2', ('US', 'Seattle'))
  r2 = cursor.execute('SELECT * FROM locations WHERE country_id=:9 AND 
 city=:4', ('US', 'Seattle'))
  r3 = cursor.execute('SELECT * FROM locations WHERE country_id=:m AND 
 city=:0', ('US', 'Seattle'))
 When binding, you can first prepare the statement and then execute None 
 with changed parameters. Oracle will handle it as in the above case, 
 governed by the rule that one prepare is enough when variables are bound. 
 Any number of executions can be involved for prepared statements.


  cursor.prepare('SELECT * FROM jobs WHERE min_salary:min')
  r = cursor.execute(None, {'min':1000})
  print len(cursor.fetchall())


Any suggestions would be much appreciated.

Martin Barnard.


On Wednesday, April 3, 2013 6:22:28 AM UTC+3, Massimo Di Pierro wrote:

 What does the SQL look like?

 On Tuesday, 2 April 2013 20:44:40 UTC-5, Martin Barnard wrote:

 I have a list of ids [1,2,3,...,n] and I want to run a query on an oracle 
 table (using cx_oracle), but I have to use bind variables. Anybody know the 
 correct format before I start experimentation?

 Will I be forced to use db.executesql?

 Thanks,

 Martin Barnard



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: any good open courses with web2py?

2013-04-05 Thread Michael Herman
will this be an online class per chance for extended/adult students?

On Thursday, April 4, 2013 4:14:01 PM UTC-7, Luca wrote:

 I am considering teaching one such class in connection with UCSC in the 
 Fall of this year. 
 Luca

 On Thursday, April 4, 2013 6:37:15 AM UTC-7, jjg0 wrote:

 Are there any good self paced learning courses on webdev with web2py?  

 So far I am enjoying learning how to make websites with web2py.  I don't 
 mind spending a little money on courses or learning material, but I really 
 only do this as a hobby so I'm not interested in shelling out several grand 
 for courses that offer college credits, degrees, certificates, or any of 
 those intensive bootcamps.  Looking at other online courses offered that 
 aren't in web2py I see some really good ideas for projects I would like to 
 be able to build.  One site, for example, had a netflix clone as a final 
 project with ruby on rails, complete with commerce and everything you would 
 need.  Unfortunately the site was very expensive and not in web2py:(

 Playing around with php a while back before I found web2py I remember 
 following several teach yourself projects but found them to be incomplete.  
 For example, there were a lot of build a blog tutorials but the end result 
 was a form to enter blog entries and a page that grabbed entries from the 
 db and displayed them.  I didn't like this because the end result was a 
 blog you couldn't actually use, there was no search features, no tagging, 
 no commenting, no user auth, etc.

 I can build simple sites, so I'm not looking for an introductory course. 
 For example, the last site I made with web2py was for my friends school 
 with the following:
 -School information, schedules, location, instructors, etc
 -a blog like feature to post upcoming events. I posted links to only 
 future events on the front page. This behaved similar to a blog
 -a blog for the owner to blog about his school or whatever else he 
 wanted.  Had an archive dropdown menu, comments were working at one point 
 but disabled on request of the owner
 -2 forms for people to signup or ask questions. A pdf page can be 
 generated based on the information provided, and a link is emailed to the 
 owner.  I was originally going to just make a pdf and mail that to the 
 owner as an attachment, but I could never get that working

 This wasn't too hard to make, but I struggled on a few parts and my code 
 may not exactly be best practice.  It would be nice to find tutorials or 
 open courses I could follow with more challenging projects to get me making 
 more complicated sites and breaking any bad habits I may have picked up.  
 Any Suggestions?

 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: How to check if plain text password matches with encrypted password in auth_user.password?

2013-04-05 Thread Orrù

suppose password='12345' and db.auth_user.first_name=='Lucas'
so i find user by first_name,
row_user=db(db.auth_user.first_name=='Lucas').select().first()
and 
row_user.password='pbkdf2(1000,20,sha512)$97448b22487eca1d$dae65c0429430b7ae7bb311fed8e844b6a37ff30'

db.auth_user.password.validate('12345') == 
(db(db.auth_user.id==row_user.id).select ().first ().password, None) 
return False
CRYPT()('12345')==(row_user.password,None)
also returns false

where I am going wrong?

On Friday, December 21, 2012 11:12:26 PM UTC-2, Pearu Peterson wrote:

 Hi,

 I have a password in plain text and I want to check if it matches with the 
 crypted password in auth_user.password field.

 I have tried comparing auth_user.password with 
 str(db.auth_user.password.validate(plain_password)[0]) with no success even 
 when I know that the passwords match exactly.

 The problem seems to boil down to the fact that encryption of the same 
 string results different encrypted strings. For example,
  from gluon.validators import CRYPT, LazyCrypt
  crypt = CRYPT()
  str(LazyCrypt(crypt, 'mysecret'))
 
 'pbkdf2(1000,20,sha512)$a2a2ca127df6bc19$77bb5a3d129e2ce710daaefeefef8356c4c827ff'
  str(LazyCrypt(crypt, 'mysecret'))
 
 'pbkdf2(1000,20,sha512)$a555a267249876fb$bc18f82b72a3a5ebce617f32d6abaa5c48734ab9'

 What would be the correct way to check if passwords match when they are 
 given in encrypted form?

 Any hints are appreciated,
 Pearu



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] Windows Service fails with 2 ports on rocket server

2013-04-05 Thread Adham Hassan
I've found an issue where the Windows Service isn't working the same as the 
command line. I have an options file like this:

import socket
import os

interfaces = [('0.0.0.0',80),('0.0.0.0',443,'server.key','server.crt')]
password = 'testing123'
pid_filename = 'httpserver.pid'
log_filename = 'httpserver.log'
profiler_filename = None
ssl_certificate = 'server.crt'
ssl_private_key = 'server.key'
minthreads = None
maxthreads = None
server_name = socket.gethostname()
request_queue_size = 5
timeout = 30
shutdown_timeout = 5
folder = os.getcwd()
extcron = None
nocron = None

The following command line works, and I can browse by http port 80 and 
https port 443 with no problems:

python web2py.py -L options.py

However, after installing it as a windows service and trying to start it, 
it fails and my Event Viewer says:

Traceback (most recent call last):
  File C:\web2py\gluon\winservice.py, line 51, in SvcDoRun
self.start()
  File C:\web2py\gluon\winservice.py, line 122, in start
ip=options.ip,
AttributeError: 'module' object has no attribute 'ip'

If I add an IP address, it will then say:

Traceback (most recent call last):
  File C:\web2py\gluon\winservice.py, line 51, in SvcDoRun
self.start()
  File C:\web2py\gluon\winservice.py, line 123, in start
port=options.port,
AttributeError: 'module' object has no attribute 'port'

If I add a port, then it will override my 2 ports in instances, and only 
work on 1 port again. To get ssl to work I have to do go to the address 
https://servername:80

Is there any way to fix the windows service to act like the command line?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] web2py shell vs terminal shell

2013-04-05 Thread Michael Herman
i remember reading somewhere that it's better to use the built-in shell in 
web2py, but i can't find the article/post. anyone know (1) if it is 
better, and, (2)  if so, why?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] grid with left join example causes err keyword can't be an expression

2013-04-05 Thread Jurgis Pralgauskis


http://web2py.com/books/default/chapter/34/07#SQLFORM.grid-and-SQLFORM.smartgrid-(experimental)

I tried examples , and one of them gives err:


With SQLFORM.grid you can list all parents:

SQLFORM.grid(db.parent)

all children:

SQLFORM.grid(db.child)

and all parents and children in one table: 

*SQLFORM.grid(db.parent,left=db.child.on(db.child.parent=db.parent.id))  # this 
causes ERR: *

type 'exceptions.SyntaxError' keyword can't be an expression (default.py, 
line 46)Versionweb2py™(2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 
21))PythonPython 2.7.3: /usr/local/bin/uwsgi (prefix: /usr/local)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File /home/jurgis/web2py/gluon/restricted.py, line 211, in restricted
ccode = compile2(code, layer)
  File /home/jurgis/web2py/gluon/restricted.py, line 194, in compile2
return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File /home/jurgis/web2py/applications/smartgrid/controllers/default.py 
https://jurgis.pythonanywhere.com/admin/default/edit/smartgrid/controllers/default.py,
 line 46
grid = 
SQLFORM.grid(db.parent,left=db.child.on(db.child.parent=db.parent.id))
SyntaxError: keyword can't be an expression

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another oracle question :(

2013-04-05 Thread Niphlod
I really don't understand. 
The query shipped to your oracle instance will be exactly the same using 
DAL as the one using bind variables.

The DAL just does binding for you (in the 90% of the cases, better)

If you want to retrieve from a table all records in one query, and you have 
a large list of key values to filter it with, you can do it only with 
two syntaxes
either
select * from table where column in (1,2,3,4,5,6,)

or
select * from table 
where 
column = 1
or
column = 2
or
column = 3
or 
column = 4



Now, every database has its own query planning, but as far as I know Oracle 
responds better to the first one than the latter.
For the sake of completeness,  MSSQL is more fun  MSSQL 2000 to 2005 
without any SP performed better on the first, while 2005 sp2 to 2008 R2 
performs best with the latter ... Postgresql instead has similar times but 
from 8.4 to 9.1 there has been a steep improvement on it, etc etc etc

Binding with in won't get you where you want to go you have to 
prepare the in list as a pre-quoted string and pass that as a 
parameter, however, as I was saying, there will not be any difference on 
the query shipped to your db instance.

Same thing goes for the or method .

For the sake of completeness #2, in web2py should resemble similarly to
mems = [1,2,3,4,5, ...]
q = [] # list of conditions
for c in mems:
q.append[db.table1.field == c]
all_queries_in_or = reduce(lambda a,b: (a | b ), q)
result = db(all_queries_in_or).select()



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: grid with left join example causes err keyword can't be an expression

2013-04-05 Thread Niphlod
I'd say it's an error on the docs

*SQLFORM.grid(db.parent,left=db.child.on(db.child.parent=db.parent.id))  *

should be

*SQLFORM.grid(db.parent,left=db.child.on(db.child.parent==db.parent.id 
http://db.parent.id)) *


i.e. the condition must have two equal signs instead of one. 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] internship on web2py

2013-04-05 Thread Massimo Di Pierro
Anybody looking for an internship using web2py in the Philadelphia area?


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Windows Service fails with 2 ports on rocket server

2013-04-05 Thread Niphlod
I's say using nssm.exe will spare you some headaches.

It seems that there are a few errors in winservice.py

You can try to patch it.
self.server = main.HttpServer(
ip=options.ip,
port=options.port,
password=options.password,
pid_filename=options.pid_filename,
log_filename=options.log_filename,
profiler_filename=options.profiler_filename,
ssl_certificate=options.ssl_certificate,
ssl_private_key=options.ssl_private_key,
min_threads=options.minthreads,
max_threads=options.maxthreads,
server_name=options.server_name,
request_queue_size=options.request_queue_size,
timeout=options.timeout,
shutdown_timeout=options.shutdown_timeout,
path=options.folder,
*interfaces=options.interfaces*
)
additions in *bold*

and include
ip = '127.0.0.1'
port = 8000


in the config file. In theory, when *interfaces* is passed it should 
override whatever ip or port you pass


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: .sum() and .count() in grid?

2013-04-05 Thread Jurgis Pralgauskis


 You'll better code a view and access it as a fake table. 


are there examplses of this?

Is it possible to show virtual fields in grid (in appadmin they don't show 
up)?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: list:string type field is empty value on edit page

2013-04-05 Thread Massimo Di Pierro
No it is not. Something in the code must be resetting it.

On Thursday, 4 April 2013 22:13:25 UTC-5, 黄祥 wrote:

 hi,

 is it normal for list:string type field is empty when on editing page?

 e.g.
 db.define_table('contact',
 *Field('salutation'),*
 Field('first_name'),
 Field('last_name'),
 *Field('gender', 'list:string'),*
 Field('birthday', 'date'),
 Field('job_title'),
 Field('address', 'text'),
 Field('zip'),
 Field('city'),
 Field('country'),
 Field('phone'),
 Field('fax'),
 Field('email'),
 *Field('account', 'reference account'),*
 format='%(first_name)s %(last_name)s')

 *db.contact.salutation.requires=IS_IN_SET(['Mr.', 'Mrs.', 'Ms.'])*
 db.contact.first_name.requires=IS_NOT_EMPTY()
 db.contact.last_name.requires=IS_NOT_EMPTY()
 *db.contact.gender.requires=IS_IN_SET(['Male', 'Female'])*
 db.contact.job_title.requires=IS_NOT_EMPTY()
 db.contact.address.requires=IS_NOT_EMPTY()
 db.contact.zip.requires=IS_MATCH('^\d{5,5}$',
  error_message='not a zip code')
 db.contact.city.requires=IS_NOT_EMPTY()
 db.contact.country.requires=IS_NOT_EMPTY()
 db.contact.phone.requires=IS_NOT_EMPTY()
 db.contact.email.requires=[IS_EMAIL(), 
IS_NOT_IN_DB(db, 'contact.email')]
 *db.contact.account.requires=IS_IN_DB(db, db.account.id, 
 '%(account_name)s')*

 i make 3 different field type (bold) that contain drop down in the form 
 view. why the value is always empty for the list:string type when i'm on 
 the editing page? is it possible for not empty for list:string type in 
 editing page?
 any idea or explaination about this?

 thank you so 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: weired behaviour of matplotlib in web2py

2013-04-05 Thread Massimo Di Pierro
I have been using matplotlib and never seen this. What version of 
web2py/python/matplotlib?

On Friday, 5 April 2013 05:06:23 UTC-5, software.ted wrote:

 I have this code:

 import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt

 ## Graphs
 fig = plt.figure(1, figsize=(6,6))
 ax = fig.add_axes([0.1,0.1,0.8,0.8])

 labels = 'Female', 'Male'

 fracs = [90,10]
 explode=(0,0.05,0,0)

 ax.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)

 fig.savefig('test.png')


 in web2py the generated image keeps being update, when i change the fracs 
 the image is not recreated but its just update adding new sectors and 
 percentages. But the same code run on the command line when rerun it 
 recreates the image anew with new sector percentage...this is weired 
 behaviour, is there anything am missing out or i shoudl do in web2py

 This is how the image is being updated in web2py:

 [image: Inline image 1] 
 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

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

 ~/
 Human Knowledge belongs to the world! - AntiTrust

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

 /~ 


-- 

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




[web2py] Re: options_std.py/options.py breaks as-is on web2py 2.4.5 + a question

2013-04-05 Thread Massimo Di Pierro
Please do. Looks like a bug.

On Friday, 5 April 2013 05:37:17 UTC-5, wprins wrote:

 Can someone confirm whether the issue with options_std.py/options.py is 
 worth filing a bug about?  It may be trivial but it seems unnecessarily 
 broken.

 Edit: Never mind I see someone previously suggested I might file an issue 
 about this on another thread.  

 Walter


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: 'str' object has no attribute 'year' with 2 or more datetime validators

2013-04-05 Thread Massimo Di Pierro
I am very much interested in your project. Can you send some screenshots?

Anyway, the problem is that you are probably piping your validator to the 
normal one. Can I see your validator and how it is applied?

On Friday, 5 April 2013 06:23:39 UTC-5, demetrio wrote:

 Hi everyone, 

 I have noticed that i cannot use 2 or more datetime validators on the 
 same field. 

 I'm building a SCRUM project management app. Making the sprints module I 
 need to validate that a new sprint is inside the project date range, and 
 at the same time, the sprint doesn't overlaps with other sprints. 
 So I was using IS_DATETIME_IN_RANGE to check that the date is inside of 
 the project date range, and made a copy called IS_NOT_DATETIME_IN_RANGE 
 that I apply at execution time to check that the new sprint is not 
 inside the range of other sprints. 

 Trying to do this, I get this error: 

   File applications/openmywork/modules/omw/core/model/tableinterface.py, 
 line 118, in form 
 return SQLFORM(self.table, record=row_id, _id=form_id) 
   File /home/demetrio/devel/web2py_2.3.2/gluon/sqlhtml.py, line 1036, in 
 __init__ 
 default = field.formatter(default) 
   File /home/demetrio/devel/web2py_2.3.2/gluon/dal.py, line 8723, in 
 formatter 
 value = item.formatter(value) 
   File /home/demetrio/devel/web2py_2.3.2/gluon/validators.py, line 2243, 
 in formatter 
 year = value.year 
 AttributeError: 'str' object has no attribute 'year' 



 It seems that the first time that a date validato is executed, it 
 formats to str, so in the second validator, it cannot recognice it. 

 Is there any way to make this validation using web2py validators at 
 execution time? 

 thanks in advance. 
 Daniel 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: pre populated SQLFORM.FACTORY does not submit because of upload field

2013-04-05 Thread Massimo Di Pierro
Can you post a simpler example (including mode) to reproduce the problem? 
Looks like the field in the table has a validator which requires an upload.

On Friday, 5 April 2013 11:06:52 UTC-5, Ramos wrote:

 hello, i´m using a sqlform.factory to edit a record.

 The form is prepopulated using this code


 row=db((db.trabalhador.id==request.args(0))).select().first()

 if row:
 for field in row:
 if field in db.trabalhador.fields:

 print setting -,row[field] , on ,field 
 db.trabalhador[field].default=row[field]


 one of the fields is a required upload field.

 The rest of the code
 form=SQLFORM.factory(db.trabalhador,db.t_docs,
 submit_button=Gravar,
 
 fields=['nome','bi','ncart','ncartval','rfid','apt_medica','apt_medicaval','val_formacao','f_doc'],
 table_name='trabalhador',
 upload=URL('download')
 )
 empresa=request.vars['id'] or empresa
 extra_but = TR(DIV(A(I(_name='but',_class='icon-camera icon-white'),' 
 Tirar foto',_class=btn btn-primary,_id =but)))
 extra_fp_url = 
 TR(DIV(INPUT(_name='fp_url',_type='hidden',_id='fpurl')))
 extra_Aptidao = TR(DIV(A(I(_name='but',_class='icon-file 
 icon-white'),' ',_class=btn 
 btn-primary),_onclick=location.href='+URL(f='download', 
 args=form.vars.apt_medica)+'))
 form[0].insert(-4,extra_Aptidao) 
 form[0].insert(-1,extra_but)
 form[0].insert(-1,extra_fp_url)

  if form.process().accepted: 
 print accepted form to save or update
 print form.vars 



 When i edit a record i see the upload file. But if i do not change the 
 upload and save the record i get the error asking me to add the upload file.

 I need some help on this.
 Thank you


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Web2py CAS auth.username does not exist. Multiple applications, one CAS provider.

2013-04-05 Thread Massimo Di Pierro
If you use CAS you must change:

auth = Auth(db)

into

auth = Auth(db, username=True)


CAS requires a username.

On Friday, 5 April 2013 11:26:50 UTC-5, joe smith wrote:

 I am writing a number of Web2py applications. The base CAS application is 
 an administration system to keep track of users, organizations, groups, 
 etc. That part is working fine, but now I want to add additional 
 applications that use this administration system as a CAS provider. I have 
 been trying to get things to work properly for a week or so without having 
 a nice solution. I am using a single Postgres database and trying to use 
 the CAS to authenticate. It seems that when I try to use the CAS provider 
 from one of the applications I get an error:

 class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42703', 
 'column auth_user.username does not exist') Version  web2py™ (2, 3, 2, 
 datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')  Python Python 
 2.7.3: C:\Python27\python.exe  Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.
 28.
 29.
 30.
 31.
 32.
 33.
 34.
 35.
 36.
 37.
 38.
 39.
 40.
 41.
 42.
 43.
 44.

 Traceback (most recent call last):
   File C:\wrk\PD\admingui\trunk\gluon\restricted.py, line 212, in restricted
 exec ccode in environment
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 77, in module
   File C:\wrk\PD\admingui\trunk\gluon\globals.py, line 193, in lambda
 self._caller = lambda f: f()
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 39, in user
 return dict(form=auth())
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1240, in __call__
 return getattr(self, args[0])()
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 2090, in login
 table_user._filter_fields(cas_user))
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1714, in 
 get_or_create_user
 user = table_user(**{fieldname: value})
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 7769, in __call__
 return self._db(query).select(limitby=(0,1),for_update=for_update, 
 orderby=orderby).first()
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 8905, in select
 return adapter.select(self.query,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1631, in select
 return self._select_aux(sql,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1596, in _select_aux
 self.execute(sql)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1709, in execute
 return self.log_execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1703, in log_execute
 ret = self.cursor.execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 246, in 
 _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 317, in 
 execute
 self._execute(operation, args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 322, in 
 _execute
 self.cursor.execute(new_query, *new_args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 398, in execute
 self._stmt = PreparedStatement(self.connection, query, statement_name=, 
 *[{type: type(x), value: x} for x in args])
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 138, in __init__
 self._parse_row_desc = self.c.parse(self._statement_name, statement, 
 types)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 943, 
 in _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 
 1104, in parse
 return reader.handle_messages()
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 929, 
 in handle_messages
 raise exc
 ProgrammingError: ('ERROR', '42703', 'column auth_user.username does not 
 exist')

 Can anyone tell me the correct way of integrating multiple applications to 
 use a single CAS provider. I have been through all the forum posts and book 
 examples. I am always getting table conflicts. In this case it is looking 
 for auth.username. But in all applications including this one I have 
 auth.define_tables(username=False), but it still looks for it.

 Here is my db.py file for cas_provider:


 # -*- coding: utf-8 -*-

 #
 ## This scaffolding model makes your app work on Google App Engine too
 ## File is released under public domain and you can use without limitations
 #

 if not request.env.web2py_runtime_gae:
 ## if NOT running on Google App Engine use SQLite or other DB
 #db = 

[web2py] Re: Web2py CAS auth.username does not exist. Multiple application with one CAS provider.

2013-04-05 Thread Massimo Di Pierro
Answered in other thread.

On Friday, 5 April 2013 13:19:46 UTC-5, joe smith wrote:


 I am trying to create a single web2py server with multiple applications 
 that each use a single CAS provider to handle user authentication. I keep 
 running into a wall when it comes to getting the applications to work with 
 the CAS. In particular I get an error from the consumer app that 
 auth.username table does not exist. In all my applications I user 
 auth.define_tables with username=False and it still tries to look for a 
 username. This is true even if all .tables are deleted and reconstructed. I 
 read on other posts that copying the .tables from the provider app to the 
 consumer app will solve the problem. This does fix it, but is that the best 
 solution? It seems to me that it should not be looking for auth.username? 
 Any help is appreciated. I am providing an example with two applications 
 one a CAS provider, the other a consumer. Only the db.py files have been 
 modified from the original scaffold. I am using Web2py2.3.2 (2012-12-17 
 15:03:30), Postgres 9.1
 The error:*

 class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42703', 
 'column auth_user.username does not exist') Version  web2py™ (2, 3, 2, 
 datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')  Python Python 
 2.7.3: C:\Python27\python.exe  Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.
 28.
 29.
 30.
 31.
 32.
 33.
 34.
 35.
 36.
 37.
 38.
 39.
 40.
 41.
 42.
 43.
 44.

 Traceback (most recent call last):
   File C:\wrk\PD\admingui\trunk\gluon\restricted.py, line 212, in restricted
 exec ccode in environment
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 77, in module
   File C:\wrk\PD\admingui\trunk\gluon\globals.py, line 193, in lambda
 self._caller = lambda f: f()
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 39, in user
 return dict(form=auth())
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1240, in __call__
 return getattr(self, args[0])()
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 2090, in login
 table_user._filter_fields(cas_user))
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1714, in 
 get_or_create_user
 user = table_user(**{fieldname: value})
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 7769, in __call__
 return self._db(query).select(limitby=(0,1),for_update=for_update, 
 orderby=orderby).first()
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 8905, in select
 return adapter.select(self.query,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1631, in select
 return self._select_aux(sql,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1596, in _select_aux
 self.execute(sql)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1709, in execute
 return self.log_execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1703, in log_execute
 ret = self.cursor.execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 246, in 
 _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 317, in 
 execute
 self._execute(operation, args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 322, in 
 _execute
 self.cursor.execute(new_query, *new_args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 398, in execute
 self._stmt = PreparedStatement(self.connection, query, statement_name=, 
 *[{type: type(x), value: x} for x in args])
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 138, in __init__
 self._parse_row_desc = self.c.parse(self._statement_name, statement, 
 types)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 943, 
 in _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 
 1104, in parse
 return reader.handle_messages()
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 929, 
 in handle_messages
 raise exc
 ProgrammingError: ('ERROR', '42703', 'column auth_user.username does not 
 exist')




 *My Provider Code:*

 # -*- coding: utf-8 -*-

 #
 ## This scaffolding model makes your app work on Google App Engine too
 ## File is released under public domain and you can use without limitations
 #

 if not request.env.web2py_runtime_gae:
 ## if NOT running on Google App Engine use SQLite or other DB
 #db = 

[web2py] Re: web2py shell vs terminal shell

2013-04-05 Thread Massimo Di Pierro
It is not better. The web2py shell is the normal Python shell or the 
IPython shell if available. The difference is that the code in the web2py 
shell has already imported for you web2py environment (and optionally the 
models) so it it like coding in a web2py controller:

 python
 print db.tables
Error

 python web2py.py -S welcome -M
 print db.tables
['auth_user', ]

On Friday, 5 April 2013 15:57:49 UTC-5, Michael Herman wrote:

 i remember reading somewhere that it's better to use the built-in shell in 
 web2py, but i can't find the article/post. anyone know (1) if it is 
 better, and, (2)  if so, why?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Windows Service fails with 2 ports on rocket server

2013-04-05 Thread Massimo Di Pierro
Where is this?

On Friday, 5 April 2013 16:20:02 UTC-5, Niphlod wrote:

 I's say using nssm.exe will spare you some headaches.

 It seems that there are a few errors in winservice.py

 You can try to patch it.
 self.server = main.HttpServer(
 ip=options.ip,
 port=options.port,
 password=options.password,
 pid_filename=options.pid_filename,
 log_filename=options.log_filename,
 profiler_filename=options.profiler_filename,
 ssl_certificate=options.ssl_certificate,
 ssl_private_key=options.ssl_private_key,
 min_threads=options.minthreads,
 max_threads=options.maxthreads,
 server_name=options.server_name,
 request_queue_size=options.request_queue_size,
 timeout=options.timeout,
 shutdown_timeout=options.shutdown_timeout,
 path=options.folder,
 *interfaces=options.interfaces*
 )
 additions in *bold*

 and include
 ip = '127.0.0.1'
 port = 8000


 in the config file. In theory, when *interfaces* is passed it should 
 override whatever ip or port you pass




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: web2py shell vs terminal shell

2013-04-05 Thread Anthony
By built-in shell, do you mean the one in the admin app? I think there 
are sometimes problems with that (particularly with database operations), 
so I tend to use the web2py shell in the terminal, which you can start as 
follows from the web2py directory:

python web2py.py -S yourapp/[optional controller] -M

But you may fine the admin shell works just fine for you, in which case, 
use it.

Anthony

On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote:

 i remember reading somewhere that it's better to use the built-in shell in 
 web2py, but i can't find the article/post. anyone know (1) if it is 
 better, and, (2)  if so, why?

-- 

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




Re: [web2py] Re: web2py shell vs terminal shell

2013-04-05 Thread Michael Herman
yes. so when working with DAL directly from the shell it's better to
work from the web2py shell in the terminal rather than the admin app
shell? any idea why?

On Fri, Apr 5, 2013 at 2:43 PM, Anthony abasta...@gmail.com wrote:

 By built-in shell, do you mean the one in the admin app? I think there are 
 sometimes problems with that (particularly with database operations), so I 
 tend to use the web2py shell in the terminal, which you can start as follows 
 from the web2py directory:

 python web2py.py -S yourapp/[optional controller] -M

 But you may fine the admin shell works just fine for you, in which case, use 
 it.

 Anthony


 On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote:

 i remember reading somewhere that it's better to use the built-in shell in 
 web2py, but i can't find the article/post. anyone know (1) if it is 
 better, and, (2)  if so, why?

 --

 ---
 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/XWMt1Pb_2wk/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: Multi-tenany and url routing

2013-04-05 Thread Domagoj Kovač
Does anyone have any advice?

On Thursday, April 4, 2013 2:29:55 PM UTC+2, Domagoj Kovač wrote:

 Hi Guys,

 i am new to web2py. I have a problem and i am not sure how to approach it. 
 I am working on a multitenant application.

 I have two tables:

 Tenants

- id
- name
- url_sufix
- active
- deleted

 Tenans_users

- tenant_id
- user_id

 in tenants table url_sufix is a url_sufix, for example, my base 
 application is on 127.0.0.1.:8000/myapp, and login for the tenant is on 
 127.0.0.1.:8000/myapp/url_sufix for example 127.0.0.1.:8000/myapp/tenant_1. 
 Lets say we have one user that has two tenants. When user logs in trought 
 127.0.0.1.:8000/myapp/tenant_1 he is also logged in 
 127.0.0.1.:8000/myapp/tenant_2 because he has two tenants, but if user goes 
 to 127.0.0.1.:8000/myapp/tenant_3 he receives the login form and if 
 he tries to login, he will receive an error saying credential are wrong. 

 I don't need a working code, just an advice how this could be done.




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Windows Service fails with 2 ports on rocket server

2013-04-05 Thread Niphlod
gluon/winservice.py
However, there's a problem.
when you pass --interfaces to rocket, it overrides whatever ip,port you 
pass (reading the docs)

normally gluon.widget just discards -i and -p in favour of --interfaces

options_std.py reports interfaces AND ip AND port ... it should be cleared 
out that with this patch the interfaces always overrides ip and 
port.

PS: can we please ditch all winservice (and contrib/ related) madness in 
favour of nssm ? 
Clearly just a few are testing it, there are problems with the parameters 
passed to web2py.py -W and additionally I don't think that the code is able 
to register itself and work ok on all windows OSes.

less headaches for users, less for developers  win-win(dows) ? (no pun 
intended :P )

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca
El vie, 05-04-2013 a las 13:17 -0700, Niphlod escribió:
 more on the matter this is the result of 600 queued tasks all in
 the main group, with two different schedulers started with -K appname,
 with postgresql
 
 select assigned_worker_name, status, count(*) as howmany
 from scheduler_task
 group by assigned_worker_name, status
 
 monster#4772;COMPLETED;285
 monster#4751;COMPLETED;315
 
 allright, they are not 300 and 300, but the more tasks they process
 the more the percentage gap will reduce, eventually being a close
 50%-50%
 
maybe it was just that I went crazy when they do not pick up the first
10 tasks fairly. :-(

 On Friday, April 5, 2013 9:58:50 PM UTC+2, Niphlod wrote:
 I get that if you manually force them to pick tasks from
 different groups they are processed, but different schedulers
 with the same group name should receive the same amount of
 tasks anyway.
 
 On Friday, April 5, 2013 9:17:23 PM UTC+2, Yoel Benitez
 Fonseca wrote:
 El 5.4.2013 2:57 pm, Niphlod escribió: 
  this is the second time the issue is posted and yet
 I can't find a way 
  to 
  reproduce it It's true that I'm running two
 scheduler processes on 
  the 
  same machine vs one scheduler on on machine and the
 other on another 
  separate one, but as far as the assign algorithm
 is concerned, as 
  long as 
  there are two scheduler_workers rows, nothing should
 change. 
  Just as a proof, can you confirm that when you start
 two schedulers on 
  the 
  same server you observe the same behaviour ? 
 
 somehow I solved it: 
 
 On each server the worker is started with a different
 group name and 
 each task is assigned to a group name randomly chosen
 from those 
 reported in the database: 
 
 with n server start the workers like this: 
 
 server1: python /home/www-data/web2py/web2py.py -K
 myapp  # group name 
 main 
 server2: python /home/www-data/web2py/web2py.py -K
 myapp:srv2 
 server3: python /home/www-data/web2py/web2py.py -K
 myapp:srv3 
 ... 
 serverN: python /home/www-data/web2py/web2py.py -K
 myapp:srvN 
 
 
 for a group name at random from the available: 
 
 def get_groups_names(): 
  rows = db(db.scheduler_worker.id  
 0).select(db.scheduler_worker.group_names).as_list() 
  mylist = [] 
  for row in rows:
 mylist.extend(row['group_names']) 
  tmp = set(mylist) #make it a set 
 
  return [item for item in tmp] 
 
 and to assign a task to a group: 
 
 ... 
 scheduler.queue_task(some_task, 
..., 
group_name=random.choice(get_groups_names()) 
 ) 
 ... 
 
 After doing that, the WORKERS started working without
 problems and 
 tasks are not waiting if there are WORKERS idle. 
 
  On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel
 Benitez Fonseca wrote: 
  
  El 5.4.2013 6:47 am, Niphlod escribió: 
  what db are you using ? 
  
  postgres, is the same database shared between
 servers 
  
  
  On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel
 Benitez Fonseca 
  wrote: 
  
  i have this setup: 
  
  2 severs with the same web2py  app installed,
 each of then run a 
  scheluder worker 
  
  the problem is that only one of then get jobs,
 and in 
  db.scheluder_worker the one with do all the work
 is the only with 
  true 
  in is_ticker field, i just the 2 of em cooperate
 and pickup the 
  available jobs. 
  
  P.D: got them in diferent's groups and randomly
 assing task to the 
  groups. 
   

Re: [web2py] Re: another oracle question :(

2013-04-05 Thread Martin Barnard
Thanks for the info, Niphlod.

I will look into the efficiency of the IN clause for my needs, as it
appears to offer a solution which may mollify the IT  DBA, and his demands
for bind vars (they are concerned that a looped select will bring the db to
it's knees).



Martin Barnard.



On 6 April 2013 00:07, Niphlod niph...@gmail.com wrote:

 I really don't understand.
 The query shipped to your oracle instance will be exactly the same using
 DAL as the one using bind variables.

 The DAL just does binding for you (in the 90% of the cases, better)

 If you want to retrieve from a table all records in one query, and you
 have a large list of key values to filter it with, you can do it only
 with two syntaxes
 either
 select * from table where column in (1,2,3,4,5,6,)

 or
 select * from table
 where
 column = 1
 or
 column = 2
 or
 column = 3
 or
 column = 4



 Now, every database has its own query planning, but as far as I know
 Oracle responds better to the first one than the latter.
 For the sake of completeness,  MSSQL is more fun  MSSQL 2000 to 2005
 without any SP performed better on the first, while 2005 sp2 to 2008 R2
 performs best with the latter ... Postgresql instead has similar times but
 from 8.4 to 9.1 there has been a steep improvement on it, etc etc etc

 Binding with in won't get you where you want to go you have to
 prepare the in list as a pre-quoted string and pass that as a
 parameter, however, as I was saying, there will not be any difference on
 the query shipped to your db instance.

 Same thing goes for the or method .

 For the sake of completeness #2, in web2py should resemble similarly to
 mems = [1,2,3,4,5, ...]
 q = [] # list of conditions
 for c in mems:
 q.append[db.table1.field == c]
 all_queries_in_or = reduce(lambda a,b: (a | b ), q)
 result = db(all_queries_in_or).select()



  --

 ---
 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/E2pVWl_71t4/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: .sum() and .count() in grid?

2013-04-05 Thread Niphlod
often referred as materialized views for the ones who can spare me a 
lecture about what are exactly those :P, let's say you have an 
iper-complicated query that reconstructs to a table that you want to 
show in a grid just for searching purposes (other purposes not listed, 
sorry, they make absolute no sense)

the dba that is in you says I'll write a view for my iper-complicated 
query ...
so, you code something like
create view iperquery as 
select something_that_resemble_a_sequence, bla1, bla2, bla3,
 .
from bla1
 .
left outer join (
   select blablabla
   group by blablabla
)
 .
where max(whatever)  0

Perfect. now you can do a select * from iperquery and your db engine does 
all the work.
To use iperquery as a table (read-only mode, for write only go to see 
docs about your engine support for keyed views, another story I'm NOT going 
to cover here) 

db.define_table('iperquery',
 Field('something_that_resemble_a_sequence', 'id')
 Field('bla1'),
 Field('bla2'),
 .,
 migrate=False
)

the migrate=False bit is the key: web2py won't try creating it and assumes 
there's a table ready to be used.
You just need to:
 - include a pkey, better if resembles a sequence, and have a Field of type 
'id' matching it
 - tune the Field types accordingly to the type of column of your view

On Friday, April 5, 2013 11:24:23 PM UTC+2, Jurgis Pralgauskis wrote:

 You'll better code a view and access it as a fake table. 


 are there examplses of this?

 Is it possible to show virtual fields in grid (in appadmin they don't show 
 up)?


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another oracle question :(

2013-04-05 Thread Niphlod


On Friday, April 5, 2013 11:58:37 PM UTC+2, Martin Barnard wrote:

 Thanks for the info, Niphlod.  

 I will look into the efficiency of the IN clause for my needs, as it 
 appears to offer a solution which may mollify the IT  DBA, and his demands 
 for bind vars (they are concerned that a looped select will bring the db to 
 it's knees).


 a db(whatever.belongs(a_set)) issues ONE query only.

If you want to force a looping query, you should do explicitely with

mems = [1,2,3,4,5,6,...]
for c in mems:
 one_result = db(db.table.field == c).select()
 ..
of course, for zillions values into mems, it's not a smart move.

the smartest move with a huge set (i.e. the technique with most of the 
balance) would be paginating through your mems . 

You'd loop a few times but if you have thousands of values into mems, a 
single IN () (or thousands ORs) will take some time 

Try to draw a limit with your DBA and if he says that you're allowed to 
do an IN() with 500 values at a times, you have it covered ^_^

On the other end, you have a requirement. fetch a zillions rows. 
either you do it in one shot or in zillions/500 each.

-- 

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




Re: [web2py] Re: web2py shell vs terminal shell

2013-04-05 Thread Anthony
Well, give the admin shell a try and see if it works. I just had some 
problems in the past with db operations not committing (at least on 
Windows) -- not sure why. I think the terminal shell is easier to use 
anyway (don't have to type print before every command, recall previous 
command, etc.).

Anthony

On Friday, April 5, 2013 5:48:50 PM UTC-4, Michael Herman wrote:

 yes. so when working with DAL directly from the shell it's better to 
 work from the web2py shell in the terminal rather than the admin app 
 shell? any idea why? 

 On Fri, Apr 5, 2013 at 2:43 PM, Anthony abas...@gmail.com javascript: 
 wrote: 
  
  By built-in shell, do you mean the one in the admin app? I think there 
 are sometimes problems with that (particularly with database operations), 
 so I tend to use the web2py shell in the terminal, which you can start as 
 follows from the web2py directory: 
  
  python web2py.py -S yourapp/[optional controller] -M 
  
  But you may fine the admin shell works just fine for you, in which case, 
 use it. 
  
  Anthony 
  
  
  On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote: 
  
  i remember reading somewhere that it's better to use the built-in shell 
 in web2py, but i can't find the article/post. anyone know (1) if it is 
 better, and, (2)  if so, why? 
  
  -- 
  
  --- 
  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/XWMt1Pb_2wk/unsubscribe?hl=en. 
  To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:. 
  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: Web2py CAS auth.username does not exist. Multiple applications, one CAS provider.

2013-04-05 Thread joe smith
Ok thank you for your help. Does that mean I have to allow usernames for 
login for CAS to work? All of our users now use email addresses. I can get 
around the issue by manually creating a auth_user.username column in 
Postgres, but a cleaner fix would be as Anthony posted somewhere else: 
auth.settings.login_userfield 
= 'email'? This would allow a username so that the tables are created, but 
not used unless I expose that field?



On Friday, 5 April 2013 14:37:04 UTC-7, Massimo Di Pierro wrote:

 If you use CAS you must change:

 auth = Auth(db)

 into

 auth = Auth(db, username=True)


 CAS requires a username.

 On Friday, 5 April 2013 11:26:50 UTC-5, joe smith wrote:

 I am writing a number of Web2py applications. The base CAS application is 
 an administration system to keep track of users, organizations, groups, 
 etc. That part is working fine, but now I want to add additional 
 applications that use this administration system as a CAS provider. I have 
 been trying to get things to work properly for a week or so without having 
 a nice solution. I am using a single Postgres database and trying to use 
 the CAS to authenticate. It seems that when I try to use the CAS provider 
 from one of the applications I get an error:

 class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42703', 
 'column auth_user.username does not exist') Version  web2py™ (2, 3, 2, 
 datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable')  Python Python 
 2.7.3: C:\Python27\python.exe  Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.
 28.
 29.
 30.
 31.
 32.
 33.
 34.
 35.
 36.
 37.
 38.
 39.
 40.
 41.
 42.
 43.
 44.

 Traceback (most recent call last):
   File C:\wrk\PD\admingui\trunk\gluon\restricted.py, line 212, in 
 restricted
 exec ccode in environment
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 77, in module
   File C:\wrk\PD\admingui\trunk\gluon\globals.py, line 193, in lambda
 self._caller = lambda f: f()
   File C:/wrk/PD/admingui/trunk/applications/app1/controllers/default.py 
 http://127.0.0.1:8000/admin/default/edit/app1/controllers/default.py, line 
 39, in user
 return dict(form=auth())
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1240, in __call__
 return getattr(self, args[0])()
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 2090, in login
 table_user._filter_fields(cas_user))
   File C:\wrk\PD\admingui\trunk\gluon\tools.py, line 1714, in 
 get_or_create_user
 user = table_user(**{fieldname: value})
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 7769, in __call__
 return self._db(query).select(limitby=(0,1),for_update=for_update, 
 orderby=orderby).first()
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 8905, in select
 return adapter.select(self.query,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1631, in select
 return self._select_aux(sql,fields,attributes)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1596, in _select_aux
 self.execute(sql)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1709, in execute
 return self.log_execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\dal.py, line 1703, in log_execute
 ret = self.cursor.execute(*a, **b)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 246, 
 in _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 317, 
 in execute
 self._execute(operation, args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\dbapi.py, line 322, 
 in _execute
 self.cursor.execute(new_query, *new_args)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 398, in execute
 self._stmt = PreparedStatement(self.connection, query, 
 statement_name=, *[{type: type(x), value: x} for x in args])
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\interface.py, line 
 138, in __init__
 self._parse_row_desc = self.c.parse(self._statement_name, statement, 
 types)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 
 943, in _fn
 return fn(self, *args, **kwargs)
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 
 1104, in parse
 return reader.handle_messages()
   File C:\wrk\PD\admingui\trunk\gluon\contrib\pg8000\protocol.py, line 
 929, in handle_messages
 raise exc
 ProgrammingError: ('ERROR', '42703', 'column auth_user.username does not 
 exist')

 Can anyone tell me the correct way of integrating multiple applications 
 to use a single CAS provider. I have been through all the forum posts and 
 book examples. I am always getting table conflicts. In this case it is 
 looking for auth.username. But in all applications including this one I 
 have auth.define_tables(username=False), but it still looks for 

[web2py] Help on fake_migration

2013-04-05 Thread Tito Garrido
Hi Folks!

I am trying to migrate my web2py application from one server to another.

I have pack my application and restored the MYSQL database but when I tried
to run it there I got:
InternalError: (1050, uTable 'auth_user' already
exists)https://74.207.229.72/admin/default/errors/novelas#
I have followed
http://web2py.com/books/default/chapter/29/06?search=fake_#Fixing-broken-migrations

but when I try to use fake_migration I got
504 Gateway Time-out
--
nginx/1.1.19


How can I fix it?

Regards,

Tito

-- 

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

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Help on fake_migration

2013-04-05 Thread Niphlod
pass the same migrate argument of you DAL call to auth.define_tables() too 
(e.g., auth.define_tables(fake_migrate=True))

On Saturday, April 6, 2013 1:24:33 AM UTC+2, Tito Garrido wrote:

 Hi Folks!

 I am trying to migrate my web2py application from one server to another.

 I have pack my application and restored the MYSQL database but when I 
 tried to run it there I got:
 InternalError: (1050, uTable 'auth_user' already 
 exists)https://74.207.229.72/admin/default/errors/novelas#
 I have followed 
 http://web2py.com/books/default/chapter/29/06?search=fake_#Fixing-broken-migrations

 but when I try to use fake_migration I got
 504 Gateway Time-out 
 --
 nginx/1.1.19


 How can I fix it?

 Regards,

 Tito

 -- 

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


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: web2py Talk

2013-04-05 Thread Francisco Costa
http://franciscocosta.com/web2py.html

On Thursday, April 4, 2013 11:56:20 AM UTC+1, Francisco Costa wrote:

 Hi,

 I'm going to give a briefly presentation about web2py this Saturday: 
 https://tymr.com/event/encontro-python-pt-6-abril-2013-porto/515c6f2a03d36d409716741e

 Are there any great slides/presentations out there that I can use or get 
 inspiration from?

 Francisco Costa
 https://tymr.com


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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] class 'sqlite3.OperationalError' database is locked

2013-04-05 Thread BlueShadow
Hi,
i got a couple of errors today which tell me the database is locked. I know 
I'm using sqlite. which is less than ideal. I got about 30 users a day 
which should be perfectly fine with SQLite.
Especially since I added this part of code:

if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite', migrate=False)
try:
db.executesql(PRAGMA journal_mode=WAL;)
except:
pass
Or do I have to add something else to enable the write ahead option?
from the things I read SQLite should be usable upto 100k Users a day with 
this WAL.

I tired to migrate to postgresql but since there are a couple things which 
are not allowed in postgres (for example: Field Content) I have to move 
the db manually which will have to wait quite a bit.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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 benchmark my web2py website? I have got scary results :-/

2013-04-05 Thread Tito Garrido
Hi Folks!

I am trying to use ab to benchmark my website that is hosted on linode
(512MB RAM) using nginx + mysql + web2py, installed via the install script
provided in the book.

Should I point ab to my index? I have been running some tests and the
results are scary...

Server Software:nginx/1.1.19
Server Port:80

Document Path:  /
Document Length:385313 bytes

Concurrency Level:  20
Time taken for tests:   329.128 seconds
Complete requests:  1000
Failed requests:980
   (Connect: 0, Receive: 0, Length: 980, Exceptions: 0)
Write errors:   0
Total transferred:  385586379 bytes
HTML transferred:   385290379 bytes
Requests per second:3.04 [#/sec] (mean)
Time per request:   6582.563 [ms] (mean)
Time per request:   329.128 [ms] (mean, across all concurrent requests)
Transfer rate:  1144.08 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:  172  216  58.52131423
Processing:  3037 6337 1605.4   6233   13805
Waiting:  305  387 132.03692046
Total:   3270 6553 1609.1   6438   14012

Percentage of the requests served within a certain time (ms)
  50%   6438
  66%   7089
  75%   7516
  80%   7776
  90%   8652
  95%   9288
  98%  10138
  99%  11540
 100%  14012 (longest request)

I know that it is a complex question, but what can I do to improve the
performance of my website? I have followed the recommendations from the
but, I have put migration=False etc...

Thanks in advance,

Tito


-- 

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

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Displaying a Virtual Field in SQLFORM.grid throws an exception....

2013-04-05 Thread Richard Vézina
I fall on this exact problem, I don't see anything about taht in the change
log of 2.4.4. Is this will be fix soon? I mean SQLFORM.grid support for
virtual field

THanks

Richard


On Tue, Dec 18, 2012 at 10:32 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Right now grid does not work with virtual fields. There is a pending
 proposal for enhancement to support them.


 On Tuesday, 18 December 2012 01:03:05 UTC-6, software.ted wrote:

 Does SQLFORM.grid support adding and display of a virtual field...am
 getting an exception...my code:

 db.file_subject_issue.file_**name = Field.Virtual(lambda row:
 get_file_name(row.file_**subject_issue.file_id))
 fields = [db.file_subject_issue.file_**id, 
 db.file_subject_issue.date_**created,
 db.file_subject_issue.file_**name]
 query =

 form = SQLFORM.grid(query,fields=**fields,...)

 I am getting the error

 type 'exceptions.AttributeError' 'FieldVirtual' object has no attribute
 '_tablename'

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/**restricted.py, line 212, in restricted

 exec ccode in environment
   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 176, in module

   File /home/www-data/web2py/gluon/**globals.py, line 188, in lambda

 self._caller = lambda f: f()

   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 71, in file_track

 selectable=False,csv=False , paginate=20, user_signature=False)

   File /home/www-data/web2py/gluon/**sqlhtml.py, line 1796, in grid

 if field._tablename in tablenames]
 AttributeError: 'FieldVirtual' object has no attribute '_tablename'




 --
 ..**..**
 ...
 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: list:string type field is empty value on edit page

2013-04-05 Thread 黄祥
is it related to the other field constructor, like required, label, etc? 
and for controller i'm using grid.

*default.py*
@auth.requires_login()
def contact():
grid=SQLFORM.grid(db.contact, user_signature=False)
return locals()

*db_wizard.py*
# create table : contact
db.define_table('contact',
Field('salutation'),
Field('first_name'),
Field('last_name'),
Field('gender', 'list:string'),
Field('birthday', 'date'),
Field('job_title'),
Field('address', 'text'),
Field('zip'),
Field('city'),
Field('country'),
Field('phone'),
Field('fax'),
Field('email'),
Field('account', 'reference account'),
format='%(first_name)s %(last_name)s')

# create index : contact
db.executesql('CREATE INDEX IF NOT EXISTS idx_contact ON contact (id, 
first_name, last_name);')

# enable_record_versioning : contact
db.contact._enable_record_versioning()

*db_wizard_label.py*
# contact
db.contact.salutation.label=T('Salutation')
db.contact.first_name.label=T('First Name')
db.contact.last_name.label=T('Last Name')
db.contact.gender.label=T('Gender')
db.contact.birthday.label=T('Birthday')
db.contact.job_title.label=T('Job Title')
db.contact.address.label=T('Address')
db.contact.zip.label=T('Zip')
db.contact.city.label=T('City')
db.contact.country.label=T('Country')
db.contact.phone.label=T('Phone')
db.contact.fax.label=T('Fax')
db.contact.email.label=T('Email')
db.contact.account.label=T('Account')

*db_wizard_required.py*
# contact
db.contact.salutation.required=True
db.contact.first_name.required=True
db.contact.last_name.required=True
db.contact.gender.required=True
db.contact.job_title.required=True
db.contact.address.required=True
db.contact.zip.required=True
db.contact.city.required=True
db.contact.country.required=True
db.contact.phone.required=True
db.contact.email.required=True
db.contact.account.required=True
*
db_wizard_requires.py*
# contact
db.contact.salutation.requires=IS_IN_SET(['Mr.', 'Mrs.', 'Ms.'])
db.contact.first_name.requires=IS_NOT_EMPTY()
db.contact.last_name.requires=IS_NOT_EMPTY()
db.contact.gender.requires=IS_IN_SET(['Male', 'Female'])
db.contact.job_title.requires=IS_NOT_EMPTY()
db.contact.address.requires=IS_NOT_EMPTY()
db.contact.zip.requires=IS_MATCH('^\d{5,5}$',
 error_message='not a zip code')
db.contact.city.requires=IS_NOT_EMPTY()
db.contact.country.requires=IS_NOT_EMPTY()
db.contact.phone.requires=IS_NOT_EMPTY()
db.contact.email.requires=[IS_EMAIL(), 
   IS_NOT_IN_DB(db, 'contact.email')]
db.contact.account.requires=IS_IN_DB(db, db.account.id, '%(account_name)s')

On Friday, April 5, 2013 5:25:55 PM UTC-4, Massimo Di Pierro wrote:

 No it is not. Something in the code must be resetting it.

 On Thursday, 4 April 2013 22:13:25 UTC-5, 黄祥 wrote:

 hi,

 is it normal for list:string type field is empty when on editing page?

 e.g.
 db.define_table('contact',
 *Field('salutation'),*
 Field('first_name'),
 Field('last_name'),
 *Field('gender', 'list:string'),*
 Field('birthday', 'date'),
 Field('job_title'),
 Field('address', 'text'),
 Field('zip'),
 Field('city'),
 Field('country'),
 Field('phone'),
 Field('fax'),
 Field('email'),
 *Field('account', 'reference account'),*
 format='%(first_name)s %(last_name)s')

 *db.contact.salutation.requires=IS_IN_SET(['Mr.', 'Mrs.', 'Ms.'])*
 db.contact.first_name.requires=IS_NOT_EMPTY()
 db.contact.last_name.requires=IS_NOT_EMPTY()
 *db.contact.gender.requires=IS_IN_SET(['Male', 'Female'])*
 db.contact.job_title.requires=IS_NOT_EMPTY()
 db.contact.address.requires=IS_NOT_EMPTY()
 db.contact.zip.requires=IS_MATCH('^\d{5,5}$',
  error_message='not a zip code')
 db.contact.city.requires=IS_NOT_EMPTY()
 db.contact.country.requires=IS_NOT_EMPTY()
 db.contact.phone.requires=IS_NOT_EMPTY()
 db.contact.email.requires=[IS_EMAIL(), 
IS_NOT_IN_DB(db, 'contact.email')]
 *db.contact.account.requires=IS_IN_DB(db, db.account.id, 
 '%(account_name)s')*

 i make 3 different field type (bold) that contain drop down in the form 
 view. why the value is always empty for the list:string type when i'm on 
 the editing page? is it possible for not empty for list:string type in 
 editing page?
 any idea or explaination about this?

 thank you so 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] contribute in indonesian language translate

2013-04-05 Thread 黄祥
hi,

is it possible for me to contribute in indonesian language translate?
i'm trying to create new file in languages name : id.py in my application 
after that i've define  :

*gluon/contrib/plural_rules/id.py*
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Plural-Forms for id (Indonesian)

nplurals=2  # Indonesian language has 2 forms:
# 1 singular and 1 plural

# Determine plural_id for number *n* as sequence of positive
# integers: 0,1,...
# NOTE! For singular form ALWAYS return plural_id = 0
get_plural_id = lambda n: int(n != 1)

# Construct and return plural form of *word* using
# *plural_id* (which ALWAYS0). This function will be executed
# for words (or phrases) not found in plural_dict dictionary
# construct_plural_form = lambda word, plural_id: (word + 'suffix')

but i still got :
( Plural-Forms: rules are not defined (file *
gluon/contrib/plural_rules/id.py* is not found) )

what should i do to define the rules?

another question is i compare the the new id.py file that i've created in 
my application have different parameter like the others language files that 
web2py have been provided for example :
!=
%(nrows)s records found
%d seconds ago*
*
, etc
*
*
is it crucial or not? or i must copy manual from the language folder and 
translate it one by one (not via web browser)?
after that how can i share the translate id.py file?

thank you so much for the advise.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: Help on fake_migration

2013-04-05 Thread tomt
I migrate applications fairly often, and using fake_migrate_all works best 
for me:

db = DAL(...,fake_migrate_all=True)



On Friday, April 5, 2013 5:24:33 PM UTC-6, Tito Garrido wrote:

 Hi Folks!

 I am trying to migrate my web2py application from one server to another.

 I have pack my application and restored the MYSQL database but when I 
 tried to run it there I got:
 InternalError: (1050, uTable 'auth_user' already 
 exists)https://74.207.229.72/admin/default/errors/novelas#
 I have followed 
 http://web2py.com/books/default/chapter/29/06?search=fake_#Fixing-broken-migrations

 but when I try to use fake_migration I got
 504 Gateway Time-out 
 --
 nginx/1.1.19


 How can I fix it?

 Regards,

 Tito

 -- 

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


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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 benchmark my web2py website? I have got scary results :-/

2013-04-05 Thread Richard Vézina
You can look at db.stat and start your app with profiler. Look in the
generic.thml view for db.stat you have to the little piece of code in your
view to access it. You can serach de groop for the profiler or check the
book section how to start the shell I think there is explanation there...

Richard


On Fri, Apr 5, 2013 at 8:31 PM, Tito Garrido titogarr...@gmail.com wrote:

 Hi Folks!

 I am trying to use ab to benchmark my website that is hosted on linode
 (512MB RAM) using nginx + mysql + web2py, installed via the install script
 provided in the book.

 Should I point ab to my index? I have been running some tests and the
 results are scary...

 Server Software:nginx/1.1.19
 Server Port:80

 Document Path:  /
 Document Length:385313 bytes

 Concurrency Level:  20
 Time taken for tests:   329.128 seconds
 Complete requests:  1000
 Failed requests:980
(Connect: 0, Receive: 0, Length: 980, Exceptions: 0)
 Write errors:   0
 Total transferred:  385586379 bytes
 HTML transferred:   385290379 bytes
 Requests per second:3.04 [#/sec] (mean)
 Time per request:   6582.563 [ms] (mean)
 Time per request:   329.128 [ms] (mean, across all concurrent requests)
 Transfer rate:  1144.08 [Kbytes/sec] received

 Connection Times (ms)
   min  mean[+/-sd] median   max
 Connect:  172  216  58.52131423
 Processing:  3037 6337 1605.4   6233   13805
 Waiting:  305  387 132.03692046
 Total:   3270 6553 1609.1   6438   14012

 Percentage of the requests served within a certain time (ms)
   50%   6438
   66%   7089
   75%   7516
   80%   7776
   90%   8652
   95%   9288
   98%  10138
   99%  11540
  100%  14012 (longest request)

 I know that it is a complex question, but what can I do to improve the
 performance of my website? I have followed the recommendations from the
 but, I have put migration=False etc...

 Thanks in advance,

 Tito


 --

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

 --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and 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] setting sqltable row a class for some row without looping over the html table

2013-04-05 Thread Richard
Hello,

I am searching way to set class to some row in the html table depend on 
particular field value of table row for changing background color of the 
row...

Until now I was looping over html table for that but I start to see the 
limit of this approach as the number of records grow...

I try to use virtual field for that, but they don't seems to be support in 
SQLFORM.grid() for now...

Any idea are welcome.

Thanks

Richard

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: New Plugin: timezone helper

2013-04-05 Thread samuel bonilla
sí, web2pyslices es una buena opción, es posible hacer una automatización en 
el código fuente https://github.com/rochacbruno/Movuca

El martes, 2 de abril de 2013 16:54:10 UTC-5, Niphlod escribió:

 Here https://github.com/niphlod/w2p_timezone_plugin

 As always, you're welcome to submit patches, tests, bugs and whatnot.

 API may change a little bit as soon as someone comes up with a better 
 implementation :P
 Jokes aside, a few variations can still happen in the next 1 or 2 week(s).


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and 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: another oracle question :(

2013-04-05 Thread Martin Barnard
Thanks again for the help - it's invaluable to the oracle noob! :D

I'm actually building an analysis system so that my boss can view some
statistical subset of the information based on a few months or weeks. One
part of the data is stored in *our* MySQL database (which our department
control), whilst the rest of it is stored in the IT's oracle system. I have
to pull a bunch of data from the MySQL database (usually with a date-based
search parameter), then search the oracle system for the rest of the data
for each return in the MySQL rows (by membership).

My current solution (for those on similar paths):

*rows=db(db.my_table.created_on  date_one).select()
*
*ml=[]
*
*for row in rows:
*
*  if row.my_field==my_criteria:
*
*ml.append(row.membership)

*
*rows=odb(odb.other_table.membership.belongs(ml)).select()*

Of course, I have to worry about the length of the list that I'm passing,
as I read that it cannot exceed 1000 items, but this shouldn't be an issue
in normal use, and I'll wrap it in a test first.
More efficient methods welcome!!!

Martin





On 6 April 2013 01:11, Niphlod niph...@gmail.com wrote:



 On Friday, April 5, 2013 11:58:37 PM UTC+2, Martin Barnard wrote:

 Thanks for the info, Niphlod.

 I will look into the efficiency of the IN clause for my needs, as it
 appears to offer a solution which may mollify the IT  DBA, and his demands
 for bind vars (they are concerned that a looped select will bring the db to
 it's knees).


  a db(whatever.belongs(a_set)) issues ONE query only.

 If you want to force a looping query, you should do explicitely with

 mems = [1,2,3,4,5,6,...]
 for c in mems:
  one_result = db(db.table.field == c).select()
  ..
 of course, for zillions values into mems, it's not a smart move.

 the smartest move with a huge set (i.e. the technique with most of the
 balance) would be paginating through your mems .

 You'd loop a few times but if you have thousands of values into mems, a
 single IN () (or thousands ORs) will take some time 

 Try to draw a limit with your DBA and if he says that you're allowed
 to do an IN() with 500 values at a times, you have it covered ^_^

 On the other end, you have a requirement. fetch a zillions rows.
 either you do it in one shot or in zillions/500 each.

 --

 ---
 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/E2pVWl_71t4/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] Is there a way to cache images from download function?

2013-04-05 Thread Tito Garrido
Hi!

I was running page speed on my website and all image files from the
database (upload folder) are not cached...
Is there a way to enable cache for them?

Thanks!

Tito

-- 

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

-- 

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




Re: [web2py] Re: web2py shell vs terminal shell

2013-04-05 Thread Massimo Di Pierro
The admin shell has problems maintaining state. I do not consider it 
reliable. The terminal shell is rock solid. It is a normal pyhton shell.

On Friday, 5 April 2013 16:48:50 UTC-5, Michael Herman wrote:

 yes. so when working with DAL directly from the shell it's better to 
 work from the web2py shell in the terminal rather than the admin app 
 shell? any idea why? 

 On Fri, Apr 5, 2013 at 2:43 PM, Anthony abas...@gmail.com javascript: 
 wrote: 
  
  By built-in shell, do you mean the one in the admin app? I think there 
 are sometimes problems with that (particularly with database operations), 
 so I tend to use the web2py shell in the terminal, which you can start as 
 follows from the web2py directory: 
  
  python web2py.py -S yourapp/[optional controller] -M 
  
  But you may fine the admin shell works just fine for you, in which case, 
 use it. 
  
  Anthony 
  
  
  On Friday, April 5, 2013 4:57:49 PM UTC-4, Michael Herman wrote: 
  
  i remember reading somewhere that it's better to use the built-in shell 
 in web2py, but i can't find the article/post. anyone know (1) if it is 
 better, and, (2)  if so, why? 
  
  -- 
  
  --- 
  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/XWMt1Pb_2wk/unsubscribe?hl=en. 
  To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:. 
  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: web2py with ExtJS - advice required on restructing

2013-04-05 Thread at

One of the problems is that the extjs implementation has made the 
application slow. Because each page is itself an extjs application, it 
reloads extjs libs on accessing a view.
So wanted to at least avoid reloading of js libs on each page access 
request.

Regards

On Friday, 5 April 2013 19:03:37 UTC+5, LightDot wrote:

 It's hard to answer this without knowing what are the application goals 
 and what are the issues you're facing. So... what exactly is a problem with 
 the current approach? What would you like to achieve by restructuring?

 Regards,
 Ales

 On Friday, April 5, 2013 8:45:28 AM UTC+2, at wrote:


 HI,

 Started working on a project where the team is already working on using 
 extjs to develop the views. Each view of web2py application is basically an 
 ExtJS application. They've placed extjs library in 
 web2py/applications/app/static /extjs and created an extjs_views folder in 
 web2py/applications/app/static to place .js files.

 I think extjs is not a good choice for developing web2py app views? but 
 since they already have invested enough on the project, need an expert 
 advice on how should we restructure the whole application in a way that we 
 could utilize existing development in extjs.

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