Re: [web2py] Aw: Re: help testing

2011-05-03 Thread Stifan Kristi
if your functions is use with many controllers that related with database,
please put it on the models
if your functions is use with many controllers that not related with
database function, please put it on the controllers
if your functions is use by another application, please put it on the
modules

On Tue, May 3, 2011 at 12:41 PM, ma...@rockiger.com rocki...@googlemail.com
 wrote:

 I have a somewhat general question.

 Should be funtions to use with your controller somewhere in the controllers
 folder?

 Having so much functions in the model seems kind of odd to me or am I
 wrong?

 Please enlightenm me.


 That said, subfolder are a big improvement.



 Marco



[web2py] Does return have to be the last statement in a function?

2011-05-03 Thread pbreit
Nothing further happens after return. You need to trigger a task (probably in 
some sort of queue) before the return or have your page trigger a task somehow 
(Ajax).


[web2py] Re: Skytoop : a web desktop like, created with Web2Py on server side

2011-05-03 Thread Alexandre Strzelewicz
Thanks a lot !

Thanks to all the Web2Py community, without this framework I couldn't
do this project, I will continue to work on it and I have a lot of
other projects !

(The JS Ui used is Jquery-UI)

Alexandre Strzelewicz


[web2py] Re: markitup in web2py...

2011-05-03 Thread villas
Yes, the author responded to me but could not remember receiving a
patch.  I asked Massimo to contact him again.

On May 3, 4:22 am, Bruno Rocha rochacbr...@gmail.com wrote:
 You have to use the markitup that is shipped with pkugin_wiki Massimo made
 some changes including markmin syntax which.is not in the author
 distribution, yet
 Em 02/05/2011 22:51, Jason Brower encomp...@gmail.com escreveu:

  I have markitup jquery library working well in web2py except for the
  markmin syntax is not there. Does someone have the set to make that
  happen? It should be submitted to the markitup guys at it would help
  popularize web2py. (At least it won't hurt it. :D)
  Best Regards,
  Jason Brower


[web2py] Re: deal with CSV

2011-05-03 Thread cyber
I mean that after export each row is located into one cell (if I open
*.csv file in ms excel).
For example, if result returns two rows all values from first row are
located into A1 cell and the second one - into A2 cell.
So, I need to divide each row by columns. Current divider is ,. Is
there a way to use another tabular separator if i want each value to
be placed into each cell?
*

On 3 май, 00:04, DenesL denes1...@yahoo.ca wrote:
 Sorry, I don't understand what you mean by divide search results.

 As for headers, you could do:

 ...
 return 'A1,B1,C1\n' + '\n'.join([','.join(map(str,[r.id, r.num, r.ves,
 r.dt, r.usr])) for r in rr])

 On May 2, 2:42 pm, cyber vlad.mul...@gmail.com wrote:







  Denes, it works. Thanks!
  But how to divide search results?
  Finaly I want each table field to be into personal column in the row
  in csv file.
  For example, r.id should be into A1, r.num should be into B1 etc.
  Is it possible?

  *

  On 2 май, 00:27, DenesL denes1...@yahoo.ca wrote:

   You can provide a link to the controller below, instructing the user
   to right click on it and then select 'save link as...', he can store
   the response in any selected directory using his choice of filename (a
   name ending in .csv):

   def tocsv():
     response.headers['content-type']='text/csv'
     rr=db((db.autos.dt=t1) 
   (db.autos.dt=t2)).select(orderby=~db.autos.dt)
     return '\n'.join([','.join(map(str,[r.id, r.num, r.ves, r.dt,
   r.usr])) for r in rr])


[web2py] Re: jquery for triggering change in dropdown list values

2011-05-03 Thread niknok
Right now, I just generate a list from the database and feed it into a
IS_IN_SET validator. It worked out faster than slice 85.

On May 2, 11:38 pm, Anthony abasta...@gmail.com wrote:
 On Sunday, May 1, 2011 11:56:55 PM UTC-4, niknok wrote:

  Thanks Anthony.

  I've actually tried that, but it was a tad too slow for me. :(

 Bummer. If you figure out an alternative, let us know.


[web2py] Re: button action

2011-05-03 Thread niknok
The old function I used passed values using args. Now I'm using
session variables instead, so I need a way to move forward and
backward between records.

I need the button to decrement the session variable, then redirect to
the page.

On May 2, 9:36 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://mywiki.wooledge.org/XyProblem

 what do you want to do exactly?

 On May 1, 8:04 pm, niknok nikolai...@gmail.com wrote:







  I have this button that redirects to a URL:

  form[0][-1][1].append(INPUT(_type='button',_value=T('Previous')
                              ,_onclick='document.location=%s' 
  %URL(question)))

  what do I add to _onclick to do the following:
  1) session.current_item -=1
  2) redirect(URL('question'))

  /r
  Nik


[web2py] Re: button action

2011-05-03 Thread niknok
+1 for the link :P

On May 2, 9:36 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 http://mywiki.wooledge.org/XyProblem

 what do you want to do exactly?

 On May 1, 8:04 pm, niknok nikolai...@gmail.com wrote:







  I have this button that redirects to a URL:

  form[0][-1][1].append(INPUT(_type='button',_value=T('Previous')
                              ,_onclick='document.location=%s' 
  %URL(question)))

  what do I add to _onclick to do the following:
  1) session.current_item -=1
  2) redirect(URL('question'))

  /r
  Nik


[web2py] displaying user's local time

2011-05-03 Thread niknok
How do I display the user's local time in a form?


[web2py] Re: compressed field

2011-05-03 Thread Plumo
excellent! I found I needed to use a blob to avoid errors:

import zlib
from gluon.dal import SQLCustomType
compressed = SQLCustomType(
type='text',
native='blob',
encoder=(lambda x: zlib.compress(x or '')),
decoder=(lambda x: zlib.decompress(x))
)



[web2py] text field display when writable=False

2011-05-03 Thread szimszon
Is there a way to replace \n with br / and space with #32; in the 
displayed value of text field if the field is writable=False and displayed 
in crud form:

db.define_table('some_table',
  Field('some_text','text',writable=False)
  )

crud.update(db.some_table,request.args(0))




[web2py] Re: Backup Database

2011-05-03 Thread luifran
What mechanisms?

On 2 mayo, 23:20, howesc how...@umich.edu wrote:
 i'm a little old-skool and just use the database's backup mechanisms since
 they are slightly different from db to db, but in general faster to run than
 CSV dump and import.

 cfh


[web2py] EULA agreement on first login

2011-05-03 Thread pbreit
How about not auth.user.eula_accepted?


[web2py] Re: text field display when writable=False

2011-05-03 Thread Jose


On 3 mayo, 09:36, szimszon szims...@gmail.com wrote:
 Is there a way to replace \n with br / and space with #32; in the
 displayed value of text field if the field is writable=False and displayed
 in crud form:

 db.define_table('some_table',
   Field('some_text','text',writable=False)
   )

 crud.update(db.some_table,request.args(0))

miss readable=False


[web2py] Re: Skytoop : a web desktop like, created with Web2Py on server side

2011-05-03 Thread Jose
Beautiful application. Congratulations!

Jose


[web2py] Re: text field display when writable=False

2011-05-03 Thread szimszon
I need it only writable=False I need to display it like:


some text
other text
another line


but I got only:

some textother textanother line


[web2py] Re: compressed field

2011-05-03 Thread Jose


On 3 mayo, 00:21, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You can easily make a custom type to do that:

 import xlib
 compressed =
 SQLCustomType(
             type
 ='text',
             native
 ='text',
             encoder =(lambda x: zlib.compress(x or
 '')),
             decoder = (lambda x: zlib.decompress(x))
             )

 db.define_table(

 'example',
             Field('data',
 type=compressed)
             )

 May need some testing. Let us know.


How interesting!
Where I can read some about SQLCustomType?

Anyone use them? In which case?

Jose


[web2py] Re: markitup in web2py...

2011-05-03 Thread Massimo Di Pierro
I re-sent it.

On May 3, 6:29 am, villas villa...@gmail.com wrote:
 Yes, the author responded to me but could not remember receiving a
 patch.  I asked Massimo to contact him again.

 On May 3, 4:22 am, Bruno Rocha rochacbr...@gmail.com wrote:







  You have to use the markitup that is shipped with pkugin_wiki Massimo made
  some changes including markmin syntax which.is not in the author
  distribution, yet
  Em 02/05/2011 22:51, Jason Brower encomp...@gmail.com escreveu:

   I have markitup jquery library working well in web2py except for the
   markmin syntax is not there. Does someone have the set to make that
   happen? It should be submitted to the markitup guys at it would help
   popularize web2py. (At least it won't hurt it. :D)
   Best Regards,
   Jason Brower


[web2py] Re: displaying user's local time

2011-05-03 Thread Massimo Di Pierro
jQuery(function(){jQuery('#table_field').val((new
Date()).format(isoDateTime));});

http://blog.stevenlevithan.com/archives/date-time-format

On May 3, 7:20 am, niknok nikolai...@gmail.com wrote:
 How do I display the user's local time in a form?


[web2py] Re: compressed field

2011-05-03 Thread Massimo Di Pierro
I never promised long term support so it is not documented anywhere I
think.But the Sahana Eden project uses it so I continue to maintain it
until something better comes along.

There is not much more than in the example above.


On May 3, 8:30 am, Jose jjac...@gmail.com wrote:
 On 3 mayo, 00:21, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:









  You can easily make a custom type to do that:

  import xlib
  compressed =
  SQLCustomType(
              type
  ='text',
              native
  ='text',
              encoder =(lambda x: zlib.compress(x or
  '')),
              decoder = (lambda x: zlib.decompress(x))
              )

  db.define_table(

  'example',
              Field('data',
  type=compressed)
              )

  May need some testing. Let us know.

 How interesting!
 Where I can read some about SQLCustomType?

 Anyone use them? In which case?

 Jose


[web2py] Re: EULA agreement on first login

2011-05-03 Thread Massimo Di Pierro
You may have an old web2py version. The auth.user should be re-read
after editing profile. If the eula is not in profile than you have to
set it manually in the action that handles he eula

auth.user.eula_accepted=True



On May 2, 11:10 pm, Charles Law charles@gmail.com wrote:
 I'm trying to add an EULA that users have to agree to on first login.
 I'm doing this right now by adding a field to the auth.user called the
 eula_accepted flag.  If that flag isn't set, it will load a EULA form,
 otherwise, it loads the default webpage.

 When the user accepts the agreement, the form gets submitted which
 sets the flag.  I can verify using the appadmin that the field gets
 set.  But what seems to happen after accepting the form is that the
 flag is not reread even when I refresh the page.  Is there any command
 I can run to reread the flag?  The only thing I've gotten to work so
 far is to login again.  Any ideas?

 Here is the (messy) if statement in the html view.
 {{if auth.user and (auth.user.eula_accepted==False or
 auth.user.eula_accepted==False):}}
 Thanks!


[web2py] Re: compressed field

2011-05-03 Thread Jose


On 3 mayo, 10:40, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I never promised long term support so it is not documented anywhere I
 think.But the Sahana Eden project uses it so I continue to maintain it
 until something better comes along.

 There is not much more than in the example above.


Thanks


[web2py] Re: compressed field

2011-05-03 Thread Jose


On 3 mayo, 10:40, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I never promised long term support so it is not documented anywhere I
 think.But the Sahana Eden project uses it so I continue to maintain it
 until something better comes along.

 There is not much more than in the example above.


I am thinking in encrypt / decrypt text
Jose


Re: [web2py] Re: compressed field

2011-05-03 Thread Richard Baron Penman
have a look in gluon/dal.py to see the internals. Very convenient.


On Tue, May 3, 2011 at 11:30 PM, Jose jjac...@gmail.com wrote:



 On 3 mayo, 00:21, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
  You can easily make a custom type to do that:
 
  import xlib
  compressed =
  SQLCustomType(
  type
  ='text',
  native
  ='text',
  encoder =(lambda x: zlib.compress(x or
  '')),
  decoder = (lambda x: zlib.decompress(x))
  )
 
  db.define_table(
 
  'example',
  Field('data',
  type=compressed)
  )
 
  May need some testing. Let us know.
 

 How interesting!
 Where I can read some about SQLCustomType?

 Anyone use them? In which case?

 Jose


[web2py] user data

2011-05-03 Thread Resa
how do i run a query to get the user data when they sign into Janrain.
i was trying to use: authEmail=auth.user.email and
authLast=auth.user.last  to grab the data and put in a variable


[web2py] Re: user data

2011-05-03 Thread Resa
not really a query but how do i get it at all...

On May 3, 9:28 am, Resa taratbr...@gmail.com wrote:
 how do i run a query to get the user data when they sign into Janrain.
 i was trying to use: authEmail=auth.user.email and
 authLast=auth.user.last  to grab the data and put in a variable


[web2py] Re: deal with CSV

2011-05-03 Thread DenesL

Are you running Windows?.
Check that your list separator (which Excel uses) is set to a comma or
change the delimiter used in the code.
You can find the list separator in the Control Panel, under Regional
Settings, Customize.


On May 3, 7:38 am, cyber vlad.mul...@gmail.com wrote:
 I mean that after export each row is located into one cell (if I open
 *.csv file in ms excel).
 For example, if result returns two rows all values from first row are
 located into A1 cell and the second one - into A2 cell.
 So, I need to divide each row by columns. Current divider is ,. Is
 there a way to use another tabular separator if i want each value to
 be placed into each cell?
 *

 On 3 май, 00:04, DenesL denes1...@yahoo.ca wrote:







  Sorry, I don't understand what you mean by divide search results.

  As for headers, you could do:

  ...
  return 'A1,B1,C1\n' + '\n'.join([','.join(map(str,[r.id, r.num, r.ves,
  r.dt, r.usr])) for r in rr])

  On May 2, 2:42 pm, cyber vlad.mul...@gmail.com wrote:

   Denes, it works. Thanks!
   But how to divide search results?
   Finaly I want each table field to be into personal column in the row
   in csv file.
   For example, r.id should be into A1, r.num should be into B1 etc.
   Is it possible?

   *

   On 2 май, 00:27, DenesL denes1...@yahoo.ca wrote:

You can provide a link to the controller below, instructing the user
to right click on it and then select 'save link as...', he can store
the response in any selected directory using his choice of filename (a
name ending in .csv):

def tocsv():
  response.headers['content-type']='text/csv'
  rr=db((db.autos.dt=t1) 
(db.autos.dt=t2)).select(orderby=~db.autos.dt)
  return '\n'.join([','.join(map(str,[r.id, r.num, r.ves, r.dt,
r.usr])) for r in rr])


[web2py] Re: user data

2011-05-03 Thread Resa
you dont have to answer this again

On May 3, 9:28 am, Resa taratbr...@gmail.com wrote:
 not really a query but how do i get it at all...

 On May 3, 9:28 am, Resa taratbr...@gmail.com wrote:

  how do i run a query to get the user data when they sign into Janrain.
  i was trying to use: authEmail=auth.user.email and
  authLast=auth.user.last  to grab the data and put in a variable




[web2py] Re: text field display when writable=False

2011-05-03 Thread DenesL

db.some_table.some_text.writable = False
db.some_table.some_text.represent = lambda s: XML(s.replace('\n','br /
'))


On May 3, 8:36 am, szimszon szims...@gmail.com wrote:
 Is there a way to replace \n with br / and space with #32; in the
 displayed value of text field if the field is writable=False and displayed
 in crud form:

 db.define_table('some_table',
   Field('some_text','text',writable=False)
   )

 crud.update(db.some_table,request.args(0))


[web2py] doctests and @cache

2011-05-03 Thread howesc
Hi all,

i'm using doctests and the nifty web2py _TEST function to call doctests on 
my controllers (like in the admin app, but since i'm on GAE i am not running 
through admin).

I just noticed today that functions that i have decorated with @cache do not 
run when i call _TEST.  If i remove the @cache decorator on the function the 
tests run again.  is there a way to have both the @cache decorator and be 
able to run doctests using the _TEST function?

thanks,

christian


[web2py] Re: Confusion using experts4solutions

2011-05-03 Thread Ross Peoples
Experts4solutions has hooked me up with someone nearby looking to do a long 
term job which plans to sell a web2py app as an appliance. Instead of 
getting paid up front or by the hour, I chose to take a percentage of 
profits, since it's just me and the other person working on it. I can only 
devote 10 to 20 hours a week to it, as I have a day job, but if jobs keep 
coming down the pipeline, I could actually make a career out of web2py.

Jim or Steve, if you have any small jobs that only take a few hours to do, 
I'd be happy to take a look. As I said, most of my time is spent at my day 
job or working on a big project during the weekend, but if there's some 
small things that I can work on during the week after work to make some 
extra cash, I would be very interested. Feel free to email me.

Ross


[web2py] getting error while trying to deploy on gae (Google App Engine Deployment Interface)

2011-05-03 Thread geekbuntu
on step 6 of the wizard, it asks for the path to appcfg.py

it automatically fills in the field with /usr/local/bin/appcfg.py

the error is that it cannot find /usr/local/bin/appcfg.py

this file does not exist in my hard drive

profile:ubuntu 11.04
running wizard form .py in web2py folder

thanks in advance,


Re: [web2py] Re: Customising the menu with specific classes...

2011-05-03 Thread Jason Brower

Very odd, but when I put this:
response.menu.append((A(T('register'), _href=bla, _class=test), 
False, None, []))


I get this:

lia onclick=javascript:void(0):return false; href=#/aa 
href=bla class=testregister/a/li


What up with the javascript? That javascript line is making an extra 
bunch of content in my menu and miss aligning it...

like this...


Any ideas what I am doing wrong here.
BR,
Jason Brower

On 05/03/2011 06:23 AM, Massimo Di Pierro wrote:

In

response.menu=[item1,item2,]

instead of

item1=[label,False,link]

use

item1=[A(label,_href=link,_class='...',False,None]

On May 2, 9:35 pm, Jason Browerencomp...@gmail.com  wrote:

I really like the MENU() system but I am finding a limit with classes
and id.
I would like to set a class or id to each menu item so the theming,
javascript, and other items could be applied here.  How would I best go
around doing this?
I suppose I could try to make a patch to MENU to allow this, but I am
not very good at backward compatibility. :D
---
Best Regards,
Jason Brower


inline: Screenshot.png

[web2py] fixed: decimal field not supported in AJAX / JSON

2011-05-03 Thread vpiotr
As far as I can see decimal fields like the following are not
supported in JSON services.

Field('car_price', 'decimal(8,6)', requires=IS_NOT_EMPTY()),

In functions like:

@service.json
def getjson():
return mydata

web2py framework uses simplejson for serialization.

The release version of web2py will fail on execution of such a
procedure with error:
Decimal(\'21211.12\') is not JSON serializable

Starting from version 2.1 simplejson library supports decimals which
can be serialized, but it requires a special argument ('use_decimal')
provided in dumps():

gluon\serializers.py:

def json(value,default=custom_json):
return simplejson.dumps(value,default=default,use_decimal=True)

Please include it somehow in next releases of web2py, thanks.


[web2py] Send E-mail on exception/Internal error

2011-05-03 Thread Dan
I guess there is no internal function to send new tickets caused by
exceptions/Internal error to a given E-mail address. What would be the
best way to implement this without hacking the core framework?

Thanks for any help.


[web2py] Re: compressed field

2011-05-03 Thread Massimo Di Pierro
If you need encryption I would just store the sql database in a
truecrypt folder instead of having the application handle it.

On May 3, 8:59 am, Jose jjac...@gmail.com wrote:
 On 3 mayo, 10:40, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

  I never promised long term support so it is not documented anywhere I
  think.But the Sahana Eden project uses it so I continue to maintain it
  until something better comes along.

  There is not much more than in the example above.

 I am thinking in encrypt / decrypt text
 Jose


[web2py] Re: user data

2011-05-03 Thread Massimo Di Pierro
auth.user is a Storage object that you can dovert to a python dict
with dict(auth.user) and contains the user record.
It only contains the information that janrain provides to web2py. Thay
may or may not include email.

On May 3, 9:28 am, Resa taratbr...@gmail.com wrote:
 how do i run a query to get the user data when they sign into Janrain.
 i was trying to use: authEmail=auth.user.email and
 authLast=auth.user.last  to grab the data and put in a variable


[web2py] Re: doctests and @cache

2011-05-03 Thread Massimo Di Pierro
Interesting... please open a ticket on google code. To fix this may
take some work.

On May 3, 12:16 pm, howesc how...@umich.edu wrote:
 Hi all,

 i'm using doctests and the nifty web2py _TEST function to call doctests on
 my controllers (like in the admin app, but since i'm on GAE i am not running
 through admin).

 I just noticed today that functions that i have decorated with @cache do not
 run when i call _TEST.  If i remove the @cache decorator on the function the
 tests run again.  is there a way to have both the @cache decorator and be
 able to run doctests using the _TEST function?

 thanks,

 christian


[web2py] Re: Confusion using experts4solutions

2011-05-03 Thread Massimo Di Pierro
I did not know Ross (or I did not remember). That means there are even
more people doing experts4solution work than I thought.

Massimo

On May 3, 12:39 pm, Ross Peoples ross.peop...@gmail.com wrote:
 Experts4solutions has hooked me up with someone nearby looking to do a long
 term job which plans to sell a web2py app as an appliance. Instead of
 getting paid up front or by the hour, I chose to take a percentage of
 profits, since it's just me and the other person working on it. I can only
 devote 10 to 20 hours a week to it, as I have a day job, but if jobs keep
 coming down the pipeline, I could actually make a career out of web2py.

 Jim or Steve, if you have any small jobs that only take a few hours to do,
 I'd be happy to take a look. As I said, most of my time is spent at my day
 job or working on a big project during the weekend, but if there's some
 small things that I can work on during the week after work to make some
 extra cash, I would be very interested. Feel free to email me.

 Ross


[web2py] Re: Customising the menu with specific classes...

2011-05-03 Thread Massimo Di Pierro
My mistake. Errata:
In

   response.menu=[item1,item2,]

instead of

   item1=[label,False,link]

use

   item1=[label,False,A(label,_href=link,_class='...')]

On May 3, 1:14 pm, Jason Brower encomp...@gmail.com wrote:
 Very odd, but when I put this:
 response.menu.append((A(T('register'), _href=bla, _class=test),
 False, None, []))

 I get this:

 lia onclick=javascript:void(0):return false; href=#/aa
 href=bla class=testregister/a/li

 What up with the javascript? That javascript line is making an extra
 bunch of content in my menu and miss aligning it...
 like this...

 Any ideas what I am doing wrong here.
 BR,
 Jason Brower

 On 05/03/2011 06:23 AM, Massimo Di Pierro wrote:







  In

  response.menu=[item1,item2,]

  instead of

  item1=[label,False,link]

  use

  item1=[A(label,_href=link,_class='...',False,None]

  On May 2, 9:35 pm, Jason Browerencomp...@gmail.com  wrote:
  I really like the MENU() system but I am finding a limit with classes
  and id.
  I would like to set a class or id to each menu item so the theming,
  javascript, and other items could be applied here.  How would I best go
  around doing this?
  I suppose I could try to make a patch to MENU to allow this, but I am
  not very good at backward compatibility. :D
  ---
  Best Regards,
  Jason Brower


[web2py] Re: fixed: decimal field not supported in AJAX / JSON

2011-05-03 Thread Massimo Di Pierro
will do.

On May 3, 1:00 pm, vpiotr vpi...@poczta.onet.pl wrote:
 As far as I can see decimal fields like the following are not
 supported in JSON services.

     Field('car_price', 'decimal(8,6)', requires=IS_NOT_EMPTY()),

 In functions like:

 @service.json
 def getjson():
     return mydata

 web2py framework uses simplejson for serialization.

 The release version of web2py will fail on execution of such a
 procedure with error:
 Decimal(\'21211.12\') is not JSON serializable

 Starting from version 2.1 simplejson library supports decimals which
 can be serialized, but it requires a special argument ('use_decimal')
 provided in dumps():

 gluon\serializers.py:

 def json(value,default=custom_json):
     return simplejson.dumps(value,default=default,use_decimal=True)

 Please include it somehow in next releases of web2py, thanks.


[web2py] Re: Send E-mail on exception/Internal error

2011-05-03 Thread Massimo Di Pierro
If the tickets go in file system, run a backgroup web2py script that
monitors the errors folder and when it finds a new file sends you the
email.

On May 3, 1:21 pm, Dan d...@imojo.de wrote:
 I guess there is no internal function to send new tickets caused by
 exceptions/Internal error to a given E-mail address. What would be the
 best way to implement this without hacking the core framework?

 Thanks for any help.


[web2py] Re: Send E-mail on exception/Internal error

2011-05-03 Thread Massimo Di Pierro
Oops. we have this already... I forgot

scripts/tickets2email.py

On May 3, 1:21 pm, Dan d...@imojo.de wrote:
 I guess there is no internal function to send new tickets caused by
 exceptions/Internal error to a given E-mail address. What would be the
 best way to implement this without hacking the core framework?

 Thanks for any help.


[web2py] Re: doctests and @cache

2011-05-03 Thread howesc
thanks!  ticket 257: http://code.google.com/p/web2py/issues/detail?id=257

i don't understand how those bits work, but feel free to point me to where 
the @cache might be interfering with the doctests and i'm happy to take a 
look.


[web2py] Re: Send E-mail on exception/Internal error

2011-05-03 Thread Anthony
Another alternative might be to use routes_onerror (
http://web2py.com/book/default/chapter/04#Routes-on-Error) to redirect to an 
action (possibly in another application) that will handle sending the email 
(and whatever else you want to do with the error).
 
Anthony

On Tuesday, May 3, 2011 2:44:35 PM UTC-4, Massimo Di Pierro wrote:

 Oops. we have this already... I forgot 

 scripts/tickets2email.py 

 On May 3, 1:21 pm, Dan d@imojo.de wrote: 
  I guess there is no internal function to send new tickets caused by 
  exceptions/Internal error to a given E-mail address. What would be the 
  best way to implement this without hacking the core framework? 
  
  Thanks for any help.



[web2py] Re: Send E-mail on exception/Internal error

2011-05-03 Thread Dan
Thanks a lot Massimo and Anthony. Both of the ways are perfect! Web2py
is absolutely awesome :)



On May 3, 8:51 pm, Anthony abasta...@gmail.com wrote:
 Another alternative might be to use routes_onerror 
 (http://web2py.com/book/default/chapter/04#Routes-on-Error) to redirect to an
 action (possibly in another application) that will handle sending the email
 (and whatever else you want to do with the error).

 Anthony



 On Tuesday, May 3, 2011 2:44:35 PM UTC-4, Massimo Di Pierro wrote:
  Oops. we have this already... I forgot

  scripts/tickets2email.py

  On May 3, 1:21 pm, Dan d@imojo.de wrote:
   I guess there is no internal function to send new tickets caused by
   exceptions/Internal error to a given E-mail address. What would be the
   best way to implement this without hacking the core framework?

   Thanks for any help.


[web2py] blocked permanently key word

2011-05-03 Thread Richard Vézina
Hello Web2py friends,

I am quite buzzy these days that why I have been out of the mailing list for
a wild.

I would like to know if the possibility to blocked a user permanently had
been anticipated??

I mean if you can't remove a user from the auth_user for regulation reason
is there a key word that could be used to set this user access to be blocked
permanently??

There is not in the book about this eventuallity as far as I search (not a
lot ;-) : http://www.web2py.com/book/default/chapter/08?search=blocked

Thanks

Richard


Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-05-03 Thread howesc
Jonathan,

Just upgraded to Version 1.95.1 (2011-04-25 15:04:14)

running GAE SDK, i logged sys.path at the start of a controller, and this is 
it (note no web2py/site-packages):

'/Users/cfhowes/clients/pump/source/web2py', 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/antlr3',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_0_96',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/ipaddr',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/yaml/lib',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/simplejson',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/graphy',
 
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine',
 
'/Users/cfhowes/clients/pump/source/scripts', 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip', 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python', 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload',
 
'/Library/Python/2.5/site-packages', 
'/Library/Python/2.5/site-packages/PIL', 
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC',
 
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode'

i tried to run from trunk but got some other error in the framework, so i'm 
staying out of that for the moment.


Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-05-03 Thread Jonathan Lundell
On May 3, 2011, at 12:27 PM, howesc wrote:
 Jonathan,
 
 Just upgraded to Version 1.95.1 (2011-04-25 15:04:14)
 
 running GAE SDK, i logged sys.path at the start of a controller, and this is 
 it (note no web2py/site-packages):
 
 '/Users/cfhowes/clients/pump/source/web2py', 
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/antlr3',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_0_96',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/ipaddr',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/yaml/lib',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/simplejson',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/graphy',
  
 '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine',
  '/Users/cfhowes/clients/pump/source/scripts', 
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages',
  '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip', 
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', 
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin',
  
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac',
  
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages',
  
 '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python', 
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk',
  
 '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload',
  '/Library/Python/2.5/site-packages', 
 '/Library/Python/2.5/site-packages/PIL', 
 '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC',
  
 '/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode'
 
 i tried to run from trunk but got some other error in the framework, so i'm 
 staying out of that for the moment.

OK, thanks.

Take a look in gluon.main and verify that there's a call near the top to 
create_missing_folders().

Then in gluon.admin.add_path_first, try logging sys.path and path (the 
argument) after the sys.path assignment.





Re: [web2py] Mercurial Error

2011-05-03 Thread Richard Vézina
If you say that everything work well with ubuntu and that both system don't
have the same version of software I would agree that the version are in
cause.

Mercurial 1.0.1 is kind of very old I think... You must check if it has been
compatible with web2py in the first place.

Why you need mercurial in your prod? Just dump your app in that box not
enought? That goog for me. I make a tar ball with each of prod and drop and
replace my old prod with my new prod app.

Hope it help.


Richard


On Mon, May 2, 2011 at 8:14 PM, Eduardo Gonzalez ehgonzale...@gmail.comwrote:

 Hello,

 When I'm trying to use Versioning (mercurial) but I get an a ticket error:

 Traceback (most recent call last):
   File /var/www/web2py/gluon/restricted.py, line 181, in restricted
 exec ccode in environment
   File /var/www/web2py/applications/admin/controllers/mercurial.py, line
 75, in module
   File /var/www/web2py/gluon/globals.py, line 133, in lambda
 self._caller = lambda f: f()
   File /var/www/web2py/applications/admin/controllers/mercurial.py, line
 47, in commit
 files = TABLE(*[TR(file) for file in repo[repo.lookup('.')].files()])
   File /var/lib/python-support/python2.5/mercurial/localrepo.py, line
 443, in lookup
 raise repo.RepoError(_(no revision checked out))
 RepoError: no revision checked out

 My prod environment is:

 Debian 5.0 Lenny AMD64
 Python 2.5.2
 Mercurial 1.0.1
 Web2py  1.95.1

 I use Ubuntu for development (desktop) but everything works Ok!

 My dev environment:
 Ubuntu 10.04 32bits
 Python 2.6.5
 Mercurial 1.4.3
 Web2py 1.95.1

 What's wrong? Software versions?



Re: [web2py] blocked permanently key word

2011-05-03 Thread Anthony
In the auth_user table, set the user's registration_key to blocked (see 
http://web2py.com/book/default/chapter/08#Restrictions-on-registration).
 
Anthony

On Tuesday, May 3, 2011 3:20:46 PM UTC-4, Richard wrote:

 Hello Web2py friends, 

 I am quite buzzy these days that why I have been out of the mailing list 
 for a wild.

 I would like to know if the possibility to blocked a user permanently had 
 been anticipated??

 I mean if you can't remove a user from the auth_user for regulation reason 
 is there a key word that could be used to set this user access to be blocked 
 permanently??

 There is not in the book about this eventuallity as far as I search (not a 
 lot ;-) : http://www.web2py.com/book/default/chapter/08?search=blocked

 Thanks

 Richard



[web2py] Re: deal with CSV

2011-05-03 Thread cyber
My experiments gave the following results.

def export_day():
response.headers['content-type']='text/csv'
response.headers['Content-disposition'] = 'attachment;
filename=export.csv'
results=db(db.autos.dt=date).select(orderby=~db.autos.dt)
return '\n'.join([';'.join(map(str,['id','num','ves','dt','usr
\n']))])+'\n'.join([';'.join(map(str,[r.id, r.num, r.ves, r.dt,
r.usr])) for r in results])

I changed delimiter to ; and added sepator to the header. Also I
wrote content-desposition for headers and now no need to right click
to the link to save file as.
So, it works perfectly! Thank you Denes for you help!
***

On 3 май, 18:37, DenesL denes1...@yahoo.ca wrote:
 Are you running Windows?.
 Check that your list separator (which Excel uses) is set to a comma or
 change the delimiter used in the code.
 You can find the list separator in the Control Panel, under Regional
 Settings, Customize.

 On May 3, 7:38 am, cyber vlad.mul...@gmail.com wrote:







  I mean that after export each row is located into one cell (if I open
  *.csv file in ms excel).
  For example, if result returns two rows all values from first row are
  located into A1 cell and the second one - into A2 cell.
  So, I need to divide each row by columns. Current divider is ,. Is
  there a way to use another tabular separator if i want each value to
  be placed into each cell?
  *** 
  **

  On 3 май, 00:04, DenesL denes1...@yahoo.ca wrote:

   Sorry, I don't understand what you mean by divide search results.

   As for headers, you could do:

   ...
   return 'A1,B1,C1\n' + '\n'.join([','.join(map(str,[r.id, r.num, r.ves,
   r.dt, r.usr])) for r in rr])

   On May 2, 2:42 pm, cyber vlad.mul...@gmail.com wrote:

Denes, it works. Thanks!
But how to divide search results?
Finaly I want each table field to be into personal column in the row
in csv file.
For example, r.id should be into A1, r.num should be into B1 etc.
Is it possible?

*

On 2 май, 00:27, DenesL denes1...@yahoo.ca wrote:

 You can provide a link to the controller below, instructing the user
 to right click on it and then select 'save link as...', he can store
 the response in any selected directory using his choice of filename (a
 name ending in .csv):

 def tocsv():
   response.headers['content-type']='text/csv'
   rr=db((db.autos.dt=t1) 
 (db.autos.dt=t2)).select(orderby=~db.autos.dt)
   return '\n'.join([','.join(map(str,[r.id, r.num, r.ves, r.dt,
 r.usr])) for r in rr])


Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-05-03 Thread howesc
Jonathan,

I added the logging statements and learned some more things:
 - when running the controllers directly it seems to add site-packages 
properly
 - when running the controllers via the _TEST() function for executing 
doctests it fails to add site-packages to the path
 - after trying to run the tests and failing to add site-packages to the 
path, that environment is used for the next normal web-request and does not 
have site-packages on the path.

i hope that helps.  i'm trying to build some automated tests, and that 
suddenly broke the path generation.

let me know if i can help track this down further.

christian


Re: [web2py] blocked permanently key word

2011-05-03 Thread Richard Vézina
You miss read... I know that.

My problem is that when I update my user status I have no switch except
build my own to not update the status of user that should stay blocked.

I mean when I go for maintenance I put everybody to blocked but then when I
want to bring back access to user I put all the blocked to nothing so they
get access again... But the one who should stay blocked I have to check
(remember) and manually set them back to blocked... I could build a lookup
table to know which should stay blocked but a new key word (for example
blocked_permanent) appear to me what I am searching for.

Thanks.

Richard

On Tue, May 3, 2011 at 3:45 PM, Anthony abasta...@gmail.com wrote:

 In the auth_user table, set the user's registration_key to blocked (see
 http://web2py.com/book/default/chapter/08#Restrictions-on-registration).

 Anthony

 On Tuesday, May 3, 2011 3:20:46 PM UTC-4, Richard wrote:

 Hello Web2py friends,

 I am quite buzzy these days that why I have been out of the mailing list
 for a wild.

 I would like to know if the possibility to blocked a user permanently had
 been anticipated??

 I mean if you can't remove a user from the auth_user for regulation reason
 is there a key word that could be used to set this user access to be blocked
 permanently??

 There is not in the book about this eventuallity as far as I search (not a
 lot ;-) : http://www.web2py.com/book/default/chapter/08?search=blocked

 Thanks

 Richard




Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-05-03 Thread Jonathan Lundell
On May 3, 2011, at 1:09 PM, howesc wrote:
 Jonathan,
 
 I added the logging statements and learned some more things:
  - when running the controllers directly it seems to add site-packages 
 properly
  - when running the controllers via the _TEST() function for executing 
 doctests it fails to add site-packages to the path
  - after trying to run the tests and failing to add site-packages to the 
 path, that environment is used for the next normal web-request and does not 
 have site-packages on the path.
 
 i hope that helps.  i'm trying to build some automated tests, and that 
 suddenly broke the path generation.
 
 let me know if i can help track this down further.

I don't know enough about _TEST to have an insight into that aspect of the 
problem, but it sounds like a good clue for someone who does

One thing you might try, though, is to make sure that gluon.main is being 
imported at some point along the way. I figure it should be, because gaehandler 
does it, but again I'm not sure what _TEST is doing.



Re: [web2py] blocked permanently key word

2011-05-03 Thread Anthony
On Tuesday, May 3, 2011 4:16:59 PM UTC-4, Richard wrote: 

 You miss read... I know that. 

 My problem is that when I update my user status I have no switch except 
 build my own to not update the status of user that should stay blocked.

 I mean when I go for maintenance I put everybody to blocked but then when I 
 want to bring back access to user I put all the blocked to nothing so they 
 get access again... But the one who should stay blocked I have to check 
 (remember) and manually set them back to blocked... I could build a lookup 
 table to know which should stay blocked but a new key word (for example 
 blocked_permanent) appear to me what I am searching for.

 
The book says you can use either blocked or disabled -- so why don't you 
use disabled for those who are only temporarily blocked, and use blocked 
for those who are permanently blocked? Note, you can also create a custom 
auth_user table and simply add a column to track those who are permanently 
blocked.
 
Anthony


[web2py] Re: routes_out protocol

2011-05-03 Thread Dan
Hi, did you find any solution to your problem?

I have the same problem. The Url function should build a link over ssl
(https) if the url contains the controller user. e.g. /myapp/user/
login or /myapp/user/register



On Apr 12, 4:43 am, LightOfMooN vladsale...@yandex.ru wrote:
 The problem is because urls is relative, not absolute.

 My problem is:
 If I have https and I'm in sub1.domain.ru, I can't make 
 urlhttps://sub2.domain.ru, because I can't catch protocol inroutes_out,
 like ('$protocol*://domain\.ru:.* /myapp/company/index/$sub',
 '$protocol*://$sub.domain.ru'),

 On 11 апр, 23:45, Jonathan Lundell jlund...@pobox.com wrote:



  On Apr 11, 2011, at 10:13 AM, LightOfMooN wrote:

   Hello
   I have some records in my routes.py

   in routes_in:
      (r'.*://$sub\.domain\.ru:.* /?', r'/myapp/company/index/$sub'),

   inroutes_out:
      ('/myapp/company/index/$sub', 'http://$sub.domain.ru'),

   So, routes_in workds fine, butroutes_outworks only by http.
   Is there a way to get protocol inroutes_out?

  Do you mean the subdomain?

  If the incoming request was for sub.domain.ru, then you want to return a 
  URL that's relative to the scheme  domain, and let the browser fill them 
  in.

  If the request was for sub.domain.ru, and you're generating a URL for 
  other.domain.ru, then you've got no choice but to specify the URL 
  explicitly.

  It's probably best not to use URL() for the cross-domain case, I think. The 
  parametric (new) router assumes that the URL being generated is in the same 
  domain as the current request. I can see how it might be enhanced to 
  support cross-domain URLs, but it's not trivial, and it doesn't happen now.


Re: [web2py] blocked permanently key word

2011-05-03 Thread Richard Vézina
You are my man!

I miss disabled...

Thanks Anthony.

Richard


On Tue, May 3, 2011 at 4:34 PM, Anthony abasta...@gmail.com wrote:

 On Tuesday, May 3, 2011 4:16:59 PM UTC-4, Richard wrote:

 You miss read... I know that.

 My problem is that when I update my user status I have no switch except
 build my own to not update the status of user that should stay blocked.

 I mean when I go for maintenance I put everybody to blocked but then when
 I want to bring back access to user I put all the blocked to nothing so they
 get access again... But the one who should stay blocked I have to check
 (remember) and manually set them back to blocked... I could build a lookup
 table to know which should stay blocked but a new key word (for example
 blocked_permanent) appear to me what I am searching for.


 The book says you can use either blocked or disabled -- so why don't
 you use disabled for those who are only temporarily blocked, and use
 blocked for those who are permanently blocked? Note, you can also create a
 custom auth_user table and simply add a column to track those who are
 permanently blocked.

 Anthony



[web2py] Help with broken migration

2011-05-03 Thread pbreit
I am having trouble getting a column added to a Postgres table. Have I made 
an unrecoverable error in deleting the *.table files without backing up? Is 
there any way to recover short of dropping the DB? I can regenerate the 
/table files of course but are they incompatible with the existing DB?

I have tried various combinations of migrate, fake_migrate, migrate_enabled 
and fake_migrate_all set to True/False. I'm not sure what these do exactly 
and how and when to use them.

Is it OK to add a new Field() in the middle or do I need to add it at the 
end?

Would one solution be to manually edit my DB so that it matches sql.log?

Also, can someone suggest a strategy for what to hgignore in the databases 
directory? I currently am ignoring *.table and storage.sqlite locally and 
databases/* on my servers. Does that sound right?


Re: [web2py] Help with broken migration

2011-05-03 Thread Richard Vézina
Don't understand exactly your problem...

When it is dropped it gone most of the time... If you talk about the file of
SQLite in database folder and if you are under mercurial version control as
you seems to be, may be you can recover your old SQLite file if you haven't
commit your change yet.

SQL.log if you had activated it could help maybe, but if your old database
have been generated by web2py as long as you where creating it
(migrating=true) your database have been created by little piece of DDL
trought out your work... It will be difficult to resynthetise all your
database from these SQL instruction...


Richard

On Tue, May 3, 2011 at 5:26 PM, pbreit pbreitenb...@gmail.com wrote:

 I am having trouble getting a column added to a Postgres table. Have I made
 an unrecoverable error in deleting the *.table files without backing up? Is
 there any way to recover short of dropping the DB? I can regenerate the
 /table files of course but are they incompatible with the existing DB?

 I have tried various combinations of migrate, fake_migrate, migrate_enabled
 and fake_migrate_all set to True/False. I'm not sure what these do exactly
 and how and when to use them.

 Is it OK to add a new Field() in the middle or do I need to add it at the
 end?

 Would one solution be to manually edit my DB so that it matches sql.log?

 Also, can someone suggest a strategy for what to hgignore in the databases
 directory? I currently am ignoring *.table and storage.sqlite locally and
 databases/* on my servers. Does that sound right?



[web2py] Re: Help with broken migration

2011-05-03 Thread Massimo Di Pierro
Do NOT add or delete fields now. Make sure you have your models as
they were when the .table were there working.

The exact command to fix migrations depends on the version. If you
have the latest web2py

DAL(...,fake_migrate_all=True)

will rebuild the .table.

After you remove fake_migrate_all=True you can add or remove fields.


On May 3, 4:26 pm, pbreit pbreitenb...@gmail.com wrote:
 I am having trouble getting a column added to a Postgres table. Have I made
 an unrecoverable error in deleting the *.table files without backing up? Is
 there any way to recover short of dropping the DB? I can regenerate the
 /table files of course but are they incompatible with the existing DB?

 I have tried various combinations of migrate, fake_migrate, migrate_enabled
 and fake_migrate_all set to True/False. I'm not sure what these do exactly
 and how and when to use them.

 Is it OK to add a new Field() in the middle or do I need to add it at the
 end?

 Would one solution be to manually edit my DB so that it matches sql.log?

 Also, can someone suggest a strategy for what to hgignore in the databases
 directory? I currently am ignoring *.table and storage.sqlite locally and
 databases/* on my servers. Does that sound right?


[web2py] Re: Help with broken migration

2011-05-03 Thread pbreit
I think I might have fixed it. We shall see. I can't remember all my steps 
but I did some manual editing to the DB, removed and added back the Field() 
and then did a fake_migrate. It seems that I need to have both migrate and 
fake_migrate True for anything to happen?

[web2py] Re: Confusion using experts4solutions

2011-05-03 Thread Plumo
$0.02 ...

Be wary of taking a percentage of profit as payment.
This can mean the other guy doesn't need to invest anything - neither time 
nor money. Ideas are cheap.
So there is no risk for them, but there is a high risk that you will never 
get paid since most web apps go no where.
If they really believe in their idea they should be willing to invest some 
money upfront.


[web2py] Re: Backup Database

2011-05-03 Thread luifran
If I use import_from_csv_file and this fail, rollback is automatic?

On 3 mayo, 14:59, luifran lbernalhernan...@yahoo.es wrote:
 What mechanisms?

 On 2 mayo, 23:20, howesc how...@umich.edu wrote:







  i'm a little old-skool and just use thedatabase'sbackupmechanisms since
  they are slightly different from db to db, but in general faster to run than
  CSV dump and import.

  cfh


Re: [web2py] Re: What is the convention for using web2py/site-packages for GAE?

2011-05-03 Thread howesc
ok, i'll play with it more.

i just upgraded to the latest release yesterday, but in older versions i 
noticed that sometimes site-packages would be on the path and sometimes not, 
but i only have had that problem in the SDK and a restart usually solves it 
so i didn't worry too much about it.

thanks again,

cfh


[web2py] Re: how to set the value of textarea form field on accept, upload without storing files

2011-05-03 Thread DenesL

Set the uploadfield to the name of the other field:

  Field('species_file', 'upload', label=Upload Names,
uploadfield='species')

uploadfield = True # means store file on disk
uploadfield = 'field_name' # store content in that DB field
uploadfield = False # file content is discarded


On May 2, 3:50 am, selecta gr...@delarue-berlin.de wrote:
 *bump*

 On Apr 29, 1:30 pm, selecta gr...@delarue-berlin.de wrote:







   Also I wonder if there is a method to upload the file without ever
   storing it? If I remove the uploadfolder argument it does not work. I
   really dont want to store the file at all.

  ok i should have serached a bit more
  uploadfield=False
  does the trick

  a bit more information on the other problem
  species_form.element(_id=no_table_species)
  species_form_elem[_value] = 'foobar'
  works, but it produces
  textarea value=foobar/textarea
  but i want rather
  species_form_elem[value] = 'foobar'
  textareafoobar/textarea
  since only this is displayed in the textarea


[web2py] Re: deal with CSV

2011-05-03 Thread DenesL

You are welcome.

Note: if you have strings you don't need map(str,...) and
that \n at the end of 'usr\n' must be causing a blank line, so

'\n'.join([';'.join(map(str,['id','num','ves','dt','usr\n']))])

can be just

'%s\n' %';'.join('id num ves dt usr'.split())


On May 3, 3:46 pm, cyber vlad.mul...@gmail.com wrote:
 My experiments gave the following results.

 def export_day():
     response.headers['content-type']='text/csv'
     response.headers['Content-disposition'] = 'attachment;
 filename=export.csv'
     results=db(db.autos.dt=date).select(orderby=~db.autos.dt)
     return '\n'.join([';'.join(map(str,['id','num','ves','dt','usr
 \n']))])+'\n'.join([';'.join(map(str,[r.id, r.num, r.ves, r.dt,
 r.usr])) for r in results])

 I changed delimiter to ; and added sepator to the header. Also I
 wrote content-desposition for headers and now no need to right click
 to the link to save file as.
 So, it works perfectly! Thank you Denes for you help!
 ***

 On 3 май, 18:37, DenesL denes1...@yahoo.ca wrote:







  Are you running Windows?.
  Check that your list separator (which Excel uses) is set to a comma or
  change the delimiter used in the code.
  You can find the list separator in the Control Panel, under Regional
  Settings, Customize.

  On May 3, 7:38 am, cyber vlad.mul...@gmail.com wrote:

   I mean that after export each row is located into one cell (if I open
   *.csv file in ms excel).
   For example, if result returns two rows all values from first row are
   located into A1 cell and the second one - into A2 cell.
   So, I need to divide each row by columns. Current divider is ,. Is
   there a way to use another tabular separator if i want each value to
   be placed into each cell?
   ***
**

   On 3 май, 00:04, DenesL denes1...@yahoo.ca wrote:

Sorry, I don't understand what you mean by divide search results.

As for headers, you could do:

...
return 'A1,B1,C1\n' + '\n'.join([','.join(map(str,[r.id, r.num, r.ves,
r.dt, r.usr])) for r in rr])

On May 2, 2:42 pm, cyber vlad.mul...@gmail.com wrote:

 Denes, it works. Thanks!
 But how to divide search results?
 Finaly I want each table field to be into personal column in the row
 in csv file.
 For example, r.id should be into A1, r.num should be into B1 etc.
 Is it possible?

 *

 On 2 май, 00:27, DenesL denes1...@yahoo.ca wrote:

  You can provide a link to the controller below, instructing the user
  to right click on it and then select 'save link as...', he can store
  the response in any selected directory using his choice of filename 
  (a
  name ending in .csv):

  def tocsv():
    response.headers['content-type']='text/csv'
    rr=db((db.autos.dt=t1) 
  (db.autos.dt=t2)).select(orderby=~db.autos.dt)
    return '\n'.join([','.join(map(str,[r.id, r.num, r.ves, r.dt,
  r.usr])) for r in rr])


[web2py] Re: EULA agreement on first login

2011-05-03 Thread Charles Law
I actually had that code originally, but if I edit the flag using the
appadmin, I get strings, so I added the 2nd check.

Also, Massimo, that did the trick!
I had:
db(db.auth_user.id==me).update(eula_accepted=True)

Thanks,
Charles


On May 3, 9:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You may have an old web2py version. The auth.user should be re-read
 after editing profile. If the eula is not in profile than you have to
 set it manually in the action that handles he eula

 auth.user.eula_accepted=True

 On May 2, 11:10 pm, Charles Law charles@gmail.com wrote:







  I'm trying to add an EULA that users have to agree to on first login.
  I'm doing this right now by adding a field to the auth.user called the
  eula_accepted flag.  If that flag isn't set, it will load a EULA form,
  otherwise, it loads the default webpage.

  When the user accepts the agreement, the form gets submitted which
  sets the flag.  I can verify using the appadmin that the field gets
  set.  But what seems to happen after accepting the form is that the
  flag is not reread even when I refresh the page.  Is there any command
  I can run to reread the flag?  The only thing I've gotten to work so
  far is to login again.  Any ideas?

  Here is the (messy) if statement in the html view.
  {{if auth.user and (auth.user.eula_accepted==False or
  auth.user.eula_accepted==False):}}
  Thanks!


[web2py] MongoDBAdapter -- in DAL

2011-05-03 Thread joseph simpson
The current dal.py file contains the following code, between lines
3381 and 3404:



ADAPTERS = {
'sqlite': SQLiteAdapter,
'sqlite:memory': SQLiteAdapter,
'mysql': MySQLAdapter,
'postgres': PostgreSQLAdapter,
'oracle': OracleAdapter,
'mssql': MSSQLAdapter,
'mssql2': MSSQL2Adapter,
'db2': DB2Adapter,
'informix': InformixAdapter,
'firebird': FireBirdAdapter,
'firebird_embedded': FireBirdAdapter,
'ingres': IngresAdapter,
'ingresu': IngresUnicodeAdapter,
'sapdb': SAPDBAdapter,
'jdbc:sqlite': JDBCSQLiteAdapter,
'jdbc:sqlite:memory': JDBCSQLiteAdapter,
'jdbc:postgres': JDBCPostgreSQLAdapter,
'gae': GoogleDatastoreAdapter, # discouraged, for backward
compatibility
'google:datastore': GoogleDatastoreAdapter,
'google:sql': GoogleSQLAdapter,
'couchdb': CouchDBAdapter,
'mongodb': CouchDBAdapter,
}

The last line:
  'mongodb': CouchDBAdapter,

Maybe should be ---  'mongodb': MongoDBAdapter,



[web2py] Re: getting error while trying to deploy on gae (Google App Engine Deployment Interface)

2011-05-03 Thread howesc
i've never used the wizards, i was use GAE before they existed and already 
had my shell scripts...

anyhow try:
 'which appcfg.py' in the shell to see where it really is installed and 
update the wizard.  if that fails then you don't have the GAE SDK installed 
(it is distributed by google and is not included with web2py)

cfh


[web2py] Re: Backup Database

2011-05-03 Thread howesc
in mysql i use mysqldump

in postgres i use pgdump

in GAE i use the bulkloader tools.

import from CSV is great for small databases, but beyond a few megs gets 
pretty hard.

cfh