[web2py] Condition in view weird behaviour

2012-07-06 Thread Annet
In a view I have the following code:


  {{if session.cal.lesrooster or session.cal.event_list or 
session.cal.cursusrooster:}}
{{include 'site/calendar.html'}}
  {{pass}}
  {{include 'site/promoUnit.html'}}
  

Despite session.cal.lesrooster, session.cal.event_list and 
session.cal.cursusrooster being False, site/calendar.html is being 
included. When I replace {{include 'site/calendar.html'}} with text 
the text isn't displayed.

When I move the condition to site/calendar.html, the behaviour is the same, 
only when I have the condition both in the view and in site/calendar.html 
the page is rendered correctly.

site/index.html:


  {{if session.cal.lesrooster or session.cal.event_list or 
session.cal.cursusrooster:}}
{{include 'site/calendar.html'}}
  {{pass}}
  {{include 'site/promoUnit.html'}}
  

site/calendar.html:

{{if (session.cal.lesrooster or session.cal.event_list or 
session.cal.cursusrooster):}}
  
...
  
 
  
...
   

  
   ...
  
{{pass}}


Is there an explanation for this behaviour?


Kind regards,

Annet





Re: [web2py] Re: How to install web2py on webfaction

2012-07-06 Thread khuc viet Cuong
hi
dont put your thing into there, coz we dont know how web2py made its
password so it never works
quick&dirty:

1- Run web2py on your local computer; give it a password when it asks.
2- Go to web2py folder on local computer; copy the file: parameters_8000.py,
to a new place and rename it to : parameters_80.py,
use Filezila or Notepad++ , delete all file look like
: parameters_number.py in web2py folder on webfaction.
3-  Upload the file: parameters_80.py, from local to your webfaction ,
web2py source folder.
4- Open web2py admin : *https*://domain.com/admin

if this way does not work, you have go with SSH (check post about to know
how.)

here is check list to find out what is wrong with you:

1-did you create SSL web2py  website for web2py app in webfaction control
panel?
2- did you use *https*://   to open web2py  admin page?
3- what is your web2py app port number?
4- parameters_*xyz*.py file,   * xyz* = ???

Regards


On Fri, Jul 6, 2012 at 2:09 AM, Prakhar Srivastava
wrote:

> thanks bro for nice and quick reply
> i got that file but whatever pwd is written over there it also not
> working.
>
> On 5 July 2012 22:09, khuc viet Cuong  wrote:
>
>>
>>
>> On Fri, Jul 6, 2012 at 1:19 AM, khuc viet Cuong wrote:
>>
>>> hi
>>> for webfaction, your web2py app is an application with a name,you can
>>> find out what name when check it in application menu,
>>> and the file Parameters_80.py (or  *parameters_xyz.py*  not sure what
>>> you got) is in web2py application folder, look like this:
>>>
>>> home/yourusername/webapps/web2py <---this is name of an app which we have
>>> give to
>>>
>>> inside this folder has 3 folders: apache2, htdocs, web2py
>>>
>>> so goto: home/yourusername/webapps/web2py/web2py
>>> the file: *parameters_80.py (or * *parameters_xyz.py* *) must be here,
>>> if not we can not login.*
>>> inside this file is your encoded password, you dont need to open this
>>> file to edit, just rename it by change the port number, 80 or the port
>>> that webfaction gave to app and test. (get this port via application
>>> menu)
>>> if the  *parameters_80.py*  file is not exsiting then you have do the
>>> steps to set password for web2py (i wrote above ) , it will createdthis 
>>> file for you.
>>>
>>> regards
>>>
>>> On Fri, Jul 6, 2012 at 12:52 AM, Prakhar Srivastava <
>>> prakharsri...@gmail.com> wrote:
>>> > thanks bro, with the help of this mail i install the web2py
>>> application but
>>> > still not able to login ,i open one ticket for that issue so they
>>> reply me
>>> > not open Parameters_80.py get the pwd
>>> > but i'm able open this file and even i don't know where it is? pleasehelp
>>> > bro
>>> >
>>> >
>>> > On 5 July 2012 10:24, khuc viet Cuong  wrote:
>>> >>
>>> >> sorry for bad english, i forgot one thing that:
>>> >> you should check web2py folder first,
>>> >> if  there is a parameters_1234.py  file then you have remove it
>>> before
>>> >> do steps above
>>> >>  (coz: if parameters_1234.py is existing then web2py wont ask
>>> password
>>> >> again, dont remember exactly )
>>> >>
>>> >> web2py admin panel and password wont work if you installed it by
>>> >> autoscript, because 2 problems:
>>> >> 1- No SSL web2py website be created in webfaction control panel.
>>> >> 2- parameters_portnumber.py:  portnumber is wrong ( i tested and it
>>> >> works with port 80, dont understand why)
>>> >>
>>> >> To re-config apache for web2py, goto:
>>> >> username/webapps/web2py/apache2/conf/httpd.conf
>>> >> open this file and change these params to fit your requirement and
>>> here is
>>> >> mine:
>>> >>
>>> >> MaxSpareThreads 3
>>> >> MinSpareThreads 1
>>> >> ThreadsPerChild 5
>>> >> WSGIDaemonProcess web2py processes=1
>>> >> python-path=/home/user/webapps/web2py/lib/python2.7 threads=1
>>> >> maximum-requests=120
>>> >>
>>> >> Regards.
>>> >>
>>> >> On Thu, Jul 5, 2012 at 12:35 PM, khuc viet Cuong <
>>> hoatre2...@gmail.com>
>>> >> wrote:
>>> >> > hi,
>>> >> > webfaction will use your admin password for web2py admin password
>>> by
>>> >> > default if you install it by auto-script. its ricsky.
>>> >> > to set password , you have login via SSH, run web2py as python
>>> script,
>>> >> > it will ask you password, when you done, stop and kill web2py
>>> process,
>>> >> > a new file : parameters_portnumber.py , etc.  parameters_1234.pywhich
>>> >> > 12345 port is webfaction gave you when create a new app , but
>>> web2py
>>> >> > wont work, alway say can access password or...blabla, to solve it,
>>> >> > rename its name:
>>> >> >
>>> >> >  parameters_1234.py-->  parameters_80.py
>>> >> >
>>> >> > and check your apache thread worker via SSH, and test from your
>>> brow.
>>> >> > default web2py app folder in webfaction will look like this:
>>> >> > web2py-->
>>> >> >   -apache2
>>> >> >   -htdocs
>>> >> >   -web2py
>>> >> >
>>> >> > check your apache thread worker memory usage via SSH to know how
>>> much
>>> >> > it eats, should re-config apache, if not webffaction will 

Re: [web2py] Re: Minimum memory requirements?

2012-07-06 Thread Vasile Ermicioi
never saw such error, but multiple interpreter mode could mean you didn't
installed uwsgi using specific python
( in my case, I used python2.7)

wget http://projects.unbit.it/downloads/uwsgi-xx.tar.gz
tar xvzf uwsgi-xx.tar.gz
cd uwsgi-xx
/home/myusername/bin/python2.7 uwsgiconfig.py --build
mv uwsgi /home/myusername/bin


[web2py] How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

In a SQLFORM form I set:

buttons = [
 INPUT(_type='submit', _value='go', _class='btn btn-primary'),
 INPUT(_type='button', _value='info', _class='btn btn-info'),
]

but buttons have not bootstrap style (btn-primary button are not blue, 
there are no space between the two button).


My be I must install twitter-boostrap? What I have to do?



Thank.


[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread Annet
This works for me:

In web2py_ajax.html:

response.files.insert(3,URL('static','js/bootstrap.min.js'))
response.files.insert(4,URL('static','css/bootstrap.min.css'))

and in the function:

form=SQLFORM(..)
form.element(_type='submit')['_class']='btn btn-primary'
form.element(_type='button')['_class']='btn btn-info'


Kind regards,

Annet.


Re: [web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

Il 06/07/2012 10:52, Annet ha scritto:

This works for me:


but not for me :(


my web2py_ajax.html (I tried several changes):

...
{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}}



I also tried to insert bootstrap.css in layout.html:

response.files.append(URL('static','css/skeleton.css'))
response.files.append(URL('static','css/web2py.css'))
response.files.append(URL('static','css/bootstrap.css'))

and this change a lot of things but not buttons style, so I think that's 
not the corrects way ...


Re: [web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread stefaan

>
>
> and this change a lot of things but not buttons style, so I think that's 
> not the corrects way ... 
>

Not sure if it would solve your problem, but sometimes you need to clear 
the browser cache to see the effect of changes in css.



[web2py] Re: Web Development Introduction Based On Web2py

2012-07-06 Thread Luc Chase
Marco,
What does 'very low level' subject matter mean in this context?
Is that to mean 'very detailed'?

--
Luc.

On Tuesday, 20 December 2011 18:33:21 UTC, ma...@rockiger.com wrote:
>
> I published the first 3 chapters of my web development tutorial at 
> http://killer-web-development.com
>
> It's aimed at total web development beginners and uses web2py as framework.
>
> The idea was to write a web development tutorial based on web2py, because 
> web2py is the easiest
> to use web development solution - maybe I can rescue a few people from 
> starting with PHP.
>
> The book aims to be an mixture of railstutorial.org and the Head First 
> series. Lots of images and
> very low level subject matter. A the end readers will develop a full 
> microblogging service.
>
> I would appreciate any feedback.
>
> Best
> marco
>


[web2py] Re: debugging procedure

2012-07-06 Thread MJo
On Saturday, June 30, 2012 5:38:46 PM UTC+3, Cliff Kachinske wrote:
>
> Yes, the debugger is there on the application page.
>
> Works very well.
>
>
Latest "Version 2.00.0 (2012-07-04 23:30:47) dev" version is broken. While 
accessing http://127.0.0.1:8000/admin/debug/interact it gives "invalid view 
(debug/interact.html)". Is it me or just bug? (Never used this online 
debugger) 

-- MJo


[web2py] Multiple login pages - weird behaviour

2012-07-06 Thread Marek Mollin
I ran into very odd behaviour on web2py side.
Say I have an application and want my login in several places (templates 
are different so I cannot just do some creative routing).

Structure for logins goes like that.
/appname/order/signin
/appname/signin/index
/appname/place/signin

I setup my default login page in db.py with: 
auth.settings.login_url=URL('order','signin').

Problem start when I am on /appname/order/signin.
If authenatication fails I am taken to /appname/default/signin(Nowhere 
defined)

Anybody ran into something like that ?



Re: [web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-06 Thread Daniel Gonzale
I will try this weekend.

Massimo did you received the code of the apllication?

Thanks everyone



El 06/07/2012, a las 04:32, Massimo Di Pierro  
escribió:

> Looks like I prematurely close the issue. There is now a db.close() in trunk. 
> Please check it out.
> 
> massimo
> 
> On Thursday, 5 July 2012 13:05:47 UTC-5, nick name wrote:
> On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote:
> why not simply?
> 
> db.commit()
> db.close()
> 
> if db in an on object attribute like self.db you can do
> 
> if self.db:
>self.db.commit()
>self.db.close()
>self.db = 0
> 
> you can also do:
> 
> BaseAdapter.close_all_instances('commit')
> 
> This is not enough, as was documented on issue  
> http://code.google.com/p/web2py/issues/detail?id=731. The code that works for 
> me for sqlite is as follows:
> 
> def closebase(base):
> if not base: return
> # see: http://code.google.com/p/web2py/issues/detail?id=731
> # see: https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion
> # was: base._adapter.close()
> from gluon.dal import thread
> thread.instances.remove(base._adapter)
> base._adapter.close()
> 
> and then I call closebase(db); db = None which is enough for me with sqlite 
> -- but apparently, the original poster has tried that, and that is not 
> sufficient for mysql.


[web2py] Re: Multiple login pages - weird behaviour

2012-07-06 Thread Marek Mollin
I understand it should work, but have hardtime debugging it.
Just need ideas where to look for this wierd redirection.

W dniu piątek, 6 lipca 2012 12:51:05 UTC+2 użytkownik Marek Mollin napisał:
>
> I ran into very odd behaviour on web2py side.
> Say I have an application and want my login in several places (templates 
> are different so I cannot just do some creative routing).
>
> Structure for logins goes like that.
> /appname/order/signin
> /appname/signin/index
> /appname/place/signin
>
> I setup my default login page in db.py with: 
> auth.settings.login_url=URL('order','signin').
>
> Problem start when I am on /appname/order/signin.
> If authenatication fails I am taken to /appname/default/signin(Nowhere 
> defined)
>
> Anybody ran into something like that ?
>
>

[web2py] web2py vs ROR

2012-07-06 Thread murtaza52
Hi,

I am considering three frameworks for developing our commercial 
applications- 

1) web2py (choice #1)
2) ROR
3) Play framework

While my research I was intrigued by Massimo's post where he says that he 
would pick ROR over any of the current python frameworks. My question is 
how does web2py itself compare to ROR ? What are the views of those 
experienced with both the ecosystems ? 

http://www.ruby-forum.com/topic/209343

I have expereince with none so will rely on your answers :) The purpose of 
the question is not to start a flame war, but to understand why should 
web2py be chose over other frameworks which have much more traction today?

Thanks,
Murtaza



[web2py] Re: MySQL migration fails adding unique=

2012-07-06 Thread juaneduardo
Ok. This is a problem only with Mysql? with ProgreSQL too?

Eduardo

El jueves, 5 de julio de 2012 22:40:56 UTC-4, Massimo Di Pierro escribió:
>
> It is not like that field level migrations do not work. They work if, for 
> example you change a field type. They do not work it you change an 
> attribute (unique, notnull).
>
> On Thursday, 5 July 2012 16:40:42 UTC-5, MichaelF wrote:
>>
>> Thanks for that. I didn't realize field-level migrations don't work with 
>> MySQL. I'm no expert on web2py migrations (or even web2py!); is it just 
>> with MySQL that it has these problems?
>>
>> I suppose I could do this as an alternative to what you suggested: In 
>> web2py add a new field with unique, then in MySQL UPDATE all records, 
>> setting newField = oldField. I'd have to handle duplicates here, but at 
>> least I wouldn't lost all my data. Then, when satisfied, delete oldField 
>> and maybe rename newField to oldField.
>>
>> On Thursday, July 5, 2012 12:26:31 PM UTC-6, Jim S wrote:
>>>
>>> I believe that field level migrations do not work with MySQL.  I get 
>>> around this by removing the column, saving, run the app to force migration, 
>>> and then add the field back the way I want it.  I know this causes you to 
>>> lose the data in that column, but I only do this in my test environment and 
>>> have migrations turned off in production.
>>>
>>> Alternatively, you could update the column def in web2py, change 
>>> manually in mysql and then run with migrate=False, fake_migrate=True to get 
>>> things back in sync.
>>>
>>> Hope that helps.
>>>
>>> -Jim
>>>
>>> On Wednesday, July 4, 2012 10:29:10 AM UTC-5, MichaelF wrote:

 I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 
 3, 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
 (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
 to add `unique=True` the web2py migration fails with this error: `">>> 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
 name of the field in question.

 I've recreated the problem using a single-table application in web2py 
 using MySQL. Here's the model code:

 To start off (field not defined as unique):

 ... (usual model/db.py boilerplate)
 db = DAL('mysql://
 w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
 ...
 db.define_table('Institution',
 Field('Institution_name', 'string', length=60, 
 required=True),
 format='%(Institution_name)s')

 I go to the appadmin page and everything looks fine. Then, making 
 Institution_name unique:

 db.define_table('Institution',
 Field('Institution_name', 'string', length=60, 
 required=True,
unique=True),
 format='%(Institution_name)s')

 I then refresh the appadmin page and get a ticket with the error. The 
 error line in the traceback is the last line of the modified statement 
 above. And, to make things worse, I can go in and undo the `unique=True`, 
 but web2py doesn't respond if I refresh the appadmin page...or any page 
 served by that web server, even in other applications! The cpu is 
 not pinned while in this state. I have to recreate the app and 
 database to clear the problem. (Well, I think I have to go that far. Just 
 restarting web2py doesn't clear it in the full case, but does clear it in 
 my little one-table test case.) I try to stop the server 
 (web2py_no_console.exe), but it fails to respond.

 Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
 abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
 but I'd rather not, particularly as then I have to `try` that statement 
 because MySQL has no `...IF NOT EXIST...` capability for index creation.

 Also, if I start off the model with `unique=True` in the first place, 
 everything is fine, and MySQL even shows the unique index as created.



[web2py] Re: Multiple login pages - weird behaviour

2012-07-06 Thread Marin Pranjić
Hello Marek,

can you please try:

auth.settings.controller = 'order'



or:

auth = Auth(..., controller = 'order')




Regards,
Marin

Dana petak, 6. srpnja 2012. 12:51:05 UTC+2, korisnik Marek Mollin napisao 
je:
>
> I ran into very odd behaviour on web2py side.
> Say I have an application and want my login in several places (templates 
> are different so I cannot just do some creative routing).
>
> Structure for logins goes like that.
> /appname/order/signin
> /appname/signin/index
> /appname/place/signin
>
> I setup my default login page in db.py with: 
> auth.settings.login_url=URL('order','signin').
>
> Problem start when I am on /appname/order/signin.
> If authenatication fails I am taken to /appname/default/signin(Nowhere 
> defined)
>
> Anybody ran into something like that ?
>
>

Re: [web2py] please help us test web2py

2012-07-06 Thread Bruno Rocha
today I will test all my apps then I report here.

http://zerp.ly/rochacbruno
Em 06/07/2012 01:52, "Massimo Di Pierro" 
escreveu:

> There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL
> please help us check the new trunk did not break anything.
>
> We have salted password auth = Auth(...,salt=True). Check it out.
>
> We also have ability to deploy to openstack from admin.
>
> Thanks to all those who have and still are putting lots of time on this.
>
> massimo
>


Re: [web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

Il 06/07/2012 12:11, stefaan ha scritto:


Not sure if it would solve your problem, but sometimes you need to clear
the browser cache to see the effect of changes in css.


yes, but this is not my case. tnk



[web2py] Re: Multiple login pages - weird behaviour

2012-07-06 Thread Marek Mollin
Works splendid!
Also as an inline within  controller

W dniu piątek, 6 lipca 2012 13:51:39 UTC+2 użytkownik Marin Pranjić napisał:
>
> Hello Marek,
>
> can you please try:
>
> auth.settings.controller = 'order'
>
>
>
> or:
>
> auth = Auth(..., controller = 'order')
>
>
>
>
> Regards,
> Marin
>
> Dana petak, 6. srpnja 2012. 12:51:05 UTC+2, korisnik Marek Mollin napisao 
> je:
>>
>> I ran into very odd behaviour on web2py side.
>> Say I have an application and want my login in several places (templates 
>> are different so I cannot just do some creative routing).
>>
>> Structure for logins goes like that.
>> /appname/order/signin
>> /appname/signin/index
>> /appname/place/signin
>>
>> I setup my default login page in db.py with: 
>> auth.settings.login_url=URL('order','signin').
>>
>> Problem start when I am on /appname/order/signin.
>> If authenatication fails I am taken to /appname/default/signin(Nowhere 
>> defined)
>>
>> Anybody ran into something like that ?
>>
>>

Re: [web2py] please help us test web2py

2012-07-06 Thread vinicius...@gmail.com

Could you, please, tell us what should be tested?

What has changed?

By the way, what is "salt password"? I searched dictionary, but didn't 
find a good translation. Sorry my poor English.


--
Vinicius Assef


On 07/06/2012 01:52 AM, Massimo Di Pierro wrote:

There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL
please help us check the new trunk did not break anything.

We have salted password auth = Auth(...,salt=True). Check it out.

We also have ability to deploy to openstack from admin.

Thanks to all those who have and still are putting lots of time on this.

massimo




[web2py] Select with text field

2012-07-06 Thread Marcello
Hello all, 

I have a table with two text fields.
I'm trying to make a select with about 7,000 records in a console.
My memory goes up, until full, and then the process is killed

If I comment those text fields in the table definition and try again, it 
run the select without problem.

In the select, I don't use those fields

What cat I do to solve this ??


Thanks
Marcello


Re: [web2py] web2py vs ROR

2012-07-06 Thread ANIKET KADAM
nice question, but i thing i like in web2py is the installation process its
so simple but in rails it somewhat u know less easy than web2py.

On Fri, Jul 6, 2012 at 10:28 AM, murtaza52
wrote:

> Hi,
>
> I am considering three frameworks for developing our commercial
> applications-
>
> 1) web2py (choice #1)
> 2) ROR
> 3) Play framework
>
> While my research I was intrigued by Massimo's post where he says that he
> would pick ROR over any of the current python frameworks. My question is
> how does web2py itself compare to ROR ? What are the views of those
> experienced with both the ecosystems ?
>
> http://www.ruby-forum.com/topic/209343
>
> I have expereince with none so will rely on your answers :) The purpose of
> the question is not to start a flame war, but to understand why should
> web2py be chose over other frameworks which have much more traction today?
>
> Thanks,
> Murtaza
>
>


Re: [web2py] please help us test web2py

2012-07-06 Thread Alec Taylor
> By the way, what is "salt password"? I searched dictionary, but didn't find
> a good translation. Sorry my poor English.
http://en.wikipedia.org/wiki/Salt_%28cryptography%29

Basically means adding some padding to increase the strength of the
encryption without having the user create a longer password. (although
longer password would make that even more secure)


Re: [web2py] Re: Web Development Introduction Based On Web2py

2012-07-06 Thread Luc Chase
OK so you mean from beginner level. Thanks. I as soon as the sites is
accessible again I will try to give you good feedback.
On Jul 6, 2012 11:18 AM, "Luc Chase"  wrote:

> Marco,
> What does 'very low level' subject matter mean in this context?
> Is that to mean 'very detailed'?
>
> --
> Luc.
>
> On Tuesday, 20 December 2011 18:33:21 UTC, ma...@rockiger.com wrote:
>>
>> I published the first 3 chapters of my web development tutorial at
>> http://killer-web-development.**com 
>>
>> It's aimed at total web development beginners and uses web2py as
>> framework.
>>
>> The idea was to write a web development tutorial based on web2py, because
>> web2py is the easiest
>> to use web development solution - maybe I can rescue a few people from
>> starting with PHP.
>>
>> The book aims to be an mixture of railstutorial.org and the Head First
>> series. Lots of images and
>> very low level subject matter. A the end readers will develop a full
>> microblogging service.
>>
>> I would appreciate any feedback.
>>
>> Best
>> marco
>>
>


Re: [web2py] please help us test web2py

2012-07-06 Thread Richard Vézina
I try and report back!

Richard

On Fri, Jul 6, 2012 at 8:59 AM, Alec Taylor  wrote:

> > By the way, what is "salt password"? I searched dictionary, but didn't
> find
> > a good translation. Sorry my poor English.
> http://en.wikipedia.org/wiki/Salt_%28cryptography%29
>
> Basically means adding some padding to increase the strength of the
> encryption without having the user create a longer password. (although
> longer password would make that even more secure)
>


Re: [web2py] Select with text field

2012-07-06 Thread Richard Vézina
What the nature of the data in size?

Could you show us your select statment?

Richard

On Fri, Jul 6, 2012 at 8:41 AM, Marcello  wrote:

> Hello all,
>
> I have a table with two text fields.
> I'm trying to make a select with about 7,000 records in a console.
> My memory goes up, until full, and then the process is killed
>
> If I comment those text fields in the table definition and try again, it
> run the select without problem.
>
> In the select, I don't use those fields
>
> What cat I do to solve this ??
>
>
> Thanks
> Marcello
>


Re: [web2py] web2py vs ROR

2012-07-06 Thread Vasile Ermicioi
>
> he would pick ROR over any of the current python frameworks


http://www.ruby-forum.com/topic/209343

not over *any*, but over *most*

your affirmation is misleading


Re: [web2py] Re: Thinking of building a bug tracker...

2012-07-06 Thread Richard Vézina
I am pretty sure those things are pretty easy to implement...

Why not just add them in the issue on google code and if someone has time
he could just work on it.

Massimo can't support all the app he create to show us the way to go and
ask for poeple to take "paternity" of project to make sure they stay usable
with the new versions of web2py.

Also, I try i-Tracker, it much more usable I admit, but there a couples of
things that I don't like. 1) sometimes the UI is not pretty easy to
understand, 2) it not use the RBAC, so can't just export/import in csv my
user from one db to the other, 3) search don't seems to work, 4) it not up
to date in order to take advantage of the web2py new feature like
SQLFORM.grid for example.

Richard



On Thu, Jul 5, 2012 at 5:58 PM, Derek  wrote:

> It's got a lot more issues than that. It's pretty unusable at the moment.
> After you get it working, then you have to assign projects to people via ID
> number, and vice versa. You have to edit the database to get all new people
> loaded into the system (ie - there is no custom admin module to promote
> users to managers, etc). It's not a viable project, only there to show you
> what you can do if you half-ass a project to complete a poorly designed
> issue tracker.
>
> On Thursday, July 5, 2012 8:38:36 AM UTC-7, Richard wrote:
>>
>> Hello,
>>
>> Here a patch for web2py_issuetracker...
>> I didn't read the whole app, so I hope it still works as intended.
>>
>>
>> # HG changeset patch
>> # User Richard Vézina 
>> # Date 1341502246 14400
>> # Node ID d4a6372008825fa571f3f7b021b3e7**9fab7e7df4
>> # Parent  **e4535bcdef395d6e8b1f777e8466e1**fc74a2d0d1
>> Fix not working app
>>
>> diff -r e4535bcdef39 -r d4a637200882 controllers/default.py
>> --- a/controllers/default.py mar nov 01 08:23:10 2011 -0500
>> +++ b/controllers/default.py jeu jui 05 11:30:46 2012 -0400
>> @@ -18,11 +18,15 @@
>>
>>
>>  def projects():
>> -COLUMNS=('project.name','**project.author','project.repo'**
>> ,'project.license')
>> -LINKS=[lambda row: A('issues',_href=URL('issues',**args=row.id))]
>> +FIELDS=[db.project.name,
>> +db.project.author,
>> +db.project.repo,
>> +db.project.license,
>> +db.project.created_by] # created_by seems to be required in
>> the fields list
>> +LINKS=[lambda row: A('issues', _href=URL('issues', args=row.id))]
>>  def check(row): return (row.created_by == auth.user_id)
>> -grid = SQLFORM.grid(db.project,**editable=check,deletable=**check,
>> -columns = COLUMNS,links=LINKS)
>> +grid = SQLFORM.grid(db.project, editable=check, deletable=check,
>> +fields = FIELDS, field_id=db.project.id,
>> links=LINKS)
>>  return dict(grid=grid)
>>
>>  def issues():
>> @@ -49,13 +53,17 @@
>>  auth.user.email in (project.members_email or [])):
>>  db.issue.owner.writable = False
>>  db.issue.status.writable = False
>> -COLUMNS=('issue.status','**issue.summary','issue.created_**on',
>> - 'issue.author','issue.labels')
>> -LINKS=[lambda row: A('issue',_href=URL('issue',**args=row.uuid))]
>> -grid = SQLFORM.grid(query, columns = COLUMNS,links=LINKS,
>> -details=False,editable=False,
>> +FIELDS=[db.issue.status,
>> +db.issue.summary,
>> +db.issue.created_on,
>> +db.issue.author,
>> +db.issue.labels,
>> +db.issue.uuid] # uuid seems to be required in the fields list
>> +LINKS=[lambda row: A('issue', _href=URL('issue', args=row.uuid))]
>> +grid = SQLFORM.grid(query, fields = FIELDS, links=LINKS,
>> +details=False, editable=False,
>>  deletable=project.created_on=**=auth.user_id,
>> -
>> create=auth.user_id,args=[pro**ject.id
>> ],
>> +create=auth.user_id, args=[project.id],
>>  oncreate=lambda form:do_mail([db.issue(form.**
>> vars.id )]))
>>  return dict(grid=grid, project=project)
>>
>>
>> I will open a ticket on google code and post it there too, in case this
>> mail get lost.
>>
>> Richard
>>
>> On Sat, Jun 2, 2012 at 3:26 PM, Anthony  wrote:
>>
>>> Yes, that's one of Julio's, creator of http://www.qa-stack.com/ **and
>>> http://pyforum.org/. All three are listed on the Powered By site.
>>>
>>> Anthony
>>>
>>>
>>> On Saturday, June 2, 2012 3:13:40 PM UTC-4, Massimo Di Pierro wrote:

 I had not seen it. Looks really slick.

 On Friday, 1 June 2012 23:49:31 UTC-5, Bruce Wade wrote:
>
> i-track is the winner I already have it integrated into my project and
> will build off of it.
>
> On Fri, Jun 1, 2012 at 7:01 AM, Bruce Wade wrote:
>
>> issue tracker there is an error when you click on projects on the
>> demo not a good example :D
>> i-track looks like a very good starting po

[web2py] can CAS provider use a different database to apps?

2012-07-06 Thread Horus
I desire to have multiple apps. one of them will be a CAS provider My 
questions are:

1. Can these app have different databases
   i.e db = DAL('postgres://user:password@localhost:5432/cas', 
migrate=True), db = DAL('postgres://user:password@localhost:5432/db1', 
migrate=True),   db = DAL('postgres://user:password@localhost:5432/db2', 
migrate=True)

2. How do I access these database tables  across applications?
i.e how can app1 access CAS database OR how can app2 database to access 
app1 database



*Auth migration if disabled for all except CAS provider


Re: [web2py] please help us test web2py

2012-07-06 Thread Richard Vézina
Hello,

This line in my app failed with  '*table_name*'


dblabels_en = cache.ram('dblabels_en',
lambda: dict([(r.*table_name* + r.column_name, r.column_name_en_ui)\
 for r in db().select(db.dict_database.ALL)]),
time_expire=3600)

Is the way row behave have change?

Richard

On Fri, Jul 6, 2012 at 9:27 AM, Richard Vézina 
wrote:
>
> I try and report back!
>
> Richard
>
>
> On Fri, Jul 6, 2012 at 8:59 AM, Alec Taylor 
wrote:
>>
>> > By the way, what is "salt password"? I searched dictionary, but didn't
find
>> > a good translation. Sorry my poor English.
>> http://en.wikipedia.org/wiki/Salt_%28cryptography%29
>>
>> Basically means adding some padding to increase the strength of the
>> encryption without having the user create a longer password. (although
>> longer password would make that even more secure)
>
>


Re: [web2py] please help us test web2py

2012-07-06 Thread Richard Vézina
What I have to do to make it works :


for r in db().select(db.dict_database.ALL):
print r['"dict_database"."table_name"']

I have to use the table name and the field name as key to get row field
data, the worst is that it needs double quoting the table name and field
name and quote both...

It must be something wrong??

Richard

On Fri, Jul 6, 2012 at 10:05 AM, Richard Vézina  wrote:

> Hello,
>
> This line in my app failed with  '*table_name*
> '
>
>
> dblabels_en = cache.ram('dblabels_en',
> lambda: dict([(r.*table_name* + r.column_name, r.column_name_en_ui)\
>  for r in db().select(db.dict_database.ALL)]),
> time_expire=3600)
>
> Is the way row behave have change?
>
> Richard
>
>
> On Fri, Jul 6, 2012 at 9:27 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
> >
> > I try and report back!
> >
> > Richard
> >
> >
> > On Fri, Jul 6, 2012 at 8:59 AM, Alec Taylor 
> wrote:
> >>
> >> > By the way, what is "salt password"? I searched dictionary, but
> didn't find
> >> > a good translation. Sorry my poor English.
> >> http://en.wikipedia.org/wiki/Salt_%28cryptography%29
> >>
> >> Basically means adding some padding to increase the strength of the
> >> encryption without having the user create a longer password. (although
> >> longer password would make that even more secure)
> >
> >
>


Re: [web2py] Condition in view weird behaviour

2012-07-06 Thread Richard Vézina
Seems a little bug in template parser to me!

Richard

On Fri, Jul 6, 2012 at 3:17 AM, Annet  wrote:

> In a view I have the following code:
>
> 
>   {{if session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
>   {{pass}}
>   {{include 'site/promoUnit.html'}}
>   
>
> Despite session.cal.lesrooster, session.cal.event_list and
> session.cal.cursusrooster being False, site/calendar.html is being
> included. When I replace {{include 'site/calendar.html'}} with text
> the text isn't displayed.
>
> When I move the condition to site/calendar.html, the behaviour is the
> same, only when I have the condition both in the view and in
> site/calendar.html the page is rendered correctly.
>
> site/index.html:
>
> 
>   {{if session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
>   {{pass}}
>   {{include 'site/promoUnit.html'}}
>   
>
> site/calendar.html:
>
> {{if (session.cal.lesrooster or session.cal.event_list or
> session.cal.cursusrooster):}}
>   
> ...
>   
>
>   
> ...
>
>
>   
>...
>   
> {{pass}}
>
>
> Is there an explanation for this behaviour?
>
>
> Kind regards,
>
> Annet
>
>
>
>


[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread orsomannaro

Il 06/07/2012 10:31, orsomannaro ha scritto:

In a SQLFORM form I set:

buttons = [
  INPUT(_type='submit', _value='go', _class='btn btn-primary'),
  INPUT(_type='button', _value='info', _class='btn btn-info'),
]

but buttons have not bootstrap style (btn-primary button are not blue,
there are no space between the two button).



the problem seem to be _value


[web2py] Re: Condition in view weird behaviour

2012-07-06 Thread Anthony
{{include ...}} is not Python code but a web2py template language 
directive, so it is processed *before* any Python is processed. So, the 
content of site/calendar.html will be included in the parsed template no 
matter what. However, that content will still end up inside an "if" block, 
so should only be rendered if the "if" condition is true. Are you saying it 
is getting rendered even when the "if" condition is False?

Anthony

On Friday, July 6, 2012 3:17:46 AM UTC-4, Annet wrote:
>
> In a view I have the following code:
>
> 
>   {{if session.cal.lesrooster or session.cal.event_list or 
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
>   {{pass}}
>   {{include 'site/promoUnit.html'}}
>   
>
> Despite session.cal.lesrooster, session.cal.event_list and 
> session.cal.cursusrooster being False, site/calendar.html is being 
> included. When I replace {{include 'site/calendar.html'}} with text 
> the text isn't displayed.
>
> When I move the condition to site/calendar.html, the behaviour is the 
> same, only when I have the condition both in the view and in 
> site/calendar.html the page is rendered correctly.
>
> site/index.html:
>
> 
>   {{if session.cal.lesrooster or session.cal.event_list or 
> session.cal.cursusrooster:}}
> {{include 'site/calendar.html'}}
>   {{pass}}
>   {{include 'site/promoUnit.html'}}
>   
>
> site/calendar.html:
>
> {{if (session.cal.lesrooster or session.cal.event_list or 
> session.cal.cursusrooster):}}
>   
> ...
>   
>  
>   
> ...
>
>
>   
>...
>   
> {{pass}}
>
>
> Is there an explanation for this behaviour?
>
>
> Kind regards,
>
> Annet
>
>
>
>

Re: [web2py] Select with text field

2012-07-06 Thread Marcello Parra
Hello, Richard,


I save 2 HTML pages.

SELECT  processo.id, processo.na, processo.na_limpo, processo.nu,
processo.nu_limpo, processo.html, processo.html1, processo.processado,
processo.processado2, processo.processado_dia, processo.origem,
processo.classe, processo.fase, processo.assunto, processo.instancia,
processo.json, processo.conferido, processo.autuado_dia,
processo.orgao_julgador, processo.relator, processo.autor, processo.reu,
processo.advs, processo.autor1, processo.reu1, processo.acompanhando_dia,
processo.encerrado_dia, processo.vara, processo.numero_origem,
processo.ultimo_andamento_dia, processo.ultimo_andamento,
processo.sentenca, processo.sentenca_dia, processo.sentenca_crc,
processo.1_crc, processo.2_crc, processo.enviado_dia, processo.created_at
FROM processo WHERE (processo.encerrado_dia IS NULL);


One solution is select just the fields I need and not the TEXT ones...

But I found that should be an easier way


Thanks...




On Fri, Jul 6, 2012 at 10:30 AM, Richard Vézina  wrote:

> What the nature of the data in size?
>
> Could you show us your select statment?
>
> Richard
>
>
> On Fri, Jul 6, 2012 at 8:41 AM, Marcello  wrote:
>
>> Hello all,
>>
>> I have a table with two text fields.
>> I'm trying to make a select with about 7,000 records in a console.
>> My memory goes up, until full, and then the process is killed
>>
>> If I comment those text fields in the table definition and try again, it
>> run the select without problem.
>>
>> In the select, I don't use those fields
>>
>> What cat I do to solve this ??
>>
>>
>> Thanks
>> Marcello
>>
>
>


Re: [web2py] Select with text field

2012-07-06 Thread Richard Vézina
Are you running this request as raw SQL with executesql??

http://web2py.com/books/default/chapter/29/6#executesql

If your request is slow at backend level, maybe you have a problem with
your design...

What is your backend?

Richard

On Fri, Jul 6, 2012 at 11:12 AM, Marcello Parra  wrote:

> Hello, Richard,
>
>
> I save 2 HTML pages.
>
> SELECT  processo.id, processo.na, processo.na_limpo, processo.nu,
> processo.nu_limpo, processo.html, processo.html1, processo.processado,
> processo.processado2, processo.processado_dia, processo.origem,
> processo.classe, processo.fase, processo.assunto, processo.instancia,
> processo.json, processo.conferido, processo.autuado_dia,
> processo.orgao_julgador, processo.relator, processo.autor, processo.reu,
> processo.advs, processo.autor1, processo.reu1, processo.acompanhando_dia,
> processo.encerrado_dia, processo.vara, processo.numero_origem,
> processo.ultimo_andamento_dia, processo.ultimo_andamento,
> processo.sentenca, processo.sentenca_dia, processo.sentenca_crc,
> processo.1_crc, processo.2_crc, processo.enviado_dia, processo.created_at
> FROM processo WHERE (processo.encerrado_dia IS NULL);
>
>
> One solution is select just the fields I need and not the TEXT ones...
>
> But I found that should be an easier way
>
>
> Thanks...
>
>
>
>
> On Fri, Jul 6, 2012 at 10:30 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> What the nature of the data in size?
>>
>> Could you show us your select statment?
>>
>> Richard
>>
>>
>> On Fri, Jul 6, 2012 at 8:41 AM, Marcello  wrote:
>>
>>> Hello all,
>>>
>>> I have a table with two text fields.
>>> I'm trying to make a select with about 7,000 records in a console.
>>> My memory goes up, until full, and then the process is killed
>>>
>>> If I comment those text fields in the table definition and try again, it
>>> run the select without problem.
>>>
>>> In the select, I don't use those fields
>>>
>>> What cat I do to solve this ??
>>>
>>>
>>> Thanks
>>> Marcello
>>>
>>
>>
>


[web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread Horus
Additionally...


I currently have three apps, including CAS server
the case server app also contain other tables

db.define_table('base_tags',
Field('name', 'string', label='Tag', length=64, 
required=True, notnull=True),
format='%(name)s'
)
and many more

some of these tables in the CAS server db model is accessed by the other 
apps.


db.define_table('places_tags',
Field('place_id', db.places, label='Place', required=True, 
notnull=True, writable=False, readable=False),
Field('tag_id', *db.base_tags*, label='Tag', required=True, 
notnull=True, writable=False, readable=False)
)


I am getting this error:


Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:/web2py/applications/histreet/models/db.py" 
, line 374, in 

Field('tag_id', db.base_tags, label='Tag', required=True, notnull=True, 
writable=False, readable=False)
  File "C:\web2py\gluon\dal.py", line 6343, in __getattr__
return self[key]
  File "C:\web2py\gluon\dal.py", line 6337, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'base_tags'


*Does anyone know why this is happening?*

***Migrate is off for auth
** Migrate is on for all other tables (changed it to off got the same error)
*




On Friday, July 6, 2012 10:02:53 AM UTC-4, Horus wrote:
>
> I desire to have multiple apps. one of them will be a CAS provider My 
> questions are:
>
> 1. Can these app have different databases
>i.e db = DAL('postgres://user:password@localhost:5432/cas', 
> migrate=True), db = DAL('postgres://user:password@localhost:5432/db1', 
> migrate=True),   db = DAL('postgres://user:password@localhost:5432/db2', 
> migrate=True)
>
> 2. How do I access these database tables  across applications?
> i.e how can app1 access CAS database OR how can app2 database to 
> access app1 database
>
>
>
> *Auth migration if disabled for all except CAS provider
>


Re: [web2py] [Version 1.96.4] DAL timing issue.

2012-07-06 Thread Richard Vézina
Thought that db().select(db.table.ALL) was better, sorry for miss leading
you Santiago.

Richard

On Thu, Jul 5, 2012 at 5:43 PM, Anthony  wrote:

> Also, your request should not be : db().select(db.voting_center**)
>> instead of db(db.voting_center).**select()
>
>
> If he wants to select all records and all fields, then
> db(db.voting_center).select() is the correct query.
>
> Anthony
>


[web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread David Marko
Well CAS is for central authentication, not for sharing database tables ... . 
The error you got simply says that your second app cant see tables from cas 
provider app.


[web2py] Re: Condition in view weird behaviour

2012-07-06 Thread Annet


>   Are you saying it is getting rendered even when the "if" condition is 
> False?
>

Yes, this is what happens.

Despite session.cal.lesrooster, session.cal.event_list and 
>> session.cal.cursusrooster being False, site/calendar.html is being 
>> included. When I replace {{include 'site/calendar.html'}} with text 
>> the text isn't displayed.
>>
>> When I move the condition to site/calendar.html, the behaviour is the 
>> same, only when I have the condition both in the view and in 
>> site/calendar.html the page is rendered correctly.
>>
>> site/index.html:
>>
>> 
>>   {{if session.cal.lesrooster or session.cal.event_list or 
>> session.cal.cursusrooster:}}
>> {{include 'site/calendar.html'}}
>>   {{pass}}
>>   {{include 'site/promoUnit.html'}}
>>   
>>
>> site/calendar.html:
>>
>> {{if (session.cal.lesrooster or session.cal.event_list or 
>> session.cal.cursusrooster):}}
>>   
>> ...
>>   
>>  
>>   
>> ...
>>
>>
>>   
>>...
>>   
>> {{pass}}
>>
>

Annet 


Re: [web2py] Select with text field

2012-07-06 Thread Marcello Parra
I'm not using executesql...

I'm trying just:

query = q_processos.select()


It seems to load all data from database...




On Fri, Jul 6, 2012 at 12:40 PM, Richard Vézina  wrote:

> Are you running this request as raw SQL with executesql??
>
> http://web2py.com/books/default/chapter/29/6#executesql
>
> If your request is slow at backend level, maybe you have a problem with
> your design...
>
> What is your backend?
>
> Richard
>
>
> On Fri, Jul 6, 2012 at 11:12 AM, Marcello Parra wrote:
>
>> Hello, Richard,
>>
>>
>> I save 2 HTML pages.
>>
>> SELECT  processo.id, processo.na, processo.na_limpo, processo.nu,
>> processo.nu_limpo, processo.html, processo.html1, processo.processado,
>> processo.processado2, processo.processado_dia, processo.origem,
>> processo.classe, processo.fase, processo.assunto, processo.instancia,
>> processo.json, processo.conferido, processo.autuado_dia,
>> processo.orgao_julgador, processo.relator, processo.autor, processo.reu,
>> processo.advs, processo.autor1, processo.reu1, processo.acompanhando_dia,
>> processo.encerrado_dia, processo.vara, processo.numero_origem,
>> processo.ultimo_andamento_dia, processo.ultimo_andamento,
>> processo.sentenca, processo.sentenca_dia, processo.sentenca_crc,
>> processo.1_crc, processo.2_crc, processo.enviado_dia, processo.created_at
>> FROM processo WHERE (processo.encerrado_dia IS NULL);
>>
>>
>> One solution is select just the fields I need and not the TEXT ones...
>>
>> But I found that should be an easier way
>>
>>
>> Thanks...
>>
>>
>>
>>
>> On Fri, Jul 6, 2012 at 10:30 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> What the nature of the data in size?
>>>
>>> Could you show us your select statment?
>>>
>>> Richard
>>>
>>>
>>> On Fri, Jul 6, 2012 at 8:41 AM, Marcello  wrote:
>>>
 Hello all,

 I have a table with two text fields.
 I'm trying to make a select with about 7,000 records in a console.
 My memory goes up, until full, and then the process is killed

 If I comment those text fields in the table definition and try again,
 it run the select without problem.

 In the select, I don't use those fields

 What cat I do to solve this ??


 Thanks
 Marcello

>>>
>>>
>>
>


[web2py] Re: How to use twitter bootstrap style

2012-07-06 Thread Annet
To change the value of a button, this should work:

form.element(_type='submit')['_value']='Login'

To add the info button:

form[0][-1][1].append(INPUT(_type="button",_value="Info",_onclick="document.location='%s'"
 
%URL('function')))

To add the classes:

form.element(_type='submit')['_class']='btn btn-primary'
form.element(_type='button')['_class']='btn btn-info'


Annet



[web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread Horus
Yes I understand CAS is for central auth, so i have let the cas provider be 
the app that takes care of login, registration, signup, what have you; as 
it should
the tables are being created, so I am assuming that the other apps should 
be able to access the tables if they exist all in the same database.

The underlying question, as I had added.
*
how does web2py perform multiple database information exchange?*


On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote:
>
> Well CAS is for central authentication, not for sharing database tables 
> ... . The error you got simply says that your second app cant see tables 
> from cas provider app.



[web2py] Re: Web2py hanging with no errors in the log

2012-07-06 Thread msmagoo
Unfortunately those logs did not tell me anything I didn't already know. 
Besides errors that came up while I was developing and testing, there was 
nothing new in there. The application is still crashing once a day and 
nothing in the console output or the error page of the site have told me 
anything useful.

I do have an alternate question, however.
I see this error very frequently in the console log:
ERROR:Rocket.Errors.Port8080:Traceback (most recent call last):
  File "/opt/apps/web2py/gluon/rocket.py", line 562, in listen
sock = self.wrap_socket(sock)
  File "/opt/apps/web2py/gluon/rocket.py", line 506, in wrap_socket
ssl_version = ssl.PROTOCOL_SSLv23)
  File "/usr/lib/python2.7/ssl.py", line 381, in wrap_socket
ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 143, in __init__
self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 305, in do_handshake
self._sslobj.do_handshake()
error: [Errno 104] Connection reset by peer

And when I say frequently I don't mean a few times a day, I mean constantly 
throughout the day. I realize this is caused by a client not waiting for 
the site to load before navigating away, however it doesn't make sense that 
this would happen that often. Like I explained earlier, this is a 
healthcheck application used by our 24x7 support teams to monitor the 
health of our servers, they will have the application sitting in a web 
browser constantly. They wouldn't be navigating away every few minutes. 
Does anyone know any other way this error could be caused so frequently?

Thanks!

On Friday, June 22, 2012 1:34:35 PM UTC-7, msmagoo wrote:
>
> Hi all, 
>
> I have a web2py healthcheck monitoring application. Basically the only 
> thing the 
> application does is make database queries to find healthcheck data and 
> make REST 
> api calls to a separate web2py application for information on the 
> environment. 
>
> Recently the application has been "crashing" at least once a day. The 
> web2py 
> process still exists, but users are unable to connect to the application. 
> There 
> are no errors in the logs or any useful information in the httpserver.log, 
> it's 
> like web2py just hangs and I have to restart it. I'm at my wits end trying 
> to 
> figure out what is happening so I figured I'd see if anyone has 
> experienced this 
> before or has any tips on log files I'm unaware of to check. 
>
> Thanks! 
>
>

[web2py] paymentech: post request

2012-07-06 Thread Adi

Could anyone please advise if I'm doing this correctly? I'm trying to post 
a request to Paymentech gateway. When I try the link in a browser, it 
responds fine (https://orbitalvar1.paymentech.net/authorize:443), but using 
post as bellow returns an error. Most likely I'm doing something wrong, but 
can't figure out what.

Thanks,
Adnan


*CODE:*
import sys, httplib

request = xml_string # "proper xml request..."

HOST = "https://orbitalvar1.paymentech.net/authorize:443";
# tried without https as well: HOST = 
"orbitalvar1.paymentech.net/authorize:443"
webservice = httplib.HTTPS(HOST)
webservice.putrequest("POST", '')
webservice.putheader("Host", HOST)
webservice.putheader("User-Agent","Python post")
webservice.putheader("Content-Type", "application/PTI46")
webservice.putheader("Content-transfer-encoding", "text")
webservice.putheader("Content-length", "%d" % len(request))
webservice.endheaders()
webservice.send(request)
statuscode, statusmessage, header = webservice.getreply()
print statuscode, statusmessage, header

*TRACEBACK:*
Traceback (most recent call last):
  File "/Users/adnan/web2py-dev-branch8/gluon/restricted.py", line 205, in 
restricted
exec ccode in environment
  File 
"/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
 
line 898, in 
  File "/Users/adnan/web2py-dev-branch8/gluon/globals.py", line 173, in 

self._caller = lambda f: f()
  File 
"/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
 
line 43, in test_pmt
paymentech.do_request(xml_string)
  File "applications/dev_thanemobile/modules/paymentech.py", line 46, in 
do_request
webservice.endheaders()
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 937, in endheaders
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 797, in _send_output
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 759, in send
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 1140, in connect
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 553, in create_connection
*gaierror: [Errno 8] nodename nor servname provided, or not known*



Re: [web2py] html5 background video script

2012-07-06 Thread howesc
i use jPlayer and it's timing events to track a variety of statistics 
around audio that i play.  i suspect it works just as well for video.

On Thursday, July 5, 2012 3:01:46 AM UTC-7, encompass wrote:
>
> There are usually javascript plugins that you can have handle any 
> function you like when the video ends... 
> Never used this but a quick google lead me to here... 
> http://jplayer.org/latest/developer-guide/#jPlayer-events 
> Notice it has event handling for when the video has ended. 
> BR, 
> Jason 
>
> On 07/05/2012 12:12 PM, lucas wrote: 
> > hello one and all, 
> > 
> > i am good with server-side processing.  very new to client-side java 
> > script stuff.  i think this idea requires that; please give me your 
> > best advice. 
> > 
> > client loads a page that contains html5 video.  user hits play on one 
> > of the videos on the page and is watching it.  what is the best 
> > approach to writing a client-side script, java script, ajax, etc., 
> > that will report the ending time of the video watch by the user if the 
> > video played either to the end, was paused, or stopped by the user? 
> >  you can see i want data on the server for how long the user is 
> > watching the video so that that data can be analyzed and such 
> > information sent back to the video producer for feedback and such. 
> > 
> > i am guessing the video player buttons would have to trigger their 
> > onclick events of the pause/stop buttons to run the client-side 
> > script, also the onend/oncompletion of the video, in which the script 
> > will then grab the final video time and report that back to the server 
> > through some predesigned communication data protocol exchange.  that 
> > is all i can guess at this point.  please help me write such a script 
> > and give direction. 
> > 
> > thank you in advance and have a great week.  lucas 
>
>
>

Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread vinicius...@gmail.com

Short answer: manually.

You cannot connect (join or make a relation) fields among different 
databases.




On 07/06/2012 02:16 PM, Horus wrote:

Yes I understand CAS is for central auth, so i have let the cas provider
be the app that takes care of login, registration, signup, what have
you; as it should
the tables are being created, so I am assuming that the other apps
should be able to access the tables if they exist all in the same database.

The underlying question, as I had added.
*
how does web2py perform multiple database information exchange?*


On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote:

Well CAS is for central authentication, not for sharing database
tables ... . The error you got simply says that your second app cant
see tables from cas provider app.





Re: [web2py] Select with text field

2012-07-06 Thread vinicius...@gmail.com

How much data (in KB ou MB) are loaded into these text fields?

Could you show us your model file where you execute this define_table()? 
(aka db.py)




On 07/06/2012 02:04 PM, Marcello Parra wrote:

I'm not using executesql...

I'm trying just:

query = q_processos.select()


It seems to load all data from database...




On Fri, Jul 6, 2012 at 12:40 PM, Richard Vézina
mailto:ml.richard.vez...@gmail.com>> wrote:

Are you running this request as raw SQL with executesql??

http://web2py.com/books/default/chapter/29/6#executesql

If your request is slow at backend level, maybe you have a problem
with your design...

What is your backend?

Richard


On Fri, Jul 6, 2012 at 11:12 AM, Marcello Parra mailto:parro...@gmail.com>> wrote:

Hello, Richard,


I save 2 HTML pages.

SELECT processo.id , processo.na
, processo.na_limpo, processo.nu
, processo.nu_limpo, processo.html,
processo.html1, processo.processado, processo.processado2,
processo.processado_dia, processo.origem, processo.classe,
processo.fase, processo.assunto, processo.instancia,
processo.json, processo.conferido, processo.autuado_dia,
processo.orgao_julgador, processo.relator, processo.autor,
processo.reu, processo.advs, processo.autor1, processo.reu1,
processo.acompanhando_dia, processo.encerrado_dia,
processo.vara, processo.numero_origem,
processo.ultimo_andamento_dia, processo.ultimo_andamento,
processo.sentenca, processo.sentenca_dia, processo.sentenca_crc,
processo.1_crc, processo.2_crc, processo.enviado_dia,
processo.created_at FROM processo WHERE (processo.encerrado_dia
IS NULL);


One solution is select just the fields I need and not the TEXT
ones...

But I found that should be an easier way


Thanks...




On Fri, Jul 6, 2012 at 10:30 AM, Richard Vézina
mailto:ml.richard.vez...@gmail.com>> wrote:

What the nature of the data in size?

Could you show us your select statment?

Richard


On Fri, Jul 6, 2012 at 8:41 AM, Marcello mailto:parro...@gmail.com>> wrote:

Hello all,

I have a table with two text fields.
I'm trying to make a select with about 7,000 records in
a console.
My memory goes up, until full, and then the process is
killed

If I comment those text fields in the table definition
and try again, it run the select without problem.

In the select, I don't use those fields

What cat I do to solve this ??


Thanks
Marcello









[web2py] Re: web2py vs ROR

2012-07-06 Thread pbreit
I think the main thing is that Rails is much more prevalent and so easier 
to sell to other team members, recruits, etc. Web2py is much easier to use.

Re: [web2py] please help us test web2py

2012-07-06 Thread Alec Taylor
On Fri, Jul 6, 2012 at 2:52 PM, Massimo Di Pierro
 wrote:
> There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL
> please help us check the new trunk did not break anything.
>
> We have salted password auth = Auth(...,salt=True). Check it out.
>
> We also have ability to deploy to openstack from admin.
>
> Thanks to all those who have and still are putting lots of time on this.
>
> massimo

Alright, I'll test OpenStack.

Just created an account there + namespace + uploaded my pubkey.

Connection keeps timing out though, so will retry tomorrow :\


Re: [web2py] Re: web2py vs ROR

2012-07-06 Thread Bruno Rocha
Rails has 37 signals, 37 signals has a very good marketing team. Thats it!


[web2py] Re: web2py vs ROR

2012-07-06 Thread Cliff Kachinske
I tried ROR.

As a relative noob to both Python and Ruby I will testify that Python 
allows much more concise and readable code.  This means less typing and 
easier debugging.

This means, in turn, that the time from project start to final payment 
checkpoint is shorter and the ongoing maintenance burden is less.

Over time, the ongoing maintenance burden is the higher cost.

On Friday, July 6, 2012 1:58:36 AM UTC-4, murtaza52 wrote:
>
> Hi,
>
> I am considering three frameworks for developing our commercial 
> applications- 
>
> 1) web2py (choice #1)
> 2) ROR
> 3) Play framework
>
> While my research I was intrigued by Massimo's post where he says that he 
> would pick ROR over any of the current python frameworks. My question is 
> how does web2py itself compare to ROR ? What are the views of those 
> experienced with both the ecosystems ? 
>
> http://www.ruby-forum.com/topic/209343
>
> I have expereince with none so will rely on your answers :) The purpose of 
> the question is not to start a flame war, but to understand why should 
> web2py be chose over other frameworks which have much more traction today?
>
> Thanks,
> Murtaza
>
>

Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread Horus
Right  viniciusban  i agree. i don't want to perform joins across databases 
explicitly i have never seen that in SQL
BUT I can use the user id from the CAS provider to refer to other tables in 
a database

let's say the *CAS* provider has this table called *auth_user* with a field 
called *id*.
let's say I have another app called *APP1* with a table called* user_exams*with 
a field called 
*user_id*

To make a relationship I can manually get the id from the auth_user table 
(db.auth_user)
and then apply it to the user_exams.

the *CAS* provider contains this table

db.define_table('base_tags',
Field('name', 'string', label='Tag', length=64, 
required=True, notnull=True),
format='%(name)s'
)

*APP1* contains a this table

db.define_table('places_tags',
Field('place_id', db_app1.places, label='Place', 
required=True, notnull=True, writable=False, readable=False),
Field('tag_id', *db_cas.base_tags*, label='Tag', 
required=True, notnull=True, writable=False, readable=False)
)

*Are you saying that Web2Py will not get id from base tags and make that 
relationship?*



On Friday, July 6, 2012 1:56:47 PM UTC-4, viniciusban wrote:
>
> Short answer: manually. 
>
> You cannot connect (join or make a relation) fields among different 
> databases. 
>
>
>
> On 07/06/2012 02:16 PM, Horus wrote: 
> > Yes I understand CAS is for central auth, so i have let the cas provider 
> > be the app that takes care of login, registration, signup, what have 
> > you; as it should 
> > the tables are being created, so I am assuming that the other apps 
> > should be able to access the tables if they exist all in the same 
> database. 
> > 
> > The underlying question, as I had added. 
> > * 
> > how does web2py perform multiple database information exchange?* 
> > 
> > 
> > On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote: 
> > 
> > Well CAS is for central authentication, not for sharing database 
> > tables ... . The error you got simply says that your second app cant 
> > see tables from cas provider app. 
> > 
>
>

[web2py] Re: Web2py hanging with no errors in the log

2012-07-06 Thread Cliff Kachinske
An infinite loop causes this behavior.  Don't Ask Me How I Know This :).

Also, with Postgres, I *think* this has happened because certain migrations 
cause existing data in a field to fail a new constraint.  This would happen 
if you make notnull=True on a field that already contains null.  However, 
if your all your models execute on every request you will see this happen 
right away.  It won't be intermittent.

On Friday, June 22, 2012 4:34:35 PM UTC-4, Maggs wrote:
>
> Hi all, 
>
> I have a web2py healthcheck monitoring application. Basically the only 
> thing the 
> application does is make database queries to find healthcheck data and 
> make REST 
> api calls to a separate web2py application for information on the 
> environment. 
>
> Recently the application has been "crashing" at least once a day. The 
> web2py 
> process still exists, but users are unable to connect to the application. 
> There 
> are no errors in the logs or any useful information in the httpserver.log, 
> it's 
> like web2py just hangs and I have to restart it. I'm at my wits end trying 
> to 
> figure out what is happening so I figured I'd see if anyone has 
> experienced this 
> before or has any tips on log files I'm unaware of to check. 
>
> Thanks! 
>
>

Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread Horus
*I will put all my tables in one app and call it a day!*

On Friday, July 6, 2012 2:40:32 PM UTC-4, Horus wrote:
>
> Right  viniciusban  i agree. i don't want to perform joins across 
> databases explicitly i have never seen that in SQL
> BUT I can use the user id from the CAS provider to refer to other tables 
> in a database
>
> let's say the *CAS* provider has this table called *auth_user* with a 
> field called *id*.
> let's say I have another app called *APP1* with a table called* user_exams
> * with a field called *user_id*
>
> To make a relationship I can manually get the id from the auth_user table 
> (db.auth_user)
> and then apply it to the user_exams.
>
> the *CAS* provider contains this table
>
> db.define_table('base_tags',
> Field('name', 'string', label='Tag', length=64, 
> required=True, notnull=True),
> format='%(name)s'
> )
>
> *APP1* contains a this table
>
> db.define_table('places_tags',
> Field('place_id', db_app1.places, label='Place', 
> required=True, notnull=True, writable=False, readable=False),
> Field('tag_id', *db_cas.base_tags*, label='Tag', 
> required=True, notnull=True, writable=False, readable=False)
> )
>
> *Are you saying that Web2Py will not get id from base tags and make that 
> relationship?*
>
>
>
> On Friday, July 6, 2012 1:56:47 PM UTC-4, viniciusban wrote:
>>
>> Short answer: manually. 
>>
>> You cannot connect (join or make a relation) fields among different 
>> databases. 
>>
>>
>>
>> On 07/06/2012 02:16 PM, Horus wrote: 
>> > Yes I understand CAS is for central auth, so i have let the cas 
>> provider 
>> > be the app that takes care of login, registration, signup, what have 
>> > you; as it should 
>> > the tables are being created, so I am assuming that the other apps 
>> > should be able to access the tables if they exist all in the same 
>> database. 
>> > 
>> > The underlying question, as I had added. 
>> > * 
>> > how does web2py perform multiple database information exchange?* 
>> > 
>> > 
>> > On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote: 
>> > 
>> > Well CAS is for central authentication, not for sharing database 
>> > tables ... . The error you got simply says that your second app 
>> cant 
>> > see tables from cas provider app. 
>> > 
>>
>>

[web2py] Anyone using Sunburnt for Apache SOLR access from web2py?

2012-07-06 Thread David Marko
Anyone using Sunburnt for Apache SOLR access from web2py? ( 
http://opensource.timetric.com/sunburnt  )

Any caveats I should expect or no problems on the path? (I mean sunburt 
 vs./in web2py)


Thank you ...
David




[web2py] Website running extremely slow

2012-07-06 Thread wdtatenh
My website is deployed on webfaction. I've compiled the application before 
uploading.

Doesn't seem to matter what page is requested, we're talking about 3 to 5 
seconds to download (I have high speed internet).  Any thoughts?  When I go 
to the normal webfaction admin pages, I don't have these kinds of delays. 

I'm wondering whether there might a memory issue that's being created 
running web2py???  Perhaps not??? Scratching my head.

Appreciate any thoughts anyone might have.

thanks in advance
Bill 


Re: [web2py] Re: can CAS provider use a different database to apps?

2012-07-06 Thread vinicius...@gmail.com

That's a good question, Horus. :-/

I haven't tried that. Theoretically, db_cas.base_tags field could be 
referenced because it needs the db object.


Let us know about your progress on it.

--
Vinicius Assef



On 07/06/2012 03:40 PM, Horus wrote:

Right viniciusban i agree. i don't want to perform joins across
databases explicitly i have never seen that in SQL
BUT I can use the user id from the CAS provider to refer to other tables
in a database

let's say the *CAS* provider has this table called *auth_user* with a
field called *id*.
let's say I have another app called *APP1* with a table
called*user_exams* with a field called *user_id*

To make a relationship I can manually get the id from the auth_user
table (db.auth_user)
and then apply it to the user_exams.

the *CAS* provider contains this table

db.define_table('base_tags',
 Field('name', 'string', label='Tag', length=64,
required=True, notnull=True),
 format='%(name)s'
 )

*APP1* contains a this table

db.define_table('places_tags',
 Field('place_id', db_app1.places, label='Place',
required=True, notnull=True, writable=False, readable=False),
 Field('tag_id', *db_cas.base_tags*, label='Tag',
required=True, notnull=True, writable=False, readable=False)
 )

*Are you saying that Web2Py will not get id from base tags and make that
relationship?*



On Friday, July 6, 2012 1:56:47 PM UTC-4, viniciusban wrote:

Short answer: manually.

You cannot connect (join or make a relation) fields among different
databases.



On 07/06/2012 02:16 PM, Horus wrote:
> Yes I understand CAS is for central auth, so i have let the cas provider
> be the app that takes care of login, registration, signup, what have
> you; as it should
> the tables are being created, so I am assuming that the other apps
> should be able to access the tables if they exist all in the same 
database.
>
> The underlying question, as I had added.
> *
> how does web2py perform multiple database information exchange?*
>
>
> On Friday, July 6, 2012 12:45:16 PM UTC-4, David Marko wrote:
>
> Well CAS is for central authentication, not for sharing database
> tables ... . The error you got simply says that your second app cant
> see tables from cas provider app.
>





[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread Massimo Di Pierro
Notice that these two lines:

Field('image_file','blob'),
Field('image_upload','upload',uploadfield= Field('image_file','blob'))

should be

Field('image_file','blob'),
Field('image_upload','upload',uploadfield= 'image_file'),

or simply

Field('image_upload','upload',uploadfield= Field('image_file','blob'))

The blob should be created automatically.


On Thursday, 5 July 2012 06:23:31 UTC-5, RCTYCO wrote:
>
>
> I am trying to save an image from another database into my 
> database, essentially i am caching the a copy into my database so I don't 
> have to query the external site. 
>
> I have a link 
> http://eandata.com/image/products/004/900/000/004900443.jpg. 
>
> I want to save the jpg into a blob in my database.
>
> Model
> db.define_table('image',
> Field('url','string'),
> Field('image_upload','upload',uploadfield='image_file'),
> Field('image_file','blob'))
>
> Function. I have this running a module and called when I need to download 
> the external image.
>
> def getImage(url,db): 
> 
> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
> headers = {'User-Agent': user_agent}
> 
> req = urllib2.Request(url,"",headers)
> 
> try:
> response = urllib2.urlopen(req)
> except urllib2.URLError, e:
> if hasattr(e, 'reason'):
> print 'We failed to reach a server.'
> print 'Reason: ', e.reason
> elif hasattr(e, 'code'):
> print 'The server couldn\'t fulfill the request.'
> print 'Error code: ', e.code
> else:
> pass # everything is fine
> 
> print response.geturl()
> print response.info()
> print response.read()
> f = open(response.read(),'rb')
> #stream = open(response,'rb')
> 
> return 
> db.image.insert(url=url,image=db.image.image_upload.store(f,url))
>
>
> *I am having a problem with my insert statement. I can't seem to figure 
> out how to save the image into database.* urllib2.urlopen(req) will 
> download the file and provide a file object. But I don't know if i can just 
> save the file or do i need to read the file object within 
> the urllib2.urlopen(req).
>
> I would like the image to be available to be via 
> http://mydomain.com/myapp/imageLookup?id=2 
> 
>
> Controller
> def imageLookup():
> id = request.vars.id
> #response.headers['Content-Type']='image/jpeg' 
> 
> return db.image[id].image_file
>
>
> Do you have any suggestions? The code abo
>


Re: [web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-06 Thread Massimo Di Pierro
I do not recall. Can you resend it please. My personal inbox is a bit messy.

On Friday, 6 July 2012 05:51:04 UTC-5, demetrio wrote:
>
> I will try this weekend.
>
> Massimo did you received the code of the apllication?
>
> Thanks everyone
>
>
>
> El 06/07/2012, a las 04:32, Massimo Di Pierro  
> escribió:
>
> Looks like I prematurely close the issue. There is now a db.close() in 
> trunk. Please check it out.
>
> massimo
>
> On Thursday, 5 July 2012 13:05:47 UTC-5, nick name wrote:
>>
>> On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote:
>>>
>>> why not simply?
>>>
>>> db.commit()
>>> db.close()
>>>
>>> if db in an on object attribute like self.db you can do
>>>
>>> if self.db:
>>>self.db.commit()
>>>self.db.close()
>>>self.db = 0
>>>
>>> you can also do:
>>>
>>> BaseAdapter.close_all_instances('commit')
>>>
>>
>> This is not enough, as was documented on issue  
>> http://code.google.com/p/web2py/issues/detail?id=731.
>>  
>> The code that works for me for sqlite is as follows:
>>
>> def closebase(base):
>> if not base: return
>> # see: http://code.google.com/p/web2py/issues/detail?id=731
>> # see: 
>> https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion
>> # was: base._adapter.close()
>> from gluon.dal import thread
>> thread.instances.remove(base._adapter)
>> base._adapter.close()
>>
>> and then I call closebase(db); db = None which is enough for me with 
>> sqlite -- but apparently, the original poster has tried that, and that is 
>> not sufficient for mysql.
>>
>

[web2py] Re: MySQL migration fails adding unique=

2012-07-06 Thread Massimo Di Pierro
What I said was wrong. I had to look at the source code and what it does is 
a bit more complex.

If the SQL used for the original field definition is different than the SQL 
that would be used to define the field in the current model:
   If sqlite: ignore it
   elif the field type is 'reference', 'double' , 'id' or SQLCutomType: 
ignore it
   else:
 create new tmp column
 copy data into tmp column
 drop original column
 add new column
 copy data from tmp field
 drop tmp column

This logic can be improved but there are historical reasons for it. At some 
point we changed the way sql was generated for id, double and reference 
fields and we did not want to trigger a migration that could have failed.



On Friday, 6 July 2012 06:49:38 UTC-5, juaneduardo wrote:
>
> Ok. This is a problem only with Mysql? with ProgreSQL too?
>
> Eduardo
>
> El jueves, 5 de julio de 2012 22:40:56 UTC-4, Massimo Di Pierro escribió:
>>
>> It is not like that field level migrations do not work. They work if, for 
>> example you change a field type. They do not work it you change an 
>> attribute (unique, notnull).
>>
>> On Thursday, 5 July 2012 16:40:42 UTC-5, MichaelF wrote:
>>>
>>> Thanks for that. I didn't realize field-level migrations don't work with 
>>> MySQL. I'm no expert on web2py migrations (or even web2py!); is it just 
>>> with MySQL that it has these problems?
>>>
>>> I suppose I could do this as an alternative to what you suggested: In 
>>> web2py add a new field with unique, then in MySQL UPDATE all records, 
>>> setting newField = oldField. I'd have to handle duplicates here, but at 
>>> least I wouldn't lost all my data. Then, when satisfied, delete oldField 
>>> and maybe rename newField to oldField.
>>>
>>> On Thursday, July 5, 2012 12:26:31 PM UTC-6, Jim S wrote:

 I believe that field level migrations do not work with MySQL.  I get 
 around this by removing the column, saving, run the app to force 
 migration, 
 and then add the field back the way I want it.  I know this causes you to 
 lose the data in that column, but I only do this in my test environment 
 and 
 have migrations turned off in production.

 Alternatively, you could update the column def in web2py, change 
 manually in mysql and then run with migrate=False, fake_migrate=True to 
 get 
 things back in sync.

 Hope that helps.

 -Jim

 On Wednesday, July 4, 2012 10:29:10 AM UTC-5, MichaelF wrote:
>
> I have a working app using web2py `(1, 99, 7, datetime.datetime(2012, 
> 3, 4, 22, 12, 8), 'stable'); Python 2.5.4: C:\Program Files 
> (x86)\web2py\web2py_no_console.exe`) and MySQL 5.5. If I change one field 
> to add `unique=True` the web2py migration fails with this error: `" 'exceptions.KeyError'> 'institution_name'"` where institution_name is the 
> name of the field in question.
>
> I've recreated the problem using a single-table application in web2py 
> using MySQL. Here's the model code:
>
> To start off (field not defined as unique):
>
> ... (usual model/db.py boilerplate)
> db = DAL('mysql://
> w2ptest:abcde...@mysql5.server.com:3307/abc_web2py')
> ...
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True),
> format='%(Institution_name)s')
>
> I go to the appadmin page and everything looks fine. Then, making 
> Institution_name unique:
>
> db.define_table('Institution',
> Field('Institution_name', 'string', length=60, 
> required=True,
>unique=True),
> format='%(Institution_name)s')
>
> I then refresh the appadmin page and get a ticket with the error. The 
> error line in the traceback is the last line of the modified statement 
> above. And, to make things worse, I can go in and undo the `unique=True`, 
> but web2py doesn't respond if I refresh the appadmin page...or any page 
> served by that web server, even in other applications! The cpu is 
> not pinned while in this state. I have to recreate the app and 
> database to clear the problem. (Well, I think I have to go that far. Just 
> restarting web2py doesn't clear it in the full case, but does clear it in 
> my little one-table test case.) I try to stop the server 
> (web2py_no_console.exe), but it fails to respond.
>
> Instead of the `unique=True` I can `db.executesql('ALTER TABLE 
> abc_web2py.Institution ADD UNIQUE INDEX UX_Iname (Institution_name) ;');` 
> but I'd rather not, particularly as then I have to `try` that statement 
> because MySQL has no `...IF NOT EXIST...` capability for index creation.
>
> Also, if I start off the model with `unique=True` in the first place, 
> everything is fine, and MySQL even shows the un

Re: [web2py] please help us test web2py

2012-07-06 Thread Massimo Di Pierro
I have reverted one of the changes and this should now work.

What I need to know is make sure we did not break backward compatibility. 

On Friday, 6 July 2012 09:23:15 UTC-5, Richard wrote:
>
> What I have to do to make it works :
>
>
> for r in db().select(db.dict_database.ALL):
> print r['"dict_database"."table_name"']
>
> I have to use the table name and the field name as key to get row field 
> data, the worst is that it needs double quoting the table name and field 
> name and quote both...
>
> It must be something wrong??
>
> Richard
>
> On Fri, Jul 6, 2012 at 10:05 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> This line in my app failed with  '*table_name
>> *'
>>
>>
>> dblabels_en = cache.ram('dblabels_en',
>> lambda: dict([(r.*table_name* + r.column_name, r.column_name_en_ui)\
>>  for r in db().select(db.dict_database.ALL)]),
>> time_expire=3600)
>>
>> Is the way row behave have change?
>>
>> Richard
>>
>>
>> On Fri, Jul 6, 2012 at 9:27 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>> >
>> > I try and report back!
>> >
>> > Richard
>> >
>> >
>> > On Fri, Jul 6, 2012 at 8:59 AM, Alec Taylor  
>> wrote:
>> >>
>> >> > By the way, what is "salt password"? I searched dictionary, but 
>> didn't find
>> >> > a good translation. Sorry my poor English.
>> >> http://en.wikipedia.org/wiki/Salt_%28cryptography%29
>> >>
>> >> Basically means adding some padding to increase the strength of the
>> >> encryption without having the user create a longer password. (although
>> >> longer password would make that even more secure)
>> >
>> >
>>
>
>

[web2py] Re: Building a non-trivial SOAP service using web2py

2012-07-06 Thread Ricardo A . Salgado
I'm dealing with the same situation, however, I wonder if there is a way to do 
that in a more general fashion, like simply:

@service.soap('GetQuote1', returns={'result':dict}, args={'symbol':str})
...
..
.

and then:

return someDictVariable




[web2py] Re: please help us test web2py

2012-07-06 Thread Omi Chiba
Tested DAL for MSSQL and it works fine !

I noticed other things...

1. button look for the welcome app
What Paolo changed (Change "button look" back to previous regular link 
style) is not applied.
https://groups.google.com/forum/#!topic/web2py/qZn1TQqgWCk

2. Remove "Share" link  from welcome app
I think we agreed to remove "Share" link because it's not used very much. 


On Thursday, July 5, 2012 11:52:01 PM UTC-5, Massimo Di Pierro wrote:
>
> There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL 
> please help us check the new trunk did not break anything.
>
> We have salted password auth = Auth(...,salt=True). Check it out. 
>
> We also have ability to deploy to openstack from admin.
>
> Thanks to all those who have and still are putting lots of time on this.
>
> massimo
>


[web2py] Re: web2py vs ROR

2012-07-06 Thread Massimo Di Pierro
As pointed out what I said is that I would pick ROR of "most" python 
frameworks.

In general I prefer to program in Python rather then  Ruby. Indentation 
makes the code more readable and there are more libraries. Ruby is used in 
Rails but not much else. Python is used for all kind of things (think about 
numpy, blender, pyglet, etc.).

Yet Ruby is better designed than most Python framework because if favors 
convention over configuration. Most Python frameworks instead follow the 
Python motto "explicit is better the implicit" and the authors despise the 
concept of "default behaviour" which they refer to as "magic". This means 
that even very simple simple such as serving a static file require a fair 
amount of programing. Moreover, as a corollary, most frameworks come in 
pieces. Ever piece has a name and its own marketing people. This exposes 
the visibility of the component but it means you have to separately find 
and install the components you need, learn their api and make sure they are 
compatible with your own version of the code.

In web2py we tried to copied the RoR approach (everything has a 
configuration) and we try to package and maintain as many components as 
possible into the same code base (API for authentication, scheduler, cron, 
PDF printing, SOAP services, WIKI markup, syntax highlighting, etc.). 
Moreover we do not rely on third party modules (only on Python standard 
libraries). 99% of what you may want to can be done with basic web2py 
without needing external packages. This means the apps are very portable 
between one installation and another.

The main difference between web2py and other frameworks in practice is not 
soo much in the its API (which more or less are the same for all 
frameworks) but for what web2py does for you on the management site: no 
packages to install, manage through the web interface, no shell programming 
unless you want to, automatic migrations.

Massimo



On Friday, 6 July 2012 00:58:36 UTC-5, murtaza52 wrote:
>
> Hi,
>
> I am considering three frameworks for developing our commercial 
> applications- 
>
> 1) web2py (choice #1)
> 2) ROR
> 3) Play framework
>
> While my research I was intrigued by Massimo's post where he says that he 
> would pick ROR over any of the current python frameworks. My question is 
> how does web2py itself compare to ROR ? What are the views of those 
> experienced with both the ecosystems ? 
>
> http://www.ruby-forum.com/topic/209343
>
> I have expereince with none so will rely on your answers :) The purpose of 
> the question is not to start a flame war, but to understand why should 
> web2py be chose over other frameworks which have much more traction today?
>
> Thanks,
> Murtaza
>
>

[web2py] Re: new feature in trunk ... help test

2012-07-06 Thread Fabiano Faver
Will it be implemented in 2.0?

I would like to use something like this, but I don`t know how to do it yet.

Any tips that I can build a manager_group that can manage who belongs to 
the other groups?

Em domingo, 29 de janeiro de 2012 23h17min06s UTC-2, Massimo Di Pierro 
escreveu:
>
> auth.mygroups 
>
> is a dictionary of (key,value) = (group_id,role) 
>
> This makes it easy to create objects like 
>
> db.define_table('thing', 
> Field('name'), 
> Field('groups_with_access','list:reference auth_group')) 
>
> and select them with 
>
> mythings = 
> db(db.thing.groups_with_access.contains(auth.mygroups.keys())).select(db.thing.ALL)
>  
>
>
> Before this makes it into stable I would like to hear comments and 
> suggestions for improvement.



[web2py] bug in markmin (?)

2012-07-06 Thread Jose

Referring to the thread: new feature in trunk: better markmin

if my text is:
"""
@{borro/default/test}
"""

[app/controller/function]

markmin returns:

http://127.0.0.1:8000/borro/default/borro/default/test

[http://127.0.0.1:8000/app/controller/app/controller/function]

Jose


Re: [web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-06 Thread Daniel Gonzalez Zaballos
Mail with the code sended :)

2012/7/6 Massimo Di Pierro :
> I do not recall. Can you resend it please. My personal inbox is a bit messy.
>
>
> On Friday, 6 July 2012 05:51:04 UTC-5, demetrio wrote:
>>
>> I will try this weekend.
>>
>> Massimo did you received the code of the apllication?
>>
>> Thanks everyone
>>
>>
>>
>> El 06/07/2012, a las 04:32, Massimo Di Pierro 
>> escribió:
>>
>> Looks like I prematurely close the issue. There is now a db.close() in
>> trunk. Please check it out.
>>
>> massimo
>>
>> On Thursday, 5 July 2012 13:05:47 UTC-5, nick name wrote:
>>>
>>> On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote:

 why not simply?

 db.commit()
 db.close()

 if db in an on object attribute like self.db you can do

 if self.db:
self.db.commit()
self.db.close()
self.db = 0

 you can also do:

 BaseAdapter.close_all_instances('commit')
>>>
>>>
>>> This is not enough, as was documented on issue
>>> http://code.google.com/p/web2py/issues/detail?id=731. The code that works
>>> for me for sqlite is as follows:
>>>
>>> def closebase(base):
>>> if not base: return
>>> # see: http://code.google.com/p/web2py/issues/detail?id=731
>>> # see:
>>> https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion
>>> # was: base._adapter.close()
>>> from gluon.dal import thread
>>> thread.instances.remove(base._adapter)
>>> base._adapter.close()
>>>
>>> and then I call closebase(db); db = None which is enough for me with
>>> sqlite -- but apparently, the original poster has tried that, and that is
>>> not sufficient for mysql.


Re: [web2py] Best deployment scenario under Windows

2012-07-06 Thread Jim S
Thanks for that Richard.  I took your advice and got it working with 
Apache, mod_wsgi, mod_ssl, and redirection.

I have it set now so all activity is forced to SSL and created my own 
certificate.

Easy step-by-step instructions for the cert creation I found here: 
 http://www.akadia.com/services/ssh_test_certificate.html

Redirecting to SSL I found here:  http://wiki.apache.org/httpd/RedirectSSL

General Windows/Apache/SSL setup I found in the web2py book.

Not being really strong on certificates or apache configuration, I found 
these resources to be really helpful in getting the all running.

-Jim

On Thursday, July 5, 2012 3:52:35 PM UTC-5, Richard wrote:
>
> I would not use Rocket for sure for kind of production app...
>
> Apache works fine to me until now, but I plan to migrate to nginx soon 
> when I will find a good tutorial and when I get time :)
>
> Richard
>
> On Thu, Jul 5, 2012 at 4:48 PM, Jim S wrote:
>
>> Hi
>>
>> I'm deploying my app in a Windows environment.  
>>
>> To answer the first obvious questions, it's because I have to connect to 
>> an IBM AS/400 database and ODBC connection is really tough for me on Linux. 
>>  So the question could be - How do I connect to DB2/400 from ubuntu, but I 
>> digress...
>>
>> I'd like to force all users to an HTTPS connection, about 75 total for 
>> our in-house app.
>>
>> I'm thinking that a solution utilizing nginx would be preferable, but it 
>> may be overkill for my user base.  
>>
>> What is the best way to get this to happen?  Can I configure the Rocket 
>> web server to handle this, or would that be discouraged?
>>
>> Any thoughts/input would really be appreciated.
>>
>> -Jim
>>
>
>

[web2py] Re: Website running extremely slow

2012-07-06 Thread LightDot
Just by the sounds of it, I doubt lack of memory would cause such 
behaviour. Can't say what would though, without knowing what your 
application does and how is it programmed to do that. There is basically no 
information to troubleshoot with.

Regards

On Friday, July 6, 2012 8:51:38 PM UTC+2, wdtatenh wrote:
>
> My website is deployed on webfaction. I've compiled the application before 
> uploading.
>
> Doesn't seem to matter what page is requested, we're talking about 3 to 5 
> seconds to download (I have high speed internet).  Any thoughts?  When I go 
> to the normal webfaction admin pages, I don't have these kinds of delays. 
>
> I'm wondering whether there might a memory issue that's being created 
> running web2py???  Perhaps not??? Scratching my head.
>
> Appreciate any thoughts anyone might have.
>
> thanks in advance
> Bill 
>


[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread RCTYCO
I believe i found my problem. The problem is with MySQL. I noticed in the 
MySQL._db._adapter.uploads_in_blob = FALSE.

The database adapter doesn't allow uploads_in_blob. MySQLAdapter* *inherents 
the uploads_in_blob of FALSE from BaseAdapter. 
Do you know why the uploads_in_blob isn't set to true?



On Friday, July 6, 2012 12:27:41 PM UTC-7, Massimo Di Pierro wrote:
>
> Notice that these two lines:
>
> Field('image_file','blob'),
> Field('image_upload','upload',uploadfield= Field('image_file','blob'))
>
> should be
>
> Field('image_file','blob'),
> Field('image_upload','upload',uploadfield= 'image_file'),
>
> or simply
>
> Field('image_upload','upload',uploadfield= Field('image_file','blob')) 
>
> The blob should be created automatically.
>
>
> On Thursday, 5 July 2012 06:23:31 UTC-5, RCTYCO wrote:
>>
>>
>> I am trying to save an image from another database into my 
>> database, essentially i am caching the a copy into my database so I don't 
>> have to query the external site. 
>>
>> I have a link 
>> http://eandata.com/image/products/004/900/000/004900443.jpg. 
>>
>> I want to save the jpg into a blob in my database.
>>
>> Model
>> db.define_table('image',
>> Field('url','string'),
>> Field('image_upload','upload',uploadfield='image_file'),
>> Field('image_file','blob'))
>>
>> Function. I have this running a module and called when I need to download 
>> the external image.
>>
>> def getImage(url,db): 
>> 
>> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
>> headers = {'User-Agent': user_agent}
>> 
>> req = urllib2.Request(url,"",headers)
>> 
>> try:
>> response = urllib2.urlopen(req)
>> except urllib2.URLError, e:
>> if hasattr(e, 'reason'):
>> print 'We failed to reach a server.'
>> print 'Reason: ', e.reason
>> elif hasattr(e, 'code'):
>> print 'The server couldn\'t fulfill the request.'
>> print 'Error code: ', e.code
>> else:
>> pass # everything is fine
>> 
>> print response.geturl()
>> print response.info()
>> print response.read()
>> f = open(response.read(),'rb')
>> #stream = open(response,'rb')
>> 
>> return 
>> db.image.insert(url=url,image=db.image.image_upload.store(f,url))
>>
>>
>> *I am having a problem with my insert statement. I can't seem to figure 
>> out how to save the image into database.* urllib2.urlopen(req) will 
>> download the file and provide a file object. But I don't know if i can just 
>> save the file or do i need to read the file object within 
>> the urllib2.urlopen(req).
>>
>> I would like the image to be available to be via 
>> http://mydomain.com/myapp/imageLookup?id=2 
>> 
>>
>> Controller
>> def imageLookup():
>> id = request.vars.id
>> #response.headers['Content-Type']='image/jpeg' 
>> 
>> return db.image[id].image_file
>>
>>
>> Do you have any suggestions? The code abo
>>
>

[web2py] Re: Website running extremely slow

2012-07-06 Thread Matt
Are migrations enabled? In your db.py try changing your DAL to explicitly 
turn it off. I.e.

DAL('', migrate_enabled = False, fake_migrate_all = 
False)

Might do the trick,
Matt

On Saturday, July 7, 2012 6:51:38 AM UTC+12, wdtatenh wrote:
>
> My website is deployed on webfaction. I've compiled the application before 
> uploading.
>
> Doesn't seem to matter what page is requested, we're talking about 3 to 5 
> seconds to download (I have high speed internet).  Any thoughts?  When I go 
> to the normal webfaction admin pages, I don't have these kinds of delays. 
>
> I'm wondering whether there might a memory issue that's being created 
> running web2py???  Perhaps not??? Scratching my head.
>
> Appreciate any thoughts anyone might have.
>
> thanks in advance
> Bill 
>


Re: [web2py] Re: Website running extremely slow

2012-07-06 Thread Bruce Wade
How many tables do you have defined in db.py?

On Fri, Jul 6, 2012 at 2:32 PM, Matt  wrote:

> Are migrations enabled? In your db.py try changing your DAL to explicitly
> turn it off. I.e.
>
> DAL('', migrate_enabled = False, fake_migrate_all =
> False)
>
> Might do the trick,
> Matt
>
>
> On Saturday, July 7, 2012 6:51:38 AM UTC+12, wdtatenh wrote:
>>
>> My website is deployed on webfaction. I've compiled the application
>> before uploading.
>>
>> Doesn't seem to matter what page is requested, we're talking about 3 to 5
>> seconds to download (I have high speed internet).  Any thoughts?  When I go
>> to the normal webfaction admin pages, I don't have these kinds of delays.
>>
>> I'm wondering whether there might a memory issue that's being created
>> running web2py???  Perhaps not??? Scratching my head.
>>
>> Appreciate any thoughts anyone might have.
>>
>> thanks in advance
>> Bill
>>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Best deployment scenario under Windows

2012-07-06 Thread Richard Vézina
On Fri, Jul 6, 2012 at 4:44 PM, Jim S  wrote:

> Thanks for that Richard.  I took your advice and got it working with
> Apache, mod_wsgi, mod_ssl, and redirection.
>
> I have it set now so all activity is forced to SSL and created my own
> certificate.
>
> Easy step-by-step instructions for the cert creation I found here:
> http://www.akadia.com/services/ssh_test_certificate.html
>
> Redirecting to SSL I found here:  http://wiki.apache.org/httpd/RedirectSSL
>

Yop! you and do it at Apache level or there is a new feature in the Admin
that use router somehow to force HTTPS too. I didn't try it yet and it
maybe even more sure you don't get no body get to HTTP at Apache level, but
web2py start to be feature rich and it pretty nice.

An other thing you can do now that you force HTTPS could be to make sure no
one can connect to web2py Admin and Appadmin with this recipe :

Search for :
Securing sessions and *admin*
*
*
*In this page :*
*
*
*http://web2py.com/books/default/chapter/29/13*

Sorry there is no anker I think...

Anyway, if you need help with this just ask, I strungle a lot when I put
that in place, but now I master it. But I am not sure you can do it easily
under windows, since there is no easy way to get SSH.

At least if you don't need to access admin and appadmin in the prod
environnement you can just delete the parameters_443.py from web2py root
folder or better just rename it so you can put it back in place when you
need it. This way no body will be able to access admin and appadmin in your
prod environnement, not even you except if you put back the file in place.
The parameters_443.py file only contain the password (it's encrypted) that
you give when starting web2py.

Richard


>
> General Windows/Apache/SSL setup I found in the web2py book.
>
> Not being really strong on certificates or apache configuration, I found
> these resources to be really helpful in getting the all running.
>
> -Jim
>
>
> On Thursday, July 5, 2012 3:52:35 PM UTC-5, Richard wrote:
>
>> I would not use Rocket for sure for kind of production app...
>>
>> Apache works fine to me until now, but I plan to migrate to nginx soon
>> when I will find a good tutorial and when I get time :)
>>
>> Richard
>>
>> On Thu, Jul 5, 2012 at 4:48 PM, Jim S wrote:
>>
>> Hi
>>>
>>> I'm deploying my app in a Windows environment.
>>>
>>> To answer the first obvious questions, it's because I have to connect to
>>> an IBM AS/400 database and ODBC connection is really tough for me on Linux.
>>>  So the question could be - How do I connect to DB2/400 from ubuntu, but I
>>> digress...
>>>
>>> I'd like to force all users to an HTTPS connection, about 75 total for
>>> our in-house app.
>>>
>>> I'm thinking that a solution utilizing nginx would be preferable, but it
>>> may be overkill for my user base.
>>>
>>> What is the best way to get this to happen?  Can I configure the Rocket
>>> web server to handle this, or would that be discouraged?
>>>
>>> Any thoughts/input would really be appreciated.
>>>
>>> -Jim
>>>
>>
>>


[web2py] Re: [web2py:7053] Re: UnicodeDecodeError when using GAE datastore

2012-07-06 Thread Matt
Hi Massimo,

What's the current state of this particular problem? I'm having similar 
issues at the moment.

For me it's occurring when windows users are cutting and pasting text into 
web2py forms which contain cp1252 encoded characters.

I've mentioned this in a very recent posting.

https://groups.google.com/d/topic/web2py/Ozti4iBiq1w/discussion

At the moment it's causing my app to crash with low level server errors.

Your existing feedburner contrib class has code to strip out the offending 
characters and replace them.

If there is any way that a GAE specific fix could be rolled into the FORM 
class somehow then that would be a fantastic solution for me and any other 
users who'll eventually encounter this.

Kind regards,
Matt

On Tuesday, July 1, 2008 4:21:58 PM UTC+12, Massimo Di Pierro wrote:
>
> I do not like this solution. I would like something that that goes  
> into gluon/main.py so it is transparent.
> I also do not want to use chardet since web2py only relies on basic  
> modules.
> Could you help me understand the problem?
> When you have foreign characters in the input, which lines in the  
> function f get executed? which encoding is detected on GAE? What  
> would happen if the funciton f were to re-encode in UTF8 and return  
> UTF8-encoded string?
>
> Massimo
>
>
> On Jun 30, 2008, at 6:10 PM, Abner wrote:
>
> >
> > Massimo,
> >
> > I tested here an hack to solve, in an more generic form, the problem:
> >
> > in model:
> >
> > # as default we are not runing on GAE
> > RUNNINGINGAE = False
> >
> > try:
> > from gluon.contrib.gql import *
> > db=GQLDB()
> > # Ok, we are on GAE
> > RUNNINGINGAE = True
> > except:
> > db=SQLDB("sqlite://jomeme1.db")
> > session.connect(request,response,db=db)
> >
> > # Thanks to Ga for this class
> > class TO_UTF:
> >  def __init__(self,f): self.f=f
> >  def __call__(self,value): return (self.f(value),None)
> >
> > def f(v):
> > if isinstance(v, str):
> > try:
> > v = v.decode('utf-8')
> > return v
> > except UnicodeDecodeError:
> > import chardet
> > info = chardet.detect(v)
> > try:
> > v = v.decode(info['encoding'])
> > return v
> > except UnicodeDecodeError, e:
> > raise UnicodeDecodeError("%s (tried UTF-8, %s)" %
> > (e,info['encoding']))
> >
> > db.define_table('sites',
> >
> > SQLField 
> > ('domain',length=256,required=True,default='localhost',unique=True),
> > SQLField('logo',length=256,required=True,default='none.gif'),
> > SQLField('telefone',length=36,required=True,default='0xx 99
> > -'),
> > SQLField('endereco',length=64,required=True,default='Rua
> > XX'),
> > SQLField('end_num','integer',required=True,default=),
> > SQLField('end_compl',length=16,default=''),
> > SQLField('bairro',length=32,required=True,default='Centro'),
> > SQLField('cidade',length=32,required=True,default='Vitória'),
> > SQLField('estado',length=2,required=True,default='ES'),
> > SQLField('cep',length=9,required=True,default='29000-000'),
> >
> > SQLField 
> > ('email_contato',length=128,required=True,default='x...@xxx.com.br')
> > )
> >
> > # Some generic requires used in GAE or not, note the second, it don't
> > use []
> > db.sites.domain.requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
> > 'sites.domain')]
> > db.sites.end_compl.requires=IS_NOT_EMPTY()
> >
> > # Now, if in GAE, we add TO_UTF in every text or string field
> > if RUNNINGINGAE:
> > from types import ListType
> > for fieldname in db.sites.fields:
> > if fieldname!='id' and (db.sites[fieldname].type ==  
> > 'string' or
> > db.sites[fieldname].type == 'text'):
> > # For requires defined above without [] or  
> > empties requires
> > if not isinstance(db.sites 
> > [fieldname].requires, ListType):
> > # Empty require - Is this the best  
> > method to do it ?
> > if not db.sites[fieldname].requires:
> > db.sites 
> > [fieldname].requires = TO_UTF(f)
> > # Required defined without []
> > else:
> > tmp = db.sites 
> > [fieldname].requires
> > db.sites 
> > [fieldname].requires = []
> > db.sites 
> > [fieldname].requires.append(tmp)
> > db.sites 
> > [fieldname].requires.append(TO_UTF(f))
> > # For requires defined above using []
> > else:
> > db.sites[fieldname].requires.append 
> > (TO_UTF(f))
> >
> >
> >
> > What you think about this solution ?
> >
> > regards,
> >
> > abner
> >
> > On 30 jun, 18:05, 

[web2py] Re: Best practice using scheduler as a task queue?

2012-07-06 Thread Michael Toomim
This is a nice solution, and clever, thanks!

The upside (compared to postgres locks, as discussed above) is this works 
for any database. The downside is it creates a whole new table.

On Thursday, July 5, 2012 2:49:36 PM UTC-7, nick name wrote:
>
> This might have been solved in this week, but in case it wasn't:
>
> You're tackling a general database problem, not a specific task queue or 
> web2py problem. So you need to solve it with the database: set up another 
> table to refer to you the task table, such as:
>
> db.define_table('tasks_that_were_set_up', 
>Field('name', 'string', unique=true),
>Field('scheduler', db.scheduler_task, notnull=True, required=True, 
> unique=True, ondelete='CASCADE'),
> )
>
> Make your insert code insert a task to this table as well:
>
> try:
>  rid = db.scheduler_task.insert(name='task7',)
>  db.tasks_that_were_set_up.insert(name='task7', scheduler=rid)
>  print 'Task was just added to db'
> except db.integrity_error_class():
>  print 'Tasks were already in db */
>
> Now, if the task gets removed from the scheduler_task table, because of 
> the cascading on_delete (which is the default - I just put it there for 
> emphasis), the record in tasks_that_were_set_up will be removed as well.
> And otherwise, because of the unique constraint, the insert to 
> tasks_that_were_set_up can only succeed once -- and thanks to the 
> transaction nature -- therefore so does scheduler_task.insert.
>
>

[web2py] Re: bug in markmin (?)

2012-07-06 Thread Massimo Di Pierro
This is correct. It expacts function/a/r/g/s or /app/controller/function

On Friday, 6 July 2012 15:28:01 UTC-5, Jose wrote:
>
>
> Referring to the thread: new feature in trunk: better markmin
>
> if my text is:
> """
> @{borro/default/test}
> """
>
> [app/controller/function]
>
> markmin returns:
>
> http://127.0.0.1:8000/borro/default/borro/default/test
>
> [http://127.0.0.1:8000/app/controller/app/controller/function]
>
> Jose
>


[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread Massimo Di Pierro
That only sets the default behavior. Only on systems that do not have a 
writable filesystem (like on GAE and couchdb) files go in blob by default.

On relational databases, uploads are stored in files, not in blobs (by 
default).



On Friday, 6 July 2012 16:22:36 UTC-5, RCTYCO wrote:
>
> I believe i found my problem. The problem is with MySQL. I noticed in the 
> MySQL._db._adapter.uploads_in_blob = FALSE.
>
> The database adapter doesn't allow uploads_in_blob. MySQLAdapter* *inherents 
> the uploads_in_blob of FALSE from BaseAdapter. 
> Do you know why the uploads_in_blob isn't set to true?
>
>
>
> On Friday, July 6, 2012 12:27:41 PM UTC-7, Massimo Di Pierro wrote:
>>
>> Notice that these two lines:
>>
>> Field('image_file','blob'),
>> Field('image_upload','upload',uploadfield= Field('image_file','blob'))
>>
>> should be
>>
>> Field('image_file','blob'),
>> Field('image_upload','upload',uploadfield= 'image_file'),
>>
>> or simply
>>
>> Field('image_upload','upload',uploadfield= Field('image_file','blob')) 
>>
>> The blob should be created automatically.
>>
>>
>> On Thursday, 5 July 2012 06:23:31 UTC-5, RCTYCO wrote:
>>>
>>>
>>> I am trying to save an image from another database into my 
>>> database, essentially i am caching the a copy into my database so I don't 
>>> have to query the external site. 
>>>
>>> I have a link 
>>> http://eandata.com/image/products/004/900/000/004900443.jpg. 
>>>
>>> I want to save the jpg into a blob in my database.
>>>
>>> Model
>>> db.define_table('image',
>>> Field('url','string'),
>>> Field('image_upload','upload',uploadfield='image_file'),
>>> Field('image_file','blob'))
>>>
>>> Function. I have this running a module and called when I need to 
>>> download the external image.
>>>
>>> def getImage(url,db): 
>>> 
>>> user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
>>> headers = {'User-Agent': user_agent}
>>> 
>>> req = urllib2.Request(url,"",headers)
>>> 
>>> try:
>>> response = urllib2.urlopen(req)
>>> except urllib2.URLError, e:
>>> if hasattr(e, 'reason'):
>>> print 'We failed to reach a server.'
>>> print 'Reason: ', e.reason
>>> elif hasattr(e, 'code'):
>>> print 'The server couldn\'t fulfill the request.'
>>> print 'Error code: ', e.code
>>> else:
>>> pass # everything is fine
>>> 
>>> print response.geturl()
>>> print response.info()
>>> print response.read()
>>> f = open(response.read(),'rb')
>>> #stream = open(response,'rb')
>>> 
>>> return 
>>> db.image.insert(url=url,image=db.image.image_upload.store(f,url))
>>>
>>>
>>> *I am having a problem with my insert statement. I can't seem to figure 
>>> out how to save the image into database.* urllib2.urlopen(req) will 
>>> download the file and provide a file object. But I don't know if i can just 
>>> save the file or do i need to read the file object within 
>>> the urllib2.urlopen(req).
>>>
>>> I would like the image to be available to be via 
>>> http://mydomain.com/myapp/imageLookup?id=2 
>>> 
>>>
>>> Controller
>>> def imageLookup():
>>> id = request.vars.id
>>> #response.headers['Content-Type']='image/jpeg' 
>>> 
>>> return db.image[id].image_file
>>>
>>>
>>> Do you have any suggestions? The code abo
>>>
>>

[web2py] Re: bug in markmin (?)

2012-07-06 Thread Jose
Hi Massimo

I do not understand.

I am giving you just that app/controller/function, but the url that 
creates, is not correct: app/controller/app/controller/function

repeats app and controller.


Another thing, this does not work for me:
 
embed:@{}

Jose


[web2py] Re: Website running extremely slow

2012-07-06 Thread pbreit
I actually think memory could definitely be the culprit. On a VPS I 
switched from 256mb to 512mb and noticed a dramatic improvement. I'm not 
really sure how to check my system's memory usage, though.

I'd be surprised if it were migrations or tables. Have you tried just 
running welcome or examples? How about just returning a page that doesn't 
hit the DB?


[web2py] Re: Alternative to Janrain: in pure Python

2012-07-06 Thread Demian Brecht

>
> Since the OP, I've also added handling and examples for:
>

   - GitHub
   - Stack Exchange
   - Instagram
   - bitly



[web2py] How to use instead of input in SQLForm

2012-07-06 Thread Andrew Evans
Hello I am trying to figure out how to replace the submit button in SQLFORM

I would like to replace with

Upload

and add

Clear

My controller is

def index():
form = SQLFORM(db.music2)
if form.accepts(request.vars, session):
#db.music2.insert(song =
db.music2.song.store(request.vars.Filedata.file,
request.vars.Filedata.filename))
response.flash = 'Your data has been submitted'
elif form.errors:
response.flash = 'Please correct the highlighted fields'
return dict(form=form)
else:
return dict(form=form)

return dict()

Any ideas/advice is greatly appreciated :-)


Re: [web2py] Re: [Version 1.96.4] DAL timing issue.

2012-07-06 Thread Anthony
Hmm, not sure what's going on. What happens if you remove the virtual field?

On Thursday, July 5, 2012 5:25:55 PM UTC-4, Santiago wrote:
>
> db.executesql(db(db.voting_center)._select()) takes only a few seconds
>
> It has one virtual field, but it is lazy. I think it is not necessary, but 
> I'm pasting the code below, is case you want to take a look.
>
> class VotingCenterVirtualField(object):
>   def delete_results(self):
> def lazy(self=self):
>   r1 = r2 = r3 = True
>   
>   if self.voting_center.definitive:
> r = db.result(self.voting_center.definitive)
> log_delete(r.as_dict())
> r1 = r.delete_results() and r.delete_record()
>   if self.voting_center.provisional:
> r = db.result(self.voting_center.provisional)
> log_delete(r.as_dict())
> r2 = r.delete_results() and r.delete_record()
>   
>   for ps in self.voting_center.polling_station.select():
> r3 = r3 and db.polling_station(ps.id).delete_results()
> 
>   return r1 and r2 and r3
> return lazy 
>
> Thanks,
> Regards
> Santiago
>
> On Thu, Jul 5, 2012 at 6:17 PM, Anthony wrote:
>
>> After executing the query, the DAL processes the returned results in 
>> order to create a Rows object. That process takes longer the more fields 
>> and the more rows there are, but 40 minutes still sounds excessive for 66K 
>> rows. How long does it take if you do 
>> db.executesql(db(db.voting_center)._select()), which will run the SQL 
>> generated by the DAL but will not parse the results into a Rows object? 
>> What does your db.voting_center table definition look like? Any virtual 
>> fields (in particular, that do additional queries)?
>>
>> Anthony
>>
>>
>> On Thursday, July 5, 2012 5:08:01 PM UTC-4, Santiago wrote:
>>>
>>> Hello,
>>>
>>> Do you know why the same query, takes more than 40 minutes to get 
>>> resolved using DAL and less than a second using raw SQL ?  
>>>
>>> This is the code using DAL
>>>
>>> db(db.voting_center).select()
>>>
>>> This is the code using raw SQL
>>>
>>> db.executesql('SELECT  voting_center.id, voting_center.election, 
>>> voting_center.full_id_indra, voting_center.latitude, 
>>> voting_center.longitude, voting_center.geometry, voting_center.circuit, 
>>> voting_center.name, voting_center.identification, voting_center.cue, 
>>> voting_center.annex, voting_center.source, voting_center.external_id, 
>>> voting_center.locality, voting_center.address, voting_center.provisional, 
>>> voting_center.definitive FROM voting_center WHERE (voting_center.id > 
>>> 0);')
>>>
>>> electoral-dev=# select count(1) from voting_center;
>>>  count 
>>> ---
>>>  66442
>>> (1 row)
>>>
>>>  Column |  Type  | 
>>> Modifiers  | Storage  | Description 
>>> +-**---+--**
>>> --**+--+--**---
>>>  id | integer| not null default 
>>> nextval('voting_center_id_seq'**::regclass) | plain| 
>>>  election   | integer| not null 
>>>   | plain| 
>>>  latitude   | character varying(512) |   
>>>  | extended | 
>>>  longitude  | character varying(512) |   
>>>  | extended | 
>>>  circuit| integer|   
>>>  | plain| 
>>>  identification | character varying(512) | not null 
>>>   | extended | 
>>>  cue| character varying(512) |   
>>>  | extended | 
>>>  annex  | character varying(512) |   
>>>  | extended | 
>>>  source | character varying(512) |   
>>>  | extended | 
>>>  external_id| character varying(512) |   
>>>  | extended | 
>>>  locality   | character varying(512) |   
>>>  | extended | 
>>>  address| character varying(512) |   
>>>  | extended | 
>>>  provisional| integer|   
>>>  | plain| 
>>>  definitive | integer|   
>>>  | plain| 
>>>  geometry   | geometry   |   
>>>  | main | 
>>>  name   | character varying(512) | not null 
>>>   | extended | 
>>>  full_id_indra  | char

[web2py] Re: How to use instead of input in SQLForm

2012-07-06 Thread Massimo Di Pierro
try

form[0][-1][1].components = [
  TAG.button('Upload', _id="px-submit",_type="submit"),
  TAG.button('Clear',_id="px-clear",_type="reset"),
]

or you can use a custom form.

On Friday, 6 July 2012 17:09:41 UTC-5, Andrew Evans wrote:
>
> Hello I am trying to figure out how to replace the submit button in SQLFORM
>
> I would like to replace with 
>
> Upload
>
> and add
>
> Clear
>
> My controller is
>
> def index():
> form = SQLFORM(db.music2)
> if form.accepts(request.vars, session):
> #db.music2.insert(song = 
> db.music2.song.store(request.vars.Filedata.file, 
> request.vars.Filedata.filename))
> response.flash = 'Your data has been submitted'
> elif form.errors:
> response.flash = 'Please correct the highlighted fields'
> return dict(form=form)
> else:
> return dict(form=form)
>
> return dict()
>
> Any ideas/advice is greatly appreciated :-)
>
>
>

[web2py] Re: bug in markmin (?)

2012-07-06 Thread Massimo Di Pierro
The comment in markmin2html.py is incorrect. The behaviour is correct. The 
syntax is not

@{app/controller/function}

the syntax is

@{function/args}

The 'app/controller/' part is put in automatically. That is the all point. 
When you use markmin you are not supposed to know the name of the app or 
the controller processing it, but you may want to redirect to an action you 
know within the current controller.




On Friday, 6 July 2012 18:36:34 UTC-5, Jose wrote:
>
> Hi Massimo
>
> I do not understand.
>
> I am giving you just that app/controller/function, but the url that 
> creates, is not correct: app/controller/app/controller/function
>
> repeats app and controller.
>
>
> Another thing, this does not work for me:
>  
> embed:@{}
>
> Jose
>


[web2py] Re: Web2py hanging with no errors in the log

2012-07-06 Thread Maggs
That's an excellent theory and would make total sense, except I can't see 
where there could possibly be an infinite loop as I only loop through 
objects or db results. And I'm using mysql, not postgres. And I have 
verified that there are no nulls where I have a notnull=True set just to be 
sure.
The lack of any errors is making this extremely annoying.

Thank you very much for your help though :)

On Friday, July 6, 2012 11:41:15 AM UTC-7, Cliff Kachinske wrote:
>
> An infinite loop causes this behavior.  Don't Ask Me How I Know This :).
>
> Also, with Postgres, I *think* this has happened because certain 
> migrations cause existing data in a field to fail a new constraint.  This 
> would happen if you make notnull=True on a field that already contains 
> null.  However, if your all your models execute on every request you will 
> see this happen right away.  It won't be intermittent.
>
> On Friday, June 22, 2012 4:34:35 PM UTC-4, Maggs wrote:
>>
>> Hi all, 
>>
>> I have a web2py healthcheck monitoring application. Basically the only 
>> thing the 
>> application does is make database queries to find healthcheck data and 
>> make REST 
>> api calls to a separate web2py application for information on the 
>> environment. 
>>
>> Recently the application has been "crashing" at least once a day. The 
>> web2py 
>> process still exists, but users are unable to connect to the application. 
>> There 
>> are no errors in the logs or any useful information in the 
>> httpserver.log, it's 
>> like web2py just hangs and I have to restart it. I'm at my wits end 
>> trying to 
>> figure out what is happening so I figured I'd see if anyone has 
>> experienced this 
>> before or has any tips on log files I'm unaware of to check. 
>>
>> Thanks! 
>>
>>

[web2py] Re: bug in markmin (?)

2012-07-06 Thread Jose
Ok, I understand.

Thank you very much

Jose


[web2py] Re: Condition in view weird behaviour

2012-07-06 Thread Anthony
I cannot reproduce the problem. If I create a condition that fails, the 
content of the included file does not display. Are you absolutely certain 
the condition is evaluating to False and/or the content in question is 
being included? Maybe pack and attach a minimal app that reproduces the 
problem.

Anthony

On Friday, July 6, 2012 1:01:13 PM UTC-4, Annet wrote:
>
>
>   Are you saying it is getting rendered even when the "if" condition is 
>> False?
>>
>
> Yes, this is what happens.
>
> Despite session.cal.lesrooster, session.cal.event_list and 
>>> session.cal.cursusrooster being False, site/calendar.html is being 
>>> included. When I replace {{include 'site/calendar.html'}} with text 
>>> the text isn't displayed.
>>>
>>> When I move the condition to site/calendar.html, the behaviour is the 
>>> same, only when I have the condition both in the view and in 
>>> site/calendar.html the page is rendered correctly.
>>>
>>> site/index.html:
>>>
>>> 
>>>   {{if session.cal.lesrooster or session.cal.event_list or 
>>> session.cal.cursusrooster:}}
>>> {{include 'site/calendar.html'}}
>>>   {{pass}}
>>>   {{include 'site/promoUnit.html'}}
>>>   
>>>
>>> site/calendar.html:
>>>
>>> {{if (session.cal.lesrooster or session.cal.event_list or 
>>> session.cal.cursusrooster):}}
>>>   
>>> ...
>>>   
>>>  
>>>   
>>> ...
>>>
>>>
>>>   
>>>...
>>>   
>>> {{pass}}
>>>
>>
>
> Annet 
>


[web2py] Re: {{=LOAD()}} and JavaScript function

2012-07-06 Thread Anthony
OK, now I see. Maybe just add a call to web2py_component() to the document 
ready handler:

{{if show_tab:}}

$(document).ready(function(){
  web2py_component('{{=URL('site', show_function, args=session.id)}}',show_tab
);
  $('a[href=#{{=show_tab}}]').tab('show');
});

{{pass}}

You'll have to add some logic to set the value of the show_function 
variable included in the call to URL().

Anthony

On Friday, July 6, 2012 1:57:46 AM UTC-4, Annet wrote:
>
> Hi Anthony,
>
> I believe that's what my code does. This line:
>>
>> {{show_tab = this_tab if not show_tab else show_tab}}
>>
>> sets the value of show_tab to the first tab (if any) that gets written to 
>> the view. Is that not what you want?
>>
>
> Yes, that's what I want, however, I also want the content of the first tab 
> if any to be loaded. This is what the code does:
>
> 
>   
>   
>   
>  
>
>
> This is what it should do:
>
> 
>   
> Text
> Table content
>   
>   
>   
>  
>
>  
> Kind regards,
>
> Annet
>
>
>

[web2py] Re: Alternative to Janrain: in pure Python

2012-07-06 Thread Massimo Di Pierro
Hello Demian,

I do not understand your comment. Is there code we can look at?

On Friday, 6 July 2012 10:36:57 UTC-5, Demian Brecht wrote:
>
> Since the OP, I've also added handling and examples for:
>>
>
>- GitHub
>- Stack Exchange
>- Instagram
>- bitly
>
>

Re: [web2py] Re: Standalone DAL leaves mysql connections opened

2012-07-06 Thread Massimo Di Pierro
Meanwhile, can you check the new db.close() in trunk?

On Friday, 6 July 2012 15:40:57 UTC-5, demetrio wrote:
>
> Mail with the code sended :) 
>
> 2012/7/6 Massimo Di Pierro : 
> > I do not recall. Can you resend it please. My personal inbox is a bit 
> messy. 
> > 
> > 
> > On Friday, 6 July 2012 05:51:04 UTC-5, demetrio wrote: 
> >> 
> >> I will try this weekend. 
> >> 
> >> Massimo did you received the code of the apllication? 
> >> 
> >> Thanks everyone 
> >> 
> >> 
> >> 
> >> El 06/07/2012, a las 04:32, Massimo Di Pierro <
> massimo.dipie...@gmail.com> 
> >> escribió: 
> >> 
> >> Looks like I prematurely close the issue. There is now a db.close() in 
> >> trunk. Please check it out. 
> >> 
> >> massimo 
> >> 
> >> On Thursday, 5 July 2012 13:05:47 UTC-5, nick name wrote: 
> >>> 
> >>> On Thursday, June 28, 2012 10:47:15 AM UTC-4, Massimo Di Pierro wrote: 
>  
>  why not simply? 
>  
>  db.commit() 
>  db.close() 
>  
>  if db in an on object attribute like self.db you can do 
>  
>  if self.db: 
> self.db.commit() 
> self.db.close() 
> self.db = 0 
>  
>  you can also do: 
>  
>  BaseAdapter.close_all_instances('commit') 
> >>> 
> >>> 
> >>> This is not enough, as was documented on issue 
> >>> http://code.google.com/p/web2py/issues/detail?id=731. The code that 
> works 
> >>> for me for sqlite is as follows: 
> >>> 
> >>> def closebase(base): 
> >>> if not base: return 
> >>> # see: http://code.google.com/p/web2py/issues/detail?id=731 
> >>> # see: 
> >>> https://groups.google.com/d/topic/web2py/hmsupVHdDHo/discussion 
> >>> # was: base._adapter.close() 
> >>> from gluon.dal import thread 
> >>> thread.instances.remove(base._adapter) 
> >>> base._adapter.close() 
> >>> 
> >>> and then I call closebase(db); db = None which is enough for me with 
> >>> sqlite -- but apparently, the original poster has tried that, and that 
> is 
> >>> not sufficient for mysql. 
>


[web2py] Re: please help us test web2py

2012-07-06 Thread Massimo Di Pierro


On Friday, 6 July 2012 14:48:31 UTC-5, Omi Chiba wrote:
>
> Tested DAL for MSSQL and it works fine !
>
> I noticed other things...
>
> 1. button look for the welcome app
> What Paolo changed (Change "button look" back to previous regular link 
> style) is not applied.
> https://groups.google.com/forum/#!topic/web2py/qZn1TQqgWCk
>

Could you please send me a patch.
 

> 2. Remove "Share" link  from welcome app
> I think we agreed to remove "Share" link because it's not used very much. 
>

I think we agreed to remove the link to addtoany. Do you really want to 
remove the share tab at the bottom? I think it can be useful.
 

>
>
> On Thursday, July 5, 2012 11:52:01 PM UTC-5, Massimo Di Pierro wrote:
>>
>> There are many changes in DAL. If you use MySQL or MSSQL or PostgreSQL 
>> please help us check the new trunk did not break anything.
>>
>> We have salted password auth = Auth(...,salt=True). Check it out. 
>>
>> We also have ability to deploy to openstack from admin.
>>
>> Thanks to all those who have and still are putting lots of time on this.
>>
>> massimo
>>
>

Re: [web2py] File name too long?

2012-07-06 Thread Jonathan Lundell
On 6 Jul 2012, at 6:42 PM, Bruno Rocha wrote:
> Recently, many users of a social site which uses Movu.ca 
> (http://www.menuvegano.com.br) are trying to upload pictures taken from 
> facebook, and that pictures has long file names, which leads in to this kind 
> of error:
> 

File name limits are typically a function of the underlying file system. Which 
one is this?

Re: [web2py] File name too long?

2012-07-06 Thread Bruno Rocha
Ubuntu server 11.04


On Fri, Jul 6, 2012 at 10:50 PM, Jonathan Lundell wrote:

> On 6 Jul 2012, at 6:42 PM, Bruno Rocha wrote:
>
>  Recently, many users of a social site which uses Movu.ca (
> http://www.menuvegano.com.br) are trying to upload pictures taken from
> facebook, and that pictures has long file names, which leads in to this
> kind of error:
>
>
> File name limits are typically a function of the underlying file system.
> Which one is this?
>


Re: [web2py] File name too long?

2012-07-06 Thread Bruno Rocha
Ubuntu server 11.04 and Postgres

On Fri, Jul 6, 2012 at 11:12 PM, Bruno Rocha  wrote:

> Ubuntu server 11.04
>
>
> On Fri, Jul 6, 2012 at 10:50 PM, Jonathan Lundell wrote:
>
>> On 6 Jul 2012, at 6:42 PM, Bruno Rocha wrote:
>>
>>  Recently, many users of a social site which uses Movu.ca (
>> http://www.menuvegano.com.br) are trying to upload pictures taken from
>> facebook, and that pictures has long file names, which leads in to this
>> kind of error:
>>
>>
>> File name limits are typically a function of the underlying file system.
>> Which one is this?
>>
>
>


[web2py] Re: File name too long?

2012-07-06 Thread Massimo Di Pierro
If you set the length attribute of the uploadfield the filename will be 
truncated accordingly. 
As jonathan says, the length of uploadfield is filesystem dependent. Set it 
to 128 or 256 to be safe.

On Friday, 6 July 2012 20:42:50 UTC-5, rochacbruno wrote:
>
> Hi!
>
> Recently, many users of a social site which uses Movu.ca (
> http://www.menuvegano.com.br) are trying to upload pictures taken from 
> facebook, and that pictures has long file names, which leads in to this 
> kind of error:
>
>  1.
> 2.
>
>
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>
> Traceback (most recent call last):
>
>
>   File "/home/www-data/menuvegano/gluon/restricted.py", line 205, in 
> restricted
>
>
> exec ccode in environment
>   File "/home/www-data/menuvegano/applications/init/controllers/article.py", 
> line 177, in 
>
>
>   File "/home/www-data/menuvegano/gluon/globals.py", line 175, in 
>
>
> self._caller = lambda f: f()
>
>
>   File "/home/www-data/menuvegano/applications/init/controllers/article.py", 
> line 19, in edit
>
>
> article = Article('edit')
>
>
>   File "applications/init/modules/handlers/base.py", line 41, in __init__
>
>
> self.__getattribute__(hook)()
>
>
>   File "applications/init/modules/handlers/article.py", line 645, in edit
>
>
> if self.context.article_form.process().accepted:
>
>
>   File "/home/www-data/menuvegano/gluon/html.py", line 2016, in process
>
>
> self.validate(**kwargs)
>
>
>   File "/home/www-data/menuvegano/gluon/html.py", line 1963, in validate
>
>
> if self.accepts(**kwargs):
>
>
>   File "/home/www-data/menuvegano/gluon/sqlhtml.py", line 1231, in accepts
>
>
> newfilename = field.store(source_file, original_filename, 
> field.uploadfolder)
>
>
>   File "/home/www-data/menuvegano/gluon/dal.py", line 7897, in store
>
>
> dest_file = open(pathfilename, 'wb')
>
> IOError: [Errno 36] File name too long: 
> '/home/www-data/menuvegano/applications/init/databases/../uploads/article.picture.924877f659848aee.706c7567696e5f636b656469746f725f75706c6f61642e75706c6f61642e626437613039353761353730316365382e35363635363736313665366632303664366637323631366536373666323036333666366432303633366636333666323032383331323932653461353034372e4a5047.JPG'
>
>
>
> Any thought about it?
>
>
> *Bruno Cezar Rocha*
>
> http://www.CursoDePython.com.br
> [image: Facebook]  [image: 
> Twitter] [image: 
> LinkedIn]  [image: 
> about.me] [image: 
> Amazon]  [image: 
> AngelList] [image: 
> Blog RSS]  [image: 
> Facebook Page]  [image: 
> foursquare] [image: 
> Google Plus]  
> [image: 
> pinterest]  [image: 
> SlideShare] [image: 
> YouTube] 
>  [image: Google Talk] rochacbruno [image: Skype] blouweb
> Blog: Generate a thumbnail that fits in a 
> box
>   Get a signature like this. 
> 
>  Click 
> here.
>
>
>  


Re: [web2py] Customizing Auth to work with legacy db & app

2012-07-06 Thread Jerry
Hi Vinicius,

Thank you for the informed response and relating your experiences.
You have great ideas for dealing with this issue and helped me decide how 
to proceed.
I will try to customize Auth and use it as you have done.

Muchas gracias Senor!!

Jerry.

On Thursday, July 5, 2012 4:24:30 PM UTC-7, viniciusban wrote:
>
> Hi Jerry. 
>
> You can define a db object to connect just to your auth table on MS SQL. 
> This way, you can customize Auth to your needs. 
>
> Remember web2py, by default, store passwords crypted (see CRYPT 
> validator). If it's not your scenario, you'll need to override this 
> implementation. 
>
> A few months ago I needed to customize Auth. I inherited from the 
> original and implemented my own methods like loging user in without 
> password (in a very special situation), and registering them making 
> integration with other tables. 
>  
>
By the way, you'll need to check if the web2py RBAC is enough for you. 
> Maybe you'll have to make it use tables used today by your legacy system. 
>
> So, I recommend you to customize Auth and enjoy all web2py 
> authentication and authorization infrastructure. 
>
> -- 
> Vinicius Assef 
>
>
>
> On 07/05/2012 06:04 PM, Jerry wrote: 
> > Hello, 
> > 
> > We have a legacy Cold Fusion app running off a MS SQL db server and plan 
> > to gradually move functionality from CF to web2py. 
> > Both systems will run concurrently, accessing the same db. 
> > Thanks to the web2py (awesome piece of software! thank you Massimo and 
> > the other contributors!) DAL, we can access the legacy database no 
> problem. 
> > 
> > The db has a User table with fields like: 
> > FirstName, LastName, Email, Password etc. 
> > The field names do not match the names used in web2py 
> > auth.settings.table_user_name (first_name, last_name, email, passwd 
> etc.) 
> > 
> > We would love to use web2py Auth for login/register/profile forms, 
> > decoration of controller actions with @auth, and handling password 
> resets. 
> > 
> > It looks like there will be a lot of customization of the Auth settings 
> > to get it to work with our legacy database. 
> > The only alternative I can think of is not using Auth at all. Everything 
> > custom - our own login form, register page, password reset - and we 
> > don't get @auth. decorators. 
> > 
> > What would you recommend? I'm guessing this has been done before but I 
> > haven't found a solution. 
> > Is there another way of doing this that makes more sense? 
> > 
> > Thanks in advance, 
> > 
> > Jerry. 
>
>

[web2py] Re: File name too long?

2012-07-06 Thread Anthony

>
> If you set the length attribute of the uploadfield the filename will be 
> truncated accordingly. 
> As jonathan says, the length of uploadfield is filesystem dependent. Set 
> it to 128 or 256 to be safe.
>

Currently, it defaults to 512 characters (same as a string field). 


Re: [web2py] Re: File name too long?

2012-07-06 Thread Jonathan Lundell
On 6 Jul 2012, at 8:26 PM, Anthony wrote:
> If you set the length attribute of the uploadfield the filename will be 
> truncated accordingly. 
> As jonathan says, the length of uploadfield is filesystem dependent. Set it 
> to 128 or 256 to be safe.
> 
> Currently, it defaults to 512 characters (same as a string field). 

IIRC, common Linux filesystems (ext{2,3}) have a name-length limit of 256 chars.



Re: [web2py] Re: File name too long?

2012-07-06 Thread Anthony
Also, keep in mind that the encoding doubles the original filename length, plus 
the table name, field name, and  a 16 character uuid fragment are added.

Anthony


Re: [web2py] Re: Alternative to Janrain: in pure Python

2012-07-06 Thread Alec Taylor
Hey Massimo,

What he was referring to is what the maintainer has added examples
for: https://github.com/demianbrecht/sanction/blob/master/example/server.py

(I also made a commit)

On Sat, Jul 7, 2012 at 11:30 AM, Massimo Di Pierro
 wrote:
> Hello Demian,
>
> I do not understand your comment. Is there code we can look at?
>
>
> On Friday, 6 July 2012 10:36:57 UTC-5, Demian Brecht wrote:
>>>
>>> Since the OP, I've also added handling and examples for:
>>
>> GitHub
>> Stack Exchange
>> Instagram
>> bitly


  1   2   >