Re: [web2py] Send Email After Registration

2012-09-24 Thread Yebach
For controler you mean the user controler?
Or do I create a new one?

this is my current user controler
def user():
form = auth()
if request.vars.msg:
response.flash = " 'u'Registracija je v postopku odobritve. Ko bo 
vaš račun potrjen boste o tem obveščeni preko e-maila."
   
#auth.settings.controller="user"
return dict(form=form,locals = locals())

and for auth.settings.register_next = URL('user',vars={'msg':'welcome'})

There is no message

On Friday, September 21, 2012 4:22:41 PM UTC+2, Hassan Alnatour wrote:
>
> Sorry i mean in db.py :
>
> auth.settings.register_next = URL('index',vars={'msg':'welcome'}) 
>
>
> Best Regards,
>
>
>
> On Fri, Sep 21, 2012 at 5:21 PM, hasan alnator 
> 
> > wrote:
>
>> Dear Yebach , 
>>
>> in db.py : 
>>
>> auth.settings.register_next = URL('Welcome',vars={'msg':'welcome'})
>>
>> in controller :
>>
>> def index():
>> if request.vars.msg:
>>   response.flash = " 'u'Registracija je v postopku odobritve. Ko bo 
>> vaš račun potrjen boste o tem obveščeni preko e-maila."
>> return locals()
>>
>>
>>
>> On Fri, Sep 21, 2012 at 9:46 AM, Yebach > >wrote:
>>
>>> I have a  auth.settings.registration_requires_approval = True 
>>>
>>> I just want that after a user registers a message would be printed smth 
>>> like: "Your registration is being processed...bla bla bal"
>>>
>>> I set the parameter  auth.messages.registration_pending = u'Registracija 
>>> je v postopku odobritve. Ko bo vaš račun potrjen boste o tem obveščeni 
>>> preko e-maila.'
>>> And nothing happens
>>>
>>> Also email to the user is not sent.
>>>
>>> On Friday, September 21, 2012 8:10:58 AM UTC+2, Alec Taylor wrote:
>>>
 Throw in a decorator to that function 

 @auth.requires_login() 

 On Fri, Sep 21, 2012 at 12:15 AM, hasan alnator 
  wrote: 
 > Dear  Yebach  , 
 > 
 > Are you logged in ? 
 > 
 > Best Regards, 
 > 
 > 
 > On Thu, Sep 20, 2012 at 5:13 PM, Yebach  wrote: 
 >> 
 >> Hello 
 >> 
 >> I am getting an error 
 >> 
 >>  User_Email = auth.user.email 
 >> AttributeError: 'NoneType' object has no attribute 'email' 
 >> 
 >> 
 >> 
 >> 
 >> On Thursday, September 20, 2012 11:15:31 AM UTC+2, Alec Taylor 
 wrote: 
 >>> 
 >>> Nicely done. 
 >>> 
 >>> On Thu, Sep 20, 2012 at 7:13 PM, hasan alnator 
 >>>  wrote: 
 >>> > Ok I DID it like this : 
 >>> > 
 >>> > auth.settings.register_next = URL('Welcome') 
 >>> > 
 >>> > def Welcome(): 
 >>> > User_Email = auth.user.email 
 >>> > mail.send(User_Email,'Welcome To website','Welcome To 
 website') 
 >>> > if request.vars.lan == 'En': 
 >>> > redirect('index',vars={'lan':'**En'}) 
 >>> > else: 
 >>> > redirect('index') 
 >>> > 
 >>> > 
 >>> > Best Regards, 
 >>> > 
 >>> > On Thu, Sep 20, 2012 at 11:09 AM, hasan alnator 
 >>> >  
 >>> > wrote: 
 >>> >> 
 >>> >> Dear Alec , 
 >>> >> 
 >>> >> I Dont want email verification , i just want to send an email 
 that 
 >>> >> says 
 >>> >> welcome . 
 >>> >> 
 >>> >> Best Regards, 
 >>> > 
 >>> > 
 >>> > -- 
 >>> > 
 >>> > 
 >>> > 
 >> 
 >> -- 
 >> 
 >> 
 >> 
 > 
 > 
 > -- 
 > 
 > 
 > 

>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>
>

-- 





[web2py] SQLFORM IS_DATE() error (bug?)

2012-09-24 Thread lyn2py


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.

Traceback (most recent call last):
  File "/Users/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
  File 
"/Users/charlyn/web2py/source/applications/solidworks/controllers/default.py" 
, line 456, 
in 
  File "/Users/web2py/gluon/globals.py", line 186, in 
self._caller = lambda f: f()
  File "/Users/web2py/gluon/tools.py", line 2832, in f
return action(*a, **b)
  File 
"/Users/charlyn/web2py/source/applications/solidworks/controllers/default.py" 
, line 321, 
in quotation
record = db.quotations(form.vars.id)
  File "/Users/web2py/gluon/dal.py", line 7664, in __call__
limitby=(0,1),for_update=for_update).first()
  File "/Users/web2py/gluon/dal.py", line 8795, in select
return adapter.select(self.query,fields,attributes)
  File "/Users/web2py/gluon/dal.py", line 2102, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "/Users/web2py/gluon/dal.py", line 1599, in select
return self._select_aux(sql,fields,attributes)
  File "/Users/web2py/gluon/dal.py", line 1564, in _select_aux
self.execute(sql)
  File "/Users/web2py/gluon/dal.py", line 1676, in execute
return self.log_execute(*a, **b)
  File "/Users/web2py/gluon/dal.py", line 1670, in log_execute
ret = self.cursor.execute(*a, **b)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py",
 line 66, in convert_timestamp
datepart, timepart = val.split(" ")
ValueError: need more than 1 value to unpack


Function argument list

(val='2012-09-27')

Code listing  

61.
62.
63.
64.
65.
66.

67.
68.
69.
70.


def convert_date(val):
return datetime.date(*map(int, val.split("-")))

def convert_timestamp(val):
datepart, timepart = val.split(" ")

year, month, day = map(int, datepart.split("-"))
timepart_full = timepart.split(".")
hours, minutes, seconds = map(int, timepart_full[0].split(":"))
if len(timepart_full) == 2:


Variablestimepartundefinedval.split
datepartundefinedval'2012-09-27'

This broke after I updated to Version 2.0.9 (2012-09-17 21:37:10) stable

It was working ok before (v2.0.8).

-- 





[web2py] Re: log out user

2012-09-24 Thread Yebach
If I put session.clear() into the controler of the default page it works

Is that I good solution? It is true that a user has to log in again but it 
kind of works

On Monday, September 24, 2012 8:48:03 AM UTC+2, Yebach wrote:
>
> Where do I insert the code? In model?
>
> this is now my code in db.py
>
> if session['school_db'] != request.cookies['mycookie'].value:
> auth.logout()
> session['school_db'] = request.cookies['mycookie'].value
>
> But I get an error 
> 'NoneType' object has no attribute 'insert'
>
> seems like smth is wrong with auth.logout()
>
> On Friday, September 21, 2012 6:03:59 PM UTC+2, Massimo Di Pierro wrote:
>>
>> After login your user info is loaded into session. You need to add 
>> something like
>>
>> if session.dbname != current_db_name:
>> auth.logout()
>> session.dbname = current_db_name
>>
>>
>> On Friday, 21 September 2012 07:47:08 UTC-5, Yebach wrote:
>>>
>>> Hello
>>>
>>> You can see my app on portal.iurnik.si  
>>>
>>> I have the following problem 
>>> after user selects a school app connects to a specific database where 
>>> data is read from. On that database the auth tables are created so 
>>> registered users can download some documents.
>>> The problems occurs if I log in on one school (database) and then I go 
>>> back to main page, select a new database I am already logged in. How?? I 
>>> mean auth tables are created on db but the user is not. How can I solve 
>>> this?
>>>
>>> I am reading database name from cookie
>>>
>>> Thank you
>>>
>>>
>>>

-- 





Re: [web2py] Re: Workflow engine for web2py

2012-09-24 Thread António Ramos
No news about workflows in web2py?


2012/4/16 António Ramos 

> For me, the advantage i see is to centrally manage(create,change,edit,etc)
> all workflow rules of all apps that use workflow.
> maybe there is some disadvantagesomewhere else on the line ...
>
>
>
> 2012/4/16 Carlos Costa 
>
>> I think it is.
>> What are the advantages with this aproach?
>>
>> Em 16 de abril de 2012 07:44, António Ramos 
>> escreveu:
>> > I suggest a workflow as a service.
>> > I have a database where i define all workflows for all databases.
>> >
>> > I have something like this way in a Lotus Notes environment.
>> > I get away with it very nicely. :)
>> > If i keep control fields in my record
>> > like,
>> > readers
>> > authors
>> > step
>> > next step formula
>> > code to execute in this step
>> > etc
>> >
>> > then i just call the webservice and send my document as a paramenter
>> and get
>> > a recalculated document.
>> >
>> > Is this feasible in web2py?
>> >
>> > thank you
>> >
>> > António
>> >
>> >
>> >
>> > 2012/3/1 yamandu 
>> >>
>> >> Just one resource I found interesting: http://workflowpatterns.com/
>> >>
>> >> Em terça-feira, 7 de fevereiro de 2012 23h58min19s UTC-2, mart
>> escreveu:
>> >>>
>> >>> Something to think about if effort is put on this (just a suggestion).
>> >>> You may want to consider the importance of 'roles' in an implemented
>> >>> wf engine, since user to role interaction should probably be key in a
>> >>> wf model (or at least as important as having the ability to move work
>> >>> items around).
>> >>>
>> >>> Just my 2 cents,
>> >>> Mart
>> >>>
>> >>> On Feb 7, 5:35 pm, Richard Vézina 
>> wrote:
>> >>> > From what I understand you can do just that, but without reinventing
>> >>> > the
>> >>> > wheel by designing and implementing your own solution.
>> >>> >
>> >>> > Richard
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> > On Tue, Feb 7, 2012 at 5:27 PM, Ross Peoples <
>> ross.peop...@gmail.com>
>> >>> > wrote:
>> >>> > > I don't know workflow engines in the general sense that well. I
>> once
>> >>> > > created a full documentation management system where each document
>> >>> > > couple
>> >>> > > have a workflow assigned to it. The workflow (predefined, or
>> created
>> >>> > > on-the-fly) would push the document around from person to person,
>> >>> > > ensuring
>> >>> > > that each person completed their step in the time allotted,
>> otherwise
>> >>> > > an
>> >>> > > email would get sent to their manager.
>> >>> >
>> >>> > > Would a workflow engine allow me to do the same thing, or is this
>> a
>> >>> > > different type of workflow engine?
>> >
>> >
>>
>>
>>
>> --
>> Carlos J. Costa
>> Cientista da Computação
>> Esp. Gestão em Telecom
>>
>> EL MELECH NEEMAN!
>> אָמֵן
>>
>
>

-- 





[web2py] is this a bug in the debugger?

2012-09-24 Thread Tim Richardson
In web2py 2.0.9 source I'm printing a variable which is a string including 
the substring  ×tamp1
which gets rendered in the debugger as x (that is, "×" become the 
cross being a multiplication symbol
If I reverse the string, it shows what I expect.
The minimal testcase is to do this in the debugger console
teststring='×tamp"




-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-24 Thread VP
As indicated in the title, I'm using 2.0.9, which is latest as of now.


On Sunday, September 23, 2012 4:41:15 PM UTC-5, Massimo Di Pierro wrote:
>
> What version are you using?
>
> This is what I get:
>
> >>> db=DAL()
> >>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
> >>> product.insert(cost1=10, cost2=20)
> 1
> >>> p = db.product(1)
> >>> p.update_record(cost1=5)
> , 
> 'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
> }>
> >>> print db.product[1].total
> 30
>
> On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:
>>
>> I figured out what I would call a bug.
>>
>> I'll give an example:
>>
>> Let's say we have this table:
>>
>>
>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>
>>
>> And if you do this:
>>
>> product.insert(cost1=10, cost2=20)
>> p = db.product(1)
>> p.update_record(cost1=5)
>>
>>
>> This update won't work.  What is worse is that it fails silently.   The 
>> reason it won't work is that the row input of the lambda does not have 
>> "cost2" in it.
>>
>> If, however, you do this:
>>
>> p.update_record(cost1=5, cost2=p.cost2)
>>
>> Then it will work, because now the parameter r (i.e. the row) has both 
>> cost1 and cost2.
>>
>>
>>
>> I think it'll be a little tricky for you to fix this, because you 
>> probably want update to have only relevant fields so that saving to the 
>> database is effective.   However, this behavior clearly is not desirable.
>>
>>
>>
>> On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> Can you show us an example?
>>>
>>> computed fields usually do not work when there is not enough information 
>>> to compute. The information must be in the arguments of update_record or 
>>> update. It will not retrive the info from the database.
>>>
>>>
>>>
>>>
>>> On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:

 - sqlite
 - 2 compute fields do not seem to get call on update using both 
 update_record and db().update
 - They do work on crud/form updates though.

>>>

-- 





Re: [web2py] Re: Workflow engine for web2py

2012-09-24 Thread Patrick Installe
This survey couid inspire someone
http://snarfed.org/workflow_software_survey

-- 





[web2py] Re: registration message

2012-09-24 Thread Hassan Alnatour

Dear Yebach ,

just add this in the default/school in the controller : 

 if request.vars.school == 'database': 
   response.flash = 'your_Massage!'


Notes : 

check if you have {{=response.flash or ' '}} in you school page so it can 
show the response you sent from the controller .

Best Regards,

On Thursday, September 20, 2012 12:05:22 PM UTC+3, Yebach wrote:
>
> Hello
>
> After a new user is created I want to show the flash message and redirect 
> a user back to home page.
>
> The redirection is done with
> auth.settings.register_next = URL('school','index', 
> vars=dict(school=database))
> and 
> for message 
>  auth.messages.registration_pending ('bklabafbaklva')
>
> but the message is not shown? why?
>
> thank you
>

-- 





Re: [web2py] Re: RFC: web2py-based workflow engine

2012-09-24 Thread António Ramos
Same question here
Ross,
How's the workflow engine going ?

Cheers
António

2012/7/6 Andrew 

> Hi Ross,
> How's the workflow engine going ?
>
> Regards
> Andrew W
>

-- 





Re: [web2py] Re: What to expect in web2py 2.0

2012-09-24 Thread António Ramos
what is the status?

2012/5/22 Ross Peoples 

> Richard,
>
> Thanks for the offer. I *think* I'm nearly done. I'm writing some tests
> for it now and so far so good. If I run into any problems, I'll let you
> know.
>
> Ross
>
>
> On Tuesday, May 22, 2012 11:09:31 AM UTC-4, Richard wrote:
>>
>> Ross,
>>
>> If you need help just ask!
>>
>> Richard
>>
>>

-- 





[web2py] Re: registration message

2012-09-24 Thread Yebach
All I needed was actually add{{=response.flash or ' '}} in my view and 
it worked

but thanx for the hint

On Monday, September 24, 2012 3:46:20 PM UTC+2, Hassan Alnatour wrote:
>
>
> Dear Yebach ,
>
> just add this in the default/school in the controller : 
>
>  if request.vars.school == 'database': 
>response.flash = 'your_Massage!'
>
>
> Notes : 
>
> check if you have {{=response.flash or ' '}} in you school page so it can 
> show the response you sent from the controller .
>
> Best Regards,
>
> On Thursday, September 20, 2012 12:05:22 PM UTC+3, Yebach wrote:
>>
>> Hello
>>
>> After a new user is created I want to show the flash message and redirect 
>> a user back to home page.
>>
>> The redirection is done with
>> auth.settings.register_next = URL('school','index', 
>> vars=dict(school=database))
>> and 
>> for message 
>>  auth.messages.registration_pending ('bklabafbaklva')
>>
>> but the message is not shown? why?
>>
>> thank you
>>
>

-- 





[web2py] Validate HTML Form

2012-09-24 Thread Bruno Codeman

Hello everyone! I'm going back to web2py after one year developing with 
other technologies and saw a lot of good changes! Congrats Massimo and the 
dev team!

So, I would like to ask a question: I have a full HTML form, rendered by an 
action and processed by other action. There is a way to validate it like 
form.accept() on the processing action? This form create 2 records in 2 
different tables at the database (a company and an user for this company). 
I intend to use filter_fields to save this records after the validation.

Thanks!

-- 





Re: [web2py] Re: Workflow engine for web2py

2012-09-24 Thread Massimo Di Pierro
Not sure how relevant it is but some time ago I made this:

https://github.com/mdipierro/workflow

It is not web2py specific and it is designed for file-based workflow. It 
can be used with web2py in the sense that it can run web2py background 
tasks.

It could be improved by reading the state and the rules directly from the 
dal.

massimo


On Monday, 24 September 2012 08:37:24 UTC-5, Patrick wrote:
>
> This survey couid inspire someone 
> http://snarfed.org/workflow_software_survey 

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-24 Thread Massimo Di Pierro
Please try the nightly build and let us know if the problem is still there.

Massimo

On Monday, 24 September 2012 07:49:26 UTC-5, VP wrote:
>
> As indicated in the title, I'm using 2.0.9, which is latest as of now.
>
>
> On Sunday, September 23, 2012 4:41:15 PM UTC-5, Massimo Di Pierro wrote:
>>
>> What version are you using?
>>
>> This is what I get:
>>
>> >>> db=DAL()
>> >>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>> >>> product.insert(cost1=10, cost2=20)
>> 1
>> >>> p = db.product(1)
>> >>> p.update_record(cost1=5)
>> , 
>> 'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
>> }>
>> >>> print db.product[1].total
>> 30
>>
>> On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:
>>>
>>> I figured out what I would call a bug.
>>>
>>> I'll give an example:
>>>
>>> Let's say we have this table:
>>>
>>>
>>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>>
>>>
>>> And if you do this:
>>>
>>> product.insert(cost1=10, cost2=20)
>>> p = db.product(1)
>>> p.update_record(cost1=5)
>>>
>>>
>>> This update won't work.  What is worse is that it fails silently.   The 
>>> reason it won't work is that the row input of the lambda does not have 
>>> "cost2" in it.
>>>
>>> If, however, you do this:
>>>
>>> p.update_record(cost1=5, cost2=p.cost2)
>>>
>>> Then it will work, because now the parameter r (i.e. the row) has both 
>>> cost1 and cost2.
>>>
>>>
>>>
>>> I think it'll be a little tricky for you to fix this, because you 
>>> probably want update to have only relevant fields so that saving to the 
>>> database is effective.   However, this behavior clearly is not desirable.
>>>
>>>
>>>
>>> On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro 
>>> wrote:

 Can you show us an example?

 computed fields usually do not work when there is not enough 
 information to compute. The information must be in the arguments of 
 update_record or update. It will not retrive the info from the database.




 On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:
>
> - sqlite
> - 2 compute fields do not seem to get call on update using both 
> update_record and db().update
> - They do work on crud/form updates though.
>


-- 





[web2py] Re: registration message

2012-09-24 Thread Hassan Alnatour

You are more than welcome Yebach ;)

regards,

On Monday, September 24, 2012 5:55:20 PM UTC+3, Yebach wrote:
>
> All I needed was actually add{{=response.flash or ' '}} in my view and 
> it worked
>
> but thanx for the hint
>
> On Monday, September 24, 2012 3:46:20 PM UTC+2, Hassan Alnatour wrote:
>>
>>
>> Dear Yebach ,
>>
>> just add this in the default/school in the controller : 
>>
>>  if request.vars.school == 'database': 
>>response.flash = 'your_Massage!'
>>
>>
>> Notes : 
>>
>> check if you have {{=response.flash or ' '}} in you school page so it can 
>> show the response you sent from the controller .
>>
>> Best Regards,
>>
>> On Thursday, September 20, 2012 12:05:22 PM UTC+3, Yebach wrote:
>>>
>>> Hello
>>>
>>> After a new user is created I want to show the flash message and 
>>> redirect a user back to home page.
>>>
>>> The redirection is done with
>>> auth.settings.register_next = URL('school','index', 
>>> vars=dict(school=database))
>>> and 
>>> for message 
>>>  auth.messages.registration_pending ('bklabafbaklva')
>>>
>>> but the message is not shown? why?
>>>
>>> thank you
>>>
>>

-- 





[web2py] SQLFORM IS_DATE() error (bug?)

2012-09-24 Thread lyn2py
I tried but couldn't reproduce the problem in a new app in 2.0.9

Going back to 2.0.8 also didn't work. I may have remembered the wrong version 
that worked after applying many updates. 

Appreciate any hints on how I may make it work?

It seems that dal date is not accepting the format and requires a time along 
with it. 

Thanks. 

-- 





[web2py] SOLVED 'efficiently search by tag' with postgres

2012-09-24 Thread andrej burja
hi

it works
thank you

andrej

On Sunday, September 23, 2012 12:18:32 AM UTC+2, Massimo Di Pierro wrote:
>
> Looks like postgres is picky and wants in groupby all the selected fields 
> in distinct. This should work:
>
> rows = db(data.id==tag.record_id)\
> (tag.name.belongs(tags)).select(
>data.ALL,
>orderby=data.id,
>groupby=data.id|data.value,
>distinct=True)
>
> On Saturday, 22 September 2012 15:00:07 UTC-5, andrej burja wrote:
>>
>> the code with problem:
>>
>> rows = db(data.id==tag.record_id)\
>> (tag.name.belongs(tags)).select(
>>data.ALL,
>>orderby=data.id,
>>groupby=data.id,
>>distinct=True)
>>
>>
>>
>> On Saturday, September 22, 2012 10:26:27 AM UTC+2, andrej burja wrote:
>>>
>>> hi 
>>>
>>> i would like to use idea in book Application Development Cookbook - 
>>> Efficienty search by tag. 
>>> there are two functions: 'search_or' and 'search_and'
>>> everything is working fine on sqlite
>>> when i switch to postgres, there seems to be problem with 'groupby'. 
>>> i got an error 
>>>
>>>  column "data.value" must appear in 
>>> the GROUP BY clause or be used in an aggregate function LINE 1: SELECT 
>>> DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^
>>> when i remove 'groupby=id" there is no error, but (of course) 
>>> 'search_and' function doesn't work properly
>>>
>>> is this a bug related to postgres?
>>>
>>> andrej
>>>
>>

-- 





Re: [web2py] Validate HTML Form

2012-09-24 Thread Bruno Rocha
On the processing action you can use
db.table.validate_and_insert(**fields), if validated the record will be
inserted, otherwise it will return the error message, if you do not want to
insert the values, so you can use table._validate method
 db.table._validate(**fields) will doo the same but nothing will be
inserted.

-- 





Re: [web2py] Validate HTML Form

2012-09-24 Thread Bruno Codeman
thanks again, Bruno. You're always saving me, LoL.

Em segunda-feira, 24 de setembro de 2012 13h09min22s UTC-3, rochacbruno 
escreveu:
>
> On the processing action you can use 
> db.table.validate_and_insert(**fields), if validated the record will be 
> inserted, otherwise it will return the error message, if you do not want to 
> insert the values, so you can use table._validate method 
>  db.table._validate(**fields) will doo the same but nothing will be 
> inserted. 

-- 





[web2py] Re: SQLFORM IS_DATE() error (bug?)

2012-09-24 Thread lyn2py
I finally figured out... I just needed to change the name of the field and 
it worked...

My guess is, the field was somehow made datetime instead of date... and 
changing the field name 'reset' this behavior.


On Monday, September 24, 2012 11:52:43 PM UTC+8, lyn2py wrote:
>
> I tried but couldn't reproduce the problem in a new app in 2.0.9
>
> Going back to 2.0.8 also didn't work. I may have remembered the wrong 
> version that worked after applying many updates. 
>
> Appreciate any hints on how I may make it work?
>
> It seems that dal date is not accepting the format and requires a time 
> along with it. 
>
> Thanks. 
>
>

-- 





[web2py] Re: web2py 2.0 DAL no longer usable for mysql stored procedures

2012-09-24 Thread Massimo Di Pierro
can you show us some of your code. This may be a concurrency issues. I 
cannot thing anything we change that would affect the behavior.

On Sunday, 23 September 2012 22:43:28 UTC-5, Yarin wrote:
>
> After upgrading to web2py 2.0, we can no longer use the DAL or mysql 
> adapters to make MySQL stored procedure calls.
>
> In web2py 1.x I had 
> reportedhow 
> mysql stored procedures weren't working for us in certain 
> circumstances- however we were able to circumvent those issues by simply 
> creating a new DAL instance everytime we had to call a sproc. With the new 
> DAL, that's no longer an option- indeed, any call to a stored procedure 
> seems to fail in any attempt through the DAL or mysql adapter. 
>
>- Fails with both pymysql and mysqldb drivers
>- Fails when calling commit() immediately after
>- We did side-by-side comparisons with web2py 1.x on same server, 
>pointing to same db, and confirmed this fails only in 2.0
>- You can make sproc calls using the DAL straight from the web2py 
>shell, but only if you don't call commit. 
>
>
> Stack trace:
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/main.py", line 580, in wsgibase
> BaseAdapter.close_all_instances('rollback')
>   File "/opt/web-apps/web2py/gluon/dal.py", line 511, in close_all_instances
> getattr(instance, action)()
>   File "/opt/web-apps/web2py/gluon/dal.py", line 1633, in rollback
> return self.connection.rollback()
> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
> now")
>
>
>
> Right now the only option we've arrive at is to make sproc calls directly 
> through the pymysql driver API, one per connection.
>
>
>

-- 





[web2py] Re: log out user

2012-09-24 Thread Massimo Di Pierro
It may be if you want to always clean everything in the session (auth info 
etc.)

On Monday, 24 September 2012 03:04:24 UTC-5, Yebach wrote:
>
> If I put session.clear() into the controler of the default page it works
>
> Is that I good solution? It is true that a user has to log in again but it 
> kind of works
>
> On Monday, September 24, 2012 8:48:03 AM UTC+2, Yebach wrote:
>>
>> Where do I insert the code? In model?
>>
>> this is now my code in db.py
>>
>> if session['school_db'] != request.cookies['mycookie'].value:
>> auth.logout()
>> session['school_db'] = request.cookies['mycookie'].value
>>
>> But I get an error 
>> 'NoneType' object has no attribute 'insert'
>>
>> seems like smth is wrong with auth.logout()
>>
>> On Friday, September 21, 2012 6:03:59 PM UTC+2, Massimo Di Pierro wrote:
>>>
>>> After login your user info is loaded into session. You need to add 
>>> something like
>>>
>>> if session.dbname != current_db_name:
>>> auth.logout()
>>> session.dbname = current_db_name
>>>
>>>
>>> On Friday, 21 September 2012 07:47:08 UTC-5, Yebach wrote:

 Hello

 You can see my app on portal.iurnik.si  

 I have the following problem 
 after user selects a school app connects to a specific database where 
 data is read from. On that database the auth tables are created so 
 registered users can download some documents.
 The problems occurs if I log in on one school (database) and then I go 
 back to main page, select a new database I am already logged in. How?? I 
 mean auth tables are created on db but the user is not. How can I solve 
 this?

 I am reading database name from cookie

 Thank you




-- 





[web2py] Re: is this a bug in the debugger?

2012-09-24 Thread Massimo Di Pierro
What do you mean by "If I reverse the string, it shows what I expect."?

On Monday, 24 September 2012 07:36:27 UTC-5, Tim Richardson wrote:
>
> In web2py 2.0.9 source I'm printing a variable which is a string including 
> the substring  ×tamp1
> which gets rendered in the debugger as x (that is, "×" become the 
> cross being a multiplication symbol
> If I reverse the string, it shows what I expect.
> The minimal testcase is to do this in the debugger console
> teststring='×tamp'
>
>
>
>
>

-- 





[web2py] Re: rocket.error

2012-09-24 Thread Massimo Di Pierro
I do not know but some action is returning a  object instead 
of a string or a dict or an iterator.

On Sunday, 23 September 2012 16:25:40 UTC-5, mweissen wrote:
>
> I have got the following error message.
> This message appeard a short time after I had sent something using the 
> "mail.send" function.
>
> ERROR:Rocket.Errors.Thread-10:Traceback (most recent call last):
>
>   File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1302, in run
> self.run_app(conn)
>
>   File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 2016, in run_app
> self.write(data, sections)
>
>   File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1933, in write
> self.send_headers(data, sections)
>
>   File "D:\dropbox\InfoSMS\web2py\gluon\rocket.py", line 1885, in 
> send_headers
> h_set['Content-Length'] = str(len(data))
>
> TypeError: object of type 'int' has no len()
>
> Regards, Martin
>
>

-- 





[web2py] Re: Help with menu error using web2py 2.0.9

2012-09-24 Thread Massimo Di Pierro
Can you please try the nightly build? I think this problem may be related 
to a nasty issue with URL that was fixed last week. In fact I cannot 
reproduce the problem with trunk, using your code.

Massimo

On Wednesday, 19 September 2012 18:33:16 UTC-5, JoeCodeswell wrote:
>
> I have gone one more step in trying to isolate the problem. Given the 
> existence of models/[menu.py, db.py] in the previous post, when 
> default-fail.py is copied to controllers/default.py, the sub-menus DO NOT 
> show up when hovered over. 
>
> However, when default-welcome209.py is copied to controllers/default.py, 
> the sub-menus DO INDEED show up when hovered over.
>
> Here is default-fail.py
> # -*- coding: utf-8 -*-
>
> #ContactUs
> def update_t_contactus00():
> return dict(form=crud.update(db.t_contactus00, request.args(0)))
> 
> #Appointment
> def update_t_appointment00():
> return dict(form=crud.update(db.t_appointment00, request.args(0)))
>
> indexMM = '''## Stock Forms for Web2py
> ### Background
> While using the web2py App Wizard, I got frustrated at needing to define 
> the model for a
> "Contact Us" form for the *90 millionth time*. So, i made a suggestion in 
> code.google/p/web2py
> in Issue 982. **Massimo liked the idea and said, "If you have done work in 
> this direction feel free to post a patch."**
>
> '''
> 
> def index():
> """
> example action using the internationalization operator T and flash
> rendered by views/default/index.html or views/generic.html
>
> if you need a simple wiki simple replace the two lines below with:
> return auth.wiki()
> """
> #response.flash = T("Welcome to web2py!")
> #return dict(message=T('Hello World'))
> return dict(message=MARKMIN(indexMM))
>
>
> Here is default-welcome209.py
>
> # -*- coding: utf-8 -*-
> # this file is released under public domain and you can use without 
> limitations
>
> #
> ## This is a samples controller
> ## - index is the default action of any application
> ## - user is required for authentication and authorization
> ## - download is for downloading files uploaded in the db (does streaming)
> ## - call exposes all registered services (none by default)
> #
>
> def index():
> """
> example action using the internationalization operator T and flash
> rendered by views/default/index.html or views/generic.html
>
> if you need a simple wiki simple replace the two lines below with:
> return auth.wiki()
> """
> response.flash = T("Welcome to web2py!")
> return dict(message=T('Hello World'))
>
> def user():
> """
> exposes:
> http:///[app]/default/user/login
> http:///[app]/default/user/logout
> http:///[app]/default/user/register
> http:///[app]/default/user/profile
> http:///[app]/default/user/retrieve_password
> http:///[app]/default/user/change_password
> use @auth.requires_login()
> @auth.requires_membership('group name')
> @auth.requires_permission('read','table name',record_id)
> to decorate functions that need access control
> """
> return dict(form=auth())
>
>
> def download():
> """
> allows downloading of uploaded files
> http:///[app]/default/download/[filename]
> """
> return response.download(request,db)
>
>
> def call():
> """
> exposes services. for example:
> http:///[app]/default/call/jsonrpc
> decorate with @services.jsonrpc the functions to expose
> supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
> """
> return service()
>
>
> @auth.requires_signature()
> def data():
> """
> http:///[app]/default/data/tables
> http:///[app]/default/data/create/[table]
> http:///[app]/default/data/read/[table]/[id]
> http:///[app]/default/data/update/[table]/[id]
> http:///[app]/default/data/delete/[table]/[id]
> http:///[app]/default/data/select/[table]
> http:///[app]/default/data/search/[table]
> but URLs must be signed, i.e. linked with
>   A('table',_href=URL('data/tables',user_signature=True))
> or with the signed load operator
>   
> LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
> """
> return dict(form=crud())
>
>
> Thanks for the help.
>
> Love and peace,
>
> Joe
>

-- 





[web2py] Re: SQLFORM.grid, links and buttons placement specification (before other columns, after, or both)

2012-09-24 Thread Massimo Di Pierro
I apologize I have overlooked this patch. I tried apply it now but does not 
apply. Would you mind rewriting the patch against latest trunk and posting 
the patch on google code? thanks.

Massimo

On Tuesday, 17 April 2012 03:57:04 UTC-5, nikos wrote:
>
> Hello there follow web2py users,
>
> First of all, Massimo, thanks for the great work you have done to get 
> web2py to this high level of functionality.
>
> I recently started using it for a project and was faced with a challenge: 
> in SQLFORM.grid, when a table has many fields, the users have to scroll to 
> the far right to get to the action buttons, and this has proved cumbersome 
> to them. 
> The same goes for the links that we are allowed to add to the grid.
>
> I chose to resolve this issue by adding two extra optional arguments to 
> SQLFORM.grid, namely buttons_placement and links_placement
> The two are expected to have a value among 'left', 'right', 'both' 
> Both default to 'right' to maintain backward compatibility.
>
> If you set them to 'left' the corresponding column(s) will appear at the 
> beginning of the grid (1st column).
> If you set them to 'right, they will appear at the end (as it was already 
> working)
> If you set them to 'both', the columns will appear twice, at the beginning 
> and at the end (usefull for large tables where the user can locate the 
> column he wants to decide upon and find a button closeby, either at the 
> beginning or the end)
>
> I am attaching a patch against the stock 1.99.7 that I used to begin with.
>
> It would be great if some form of this patch would be included in future 
> releases.
>
> Again, thanks for all the hard work you all have put into this.
>
> Nikos
>
>
>

-- 





[web2py] How to submit patches to web2py

2012-09-24 Thread Massimo Di Pierro
Please do not submit patches as attachments to forum messages. They may get 
lots. Instead, always make sure they apply to latest trunk and upload them 
as attachment to a google code issue. I process them first.

Massimo

-- 





[web2py] global name 'db' is not defined

2012-09-24 Thread Роман Акимов
Hello all!
Please help me.
I'm write:

model
db.define_table(
'document_body',
Field('name'),
Field('number'),
Field('created', 'datetime', default=request.now),
Field('start_date', 'date'),
Field('end_date', 'date'),
Field('activity', 'boolean', default=True),
)

controller
def index():
form = SQLFORM(db.document_body)
if form.process().accepted:
response.flash = 'document uploaded'
return dict(form = form)

And i have error in default.py:
 global name 'db' is not defined

-- 





[web2py] Starting a simple project from scratch

2012-09-24 Thread Vixus
So I'm reasonably experienced with python and grew up web developing with 
PHP. I wanted to move all my web development over to python and web2py 
seemed like the ideal way to get started. There's one thing I really don't 
like however and is giving me a lot of trouble actually learning the 
framework and that's all the default cruft that gets put in place when I 
start a new application. Also a lot of things are hidden behind the IDE 
(where is default.py getting all its module info from?) -- there doesn't 
seem to be any technical explanation of what's  going on behind the scenes.

For instance, yes, it's very nice that a user system is put in place for me 
but all the other stuff like the bootstrap UI elements just gets in the way 
of me developing my website because I spend more time sifting through the 
huge CSS files trying to fix things. Basically, I'm used to building my 
sites from the very ground up, because then I know how everything fits 
together and works. With web2py I've found this really confusing. Yes, I'll 
read through the entire book but I'd find it a lot easier to get the 
examples if I had a really blank project to work with. 

So what does everyone think? Do I just delete all the files and start from 
scratch (I'm scared something will break or I won't have the right initial 
setup) or continue trying to muddle through with the prefab setup?

web2py feels amazingly powerful, and I want to add it to my arsenal, so any 
help is appreciated. Thanks!

-- 





[web2py] Setting up web2py behind apache2 on SLES 10

2012-09-24 Thread maverick
Hi Guys,

I'm having no luck trying to set up web2py to run behind apache2 on SLES 
10. Here is my configuration file which is 
/etc/apache2/vhosts.d/yast2_vhosts.conf
/user/web2py is where web2py source is. and I set its ownership to 
wwwrun:users as apache2 runs as wwwrun user.

WSGIPythonHome /root/mave/Python-2.7.3/python

 DocumentRoot /srv/www/web2py/
 VirtualDocumentRoot /srv/www/web2py/
 ServerName NetMan
 
  AllowOverride None
  Order allow,deny
  Allow from all
 

  WSGIDaemonProcess web2py display-name=%{GROUP}
  WSGIProcessGroup web2py
  WSGIScriptAlias / /users/web2py/wsgihandler.py


 
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) \
   /users/web2py/applications/$1/static/$2
  
Order Allow,Deny
Allow from all
  

  
  Deny from all
  

  
  Deny from all
  


The request basically times out waiting for a reply. Any logs I should look 
at? Any help would be much appreciated.

Thanks,
mave

-- 





[web2py] Error accessing users in Instant Press

2012-09-24 Thread Jimi

New to web2py, so learning by looking at an app and taking it apart.  I 
pulled down the latest Instant Press and when accessing users, I'm getting 
the error:

 'Row' object has no attribute 
'registration_key'
I have not seen other references to this, so assume it's me, but I've tried 
various install combos (on Windows initally, then Ubuntu, package then 
source) all with same results.

Thanks.

-- 





[web2py] Options for displaying large database tables (jqGrid issues)

2012-09-24 Thread Dominic Cioccarelli
Hi all,

I'm pretty new to web2py, so please go easy ;-)

I'm looking for a plugin to help with the display of database tables. 
Specifically, it needs to support very large tables, so pagination, 
searching, etc. needs to be done on the server side.

I first looked at PowerGrid  but the 
site seems to be down and from what I could see the last version didn't 
support server side pagination (so unacceptably slow for large tables).

I then started looking at the DataTables plugin but that seemed a less 
mature version of PowerGrid.

Then I looked at jqGrid and Editable 
jqGrid and 
then realised that they had been merged into the plugin_wiki's jqGrid, so I 
tried that. Unfortunately I'm having some issues. My model is pretty simple:

db.define_table('server',
Field 
('server_id','id'),
Field 
('server_name'),
Field 
('hpsa_server_id',
 'integer'),
Field 
('mesh_id', 
'integer'),
Field 
('customer_id',
 'integer'),
Field 
('facility_id',
 'integer'),
Field 
('active', 
'boolean'),
Field 
('modified_date',
 'datetime'),
migrate=False)


The controller (server.py) is as follows:

def index():
response 
.flash = 
"Welcome to the server view!"
return dict(servers=plugin_wiki.widget('jqgrid',table='server'))

And the index view is as follows:


{{extend 'layout.html'}}

{{=servers}}


The problem is that the table is rendering with the correct columns but no 
data. Chrome developer tools reveal a 403 error when trying to access *
/plugin_wiki/jqgrid*


   1. GET 
   
http://127.0.0.1:8000/myapp/plugin_wiki/jqgrid?columns=server_id%2Cserver_name%2Chpsa_server_id%2Cmesh_id%2Ccustomer_id%2Cfacility_id%2Cactive%2Cmodified_date&fieldname=&fieldvalue=None&tablename=server&_search=false&nd=1348494780601&rows=10&page=1&sidx=&sord=asc404
 (NOT FOUND) 
   jquery.js:2 


I've tried on a couple of different web2py installations and see the same 
result. Looks line something is missing from the latest plugin source?

Thanks in advance.

Ciao,
Dominic.

-- 





[web2py] Re: global name 'db' is not defined

2012-09-24 Thread Massimo Di Pierro
db should be defined in your models/db.py

db= DAL()

Models are executed in alphabetical order. It will not be there for you if 
you deleted db.py or name your model so that it is executed before db.py.

Massimo

On Monday, 24 September 2012 05:26:26 UTC-5, Роман Акимов wrote:
>
> Hello all!
> Please help me.
> I'm write:
>
> model
> db.define_table(
> 'document_body',
> Field('name'),
> Field('number'),
> Field('created', 'datetime', default=request.now),
> Field('start_date', 'date'),
> Field('end_date', 'date'),
> Field('activity', 'boolean', default=True),
> )
>
> controller
> def index():
> form = SQLFORM(db.document_body)
> if form.process().accepted:
> response.flash = 'document uploaded'
> return dict(form = form)
>
> And i have error in default.py:
>  global name 'db' is not defined
>
>

-- 





[web2py] Re: Options for displaying large database tables (jqGrid issues)

2012-09-24 Thread Massimo Di Pierro
:-)

Did you try?

   # in controller
   query = db.server # or more complex filter
   grid = SQLFORM.grid(query)

   # in view
   {{=grid}}

It will do pagination, searching, etc. If you are logged in, it will also 
allow create/edit/update. There is a also a SQLFORM.smartgrid.


On Monday, 24 September 2012 09:11:14 UTC-5, Dominic Cioccarelli wrote:
>
> Hi all,
>
> I'm pretty new to web2py, so please go easy ;-)
>
> I'm looking for a plugin to help with the display of database tables. 
> Specifically, it needs to support very large tables, so pagination, 
> searching, etc. needs to be done on the server side.
>
> I first looked at PowerGrid  but the 
> site seems to be down and from what I could see the last version didn't 
> support server side pagination (so unacceptably slow for large tables).
>
> I then started looking at the DataTables plugin but that seemed a less 
> mature version of PowerGrid.
>
> Then I looked at jqGrid and Editable 
> jqGrid and 
> then realised that they had been merged into the plugin_wiki's jqGrid, so I 
> tried that. Unfortunately I'm having some issues. My model is pretty simple:
>
> db.define_table('server',
> Field 
> ('server_id','id'),
> Field 
> ('server_name'),
> Field 
> ('hpsa_server_id',
>  'integer'),
> Field 
> ('mesh_id', 
> 'integer'),
> Field 
> ('customer_id',
>  'integer'),
> Field 
> ('facility_id',
>  'integer'),
> Field 
> ('active', 
> 'boolean'),
> Field 
> ('modified_date',
>  'datetime'),
> migrate=False)
>
>
> The controller (server.py) is as follows:
>
> def index():
> response 
> .flash = 
> "Welcome to the server view!"
> return dict(servers=plugin_wiki.widget('jqgrid',table='server'))
>
> And the index view is as follows:
>
>
> {{extend 'layout.html'}}
>
> {{=servers}}
>
>
> The problem is that the table is rendering with the correct columns but no 
> data. Chrome developer tools reveal a 403 error when trying to access *
> /plugin_wiki/jqgrid*
>
>
>1. GET 
>
> http://127.0.0.1:8000/myapp/plugin_wiki/jqgrid?columns=server_id%2Cserver_name%2Chpsa_server_id%2Cmesh_id%2Ccustomer_id%2Cfacility_id%2Cactive%2Cmodified_date&fieldname=&fieldvalue=None&tablename=server&_search=false&nd=1348494780601&rows=10&page=1&sidx=&sord=asc404
>  (NOT FOUND) 
>jquery.js:2 
>
>
> I've tried on a couple of different web2py installations and see the same 
> result. Looks line something is missing from the latest plugin source?
>
> Thanks in advance.
>
> Ciao,
> Dominic.
>
>

-- 





[web2py] New web2py SaaS app, SiteLab.co!

2012-09-24 Thread JimK
I just wanted to share my latest web2py application 
http://SiteLab.co. 
 In short, SiteLab helps small ecommerce websites load quickly and 
available at all hours of the day.  Studies have shown that potential 
customers expect a site to load in less than 2 seconds and will abandon it 
if it doesn't load in 3 seconds.  That's a huge number of potential 
customers lost to simple website load time issues!

With the "Value" plan, SiteLab will also load customer's websites in a 
browser every 5 minutes to make sure it's always available.  Lastly, 
customers can get screenshots of their websites in any modern browser/OS 
combination imaginable  -- yes, this includes iPad, iPhone and Android 
devices!

SiteLab was written in Python using the Web2Py framework and hosted using 
the Rackspace Cloud.  You can view my blog post about it 
here: http://qamusings.com/2012/09/24/introducing-sitelab-co/


Cheers!

Jim Kellas

-- 





Re: [web2py] New web2py SaaS app, SiteLab.co!

2012-09-24 Thread Alec Taylor
Nice site design + idea

But it took 6 seconds to load for me :P

On Tue, Sep 25, 2012 at 4:00 AM, JimK  wrote:

> I just wanted to share my latest web2py application 
> http://SiteLab.co.
>  In short, SiteLab helps small ecommerce websites load quickly and
> available at all hours of the day.  Studies have shown that potential
> customers expect a site to load in less than 2 seconds and will abandon it
> if it doesn't load in 3 seconds.  That's a huge number of potential
> customers lost to simple website load time issues!
>
> With the "Value" plan, SiteLab will also load customer's websites in a
> browser every 5 minutes to make sure it's always available.  Lastly,
> customers can get screenshots of their websites in any modern browser/OS
> combination imaginable  -- yes, this includes iPad, iPhone and Android
> devices!
>
> SiteLab was written in Python using the Web2Py framework and hosted using
> the Rackspace Cloud.  You can view my blog post about it here:
> http://qamusings.com/2012/09/24/introducing-sitelab-co/
>
>
> Cheers!
>
> Jim Kellas
>
> --
>
>
>
>

-- 





Re: [web2py] New web2py SaaS app, SiteLab.co!

2012-09-24 Thread JimK
Are you serious or just pulling my chain??

It's completely possible that it will load slowly for your if you're 
outside of the US since my servers currently only reside there.  If I can 
get enough customers elsewhere, I'll create some more servers around the 
world.

Jim

On Monday, September 24, 2012 11:08:42 AM UTC-7, Alec Taylor wrote:
>
> Nice site design + idea
>
> But it took 6 seconds to load for me :P
>
> On Tue, Sep 25, 2012 at 4:00 AM, JimK >wrote:
>
>> I just wanted to share my latest web2py application 
>> http://SiteLab.co. 
>>  In short, SiteLab helps small ecommerce websites load quickly and 
>> available at all hours of the day.  Studies have shown that potential 
>> customers expect a site to load in less than 2 seconds and will abandon it 
>> if it doesn't load in 3 seconds.  That's a huge number of potential 
>> customers lost to simple website load time issues!
>>
>> With the "Value" plan, SiteLab will also load customer's websites in a 
>> browser every 5 minutes to make sure it's always available.  Lastly, 
>> customers can get screenshots of their websites in any modern browser/OS 
>> combination imaginable  -- yes, this includes iPad, iPhone and Android 
>> devices!
>>
>> SiteLab was written in Python using the Web2Py framework and hosted using 
>> the Rackspace Cloud.  You can view my blog post about it here: 
>> http://qamusings.com/2012/09/24/introducing-sitelab-co/
>>
>>
>> Cheers!
>>
>> Jim Kellas
>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: pandas and web2py

2012-09-24 Thread Tim Michelsen

> i think i can do 
> equipment = db().select.as_dict()
> df = DataFrame(equipment)
> 
> but how to display pandas DataFrame object in web2py view?
> or how to convert in to something i can display in view?

Did you look at to_html?

Formatting DataFrame as HTML
http://wesmckinney.com/blog/?p=356

Writing to HTML format
http://pandas.pydata.org/pandas-docs/dev/io.html#writing-to-html-format

Please let us knowhow it goes.
I also use pandas,but mainly for scripts


-- 





[web2py] Re: web2py 2.0 DAL no longer usable for mysql stored procedures

2012-09-24 Thread Niphlod
me neither (regarding web2py changes), however, I found this

*Compatibility note:* It appears that the mere act of executing the CALL 
statement produces an empty result set, which appears after any result sets 
which might be generated by the stored procedure. Thus, you will always 
need to use nextset() to advance result sets.

on http://mysql-python.sourceforge.net/MySQLdb.html

On Monday, September 24, 2012 7:10:14 PM UTC+2, Massimo Di Pierro wrote:
>
> can you show us some of your code. This may be a concurrency issues. I 
> cannot thing anything we change that would affect the behavior.
>
> On Sunday, 23 September 2012 22:43:28 UTC-5, Yarin wrote:
>>
>> After upgrading to web2py 2.0, we can no longer use the DAL or mysql 
>> adapters to make MySQL stored procedure calls.
>>
>> In web2py 1.x I had 
>> reportedhow 
>> mysql stored procedures weren't working for us in certain 
>> circumstances- however we were able to circumvent those issues by simply 
>> creating a new DAL instance everytime we had to call a sproc. With the new 
>> DAL, that's no longer an option- indeed, any call to a stored procedure 
>> seems to fail in any attempt through the DAL or mysql adapter. 
>>
>>- Fails with both pymysql and mysqldb drivers
>>- Fails when calling commit() immediately after
>>- We did side-by-side comparisons with web2py 1.x on same server, 
>>pointing to same db, and confirmed this fails only in 2.0
>>- You can make sproc calls using the DAL straight from the web2py 
>>shell, but only if you don't call commit. 
>>
>>
>> Stack trace:
>>
>> Traceback (most recent call last):
>>   File "/opt/web-apps/web2py/gluon/main.py", line 580, in wsgibase
>> BaseAdapter.close_all_instances('rollback')
>>   File "/opt/web-apps/web2py/gluon/dal.py", line 511, in close_all_instances
>> getattr(instance, action)()
>>   File "/opt/web-apps/web2py/gluon/dal.py", line 1633, in rollback
>> return self.connection.rollback()
>> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
>> now")
>>
>>
>>
>> Right now the only option we've arrive at is to make sproc calls directly 
>> through the pymysql driver API, one per connection.
>>
>>
>>

-- 





[web2py] Re: web2py 2.0 DAL no longer usable for mysql stored procedures

2012-09-24 Thread Yarin


db.py:
db.define_table('mytable',Field('myfield','string'))

sproc:
DELIMITER //
CREATE PROCEDURE TestSproc()
  BEGIN
  SELECT COUNT(*) FROM mytable;
  END //
DELIMITER;

tests.py
"""NOTE: Tests 1-3 will fail every time in wsgi/linux environments. 
>From the web2py command line, they will work once, until another operation 
is called on the db, INCLUDING commit().

In web2py 1, you can run these once successfully, but subsequent sql 
operations on the current connection return None results.
"""

def test_1():
 ''' RESULT: ProgrammingError: (2014, "Commands out of sync; you cant run 
this command now") '''
 
 sql = '''CALL TestSproc();'''
 results = db.executesql(sql, as_dict=True)
 return str(results)
 
def test_2():
 ''' RESULT: ProgrammingError: (2014, "Commands out of sync; you cant run 
this command now") '''
 
 sql = """CALL TestSproc();"""
 results = db.executesql(sql, as_dict=True)
 db.commit()
 return str(results)
 
def test_3():
 ''' RESULT: ProgrammingError: (2014, "Commands out of sync; you cant run 
this command now") '''
 
 sql = """CALL TestSproc();"""
 db._adapter.execute(sql)
 results = db._adapter.cursor.fetchall()
 return str(results)
 
def test_4():
 ''' RESULT: Works '''
 
 import contrib.pymysql as pymysql
 sql = """CALL TestSproc();"""
 conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd=
'root', db='test')
 cur = conn.cursor(pymysql.cursors.DictCursor)
 cur.execute(sql)
 results = cur.fetchall()
 cur.close()
 conn.close()
 return str(results)





On Monday, September 24, 2012 1:10:14 PM UTC-4, Massimo Di Pierro wrote:
>
> can you show us some of your code. This may be a concurrency issues. I 
> cannot thing anything we change that would affect the behavior.
>
> On Sunday, 23 September 2012 22:43:28 UTC-5, Yarin wrote:
>>
>> After upgrading to web2py 2.0, we can no longer use the DAL or mysql 
>> adapters to make MySQL stored procedure calls.
>>
>> In web2py 1.x I had 
>> reportedhow 
>> mysql stored procedures weren't working for us in certain 
>> circumstances- however we were able to circumvent those issues by simply 
>> creating a new DAL instance everytime we had to call a sproc. With the new 
>> DAL, that's no longer an option- indeed, any call to a stored procedure 
>> seems to fail in any attempt through the DAL or mysql adapter. 
>>
>>- Fails with both pymysql and mysqldb drivers
>>- Fails when calling commit() immediately after
>>- We did side-by-side comparisons with web2py 1.x on same server, 
>>pointing to same db, and confirmed this fails only in 2.0
>>- You can make sproc calls using the DAL straight from the web2py 
>>shell, but only if you don't call commit. 
>>
>>
>> Stack trace:
>>
>> Traceback (most recent call last):
>>   File "/opt/web-apps/web2py/gluon/main.py", line 580, in wsgibase
>> BaseAdapter.close_all_instances('rollback')
>>   File "/opt/web-apps/web2py/gluon/dal.py", line 511, in close_all_instances
>> getattr(instance, action)()
>>   File "/opt/web-apps/web2py/gluon/dal.py", line 1633, in rollback
>> return self.connection.rollback()
>> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
>> now")
>>
>>
>>
>> Right now the only option we've arrive at is to make sproc calls directly 
>> through the pymysql driver API, one per connection.
>>
>>
>>

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-24 Thread VP
The problem is still there with nightly build.



On Monday, September 24, 2012 10:18:38 AM UTC-5, Massimo Di Pierro wrote:
>
> Please try the nightly build and let us know if the problem is still there.
>
> Massimo
>
> On Monday, 24 September 2012 07:49:26 UTC-5, VP wrote:
>>
>> As indicated in the title, I'm using 2.0.9, which is latest as of now.
>>
>>
>> On Sunday, September 23, 2012 4:41:15 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> What version are you using?
>>>
>>> This is what I get:
>>>
>>> >>> db=DAL()
>>> >>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>> >>> product.insert(cost1=10, cost2=20)
>>> 1
>>> >>> p = db.product(1)
>>> >>> p.update_record(cost1=5)
>>> , 
>>> 'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
>>> }>
>>> >>> print db.product[1].total
>>> 30
>>>
>>> On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:

 I figured out what I would call a bug.

 I'll give an example:

 Let's say we have this table:


 product = db.define_table('product', Field('cost1'), Field('cost2'), 
 Field('total', compute = lambda r: r['cost1'] + r['cost2']))


 And if you do this:

 product.insert(cost1=10, cost2=20)
 p = db.product(1)
 p.update_record(cost1=5)


 This update won't work.  What is worse is that it fails silently.   The 
 reason it won't work is that the row input of the lambda does not have 
 "cost2" in it.

 If, however, you do this:

 p.update_record(cost1=5, cost2=p.cost2)

 Then it will work, because now the parameter r (i.e. the row) has both 
 cost1 and cost2.



 I think it'll be a little tricky for you to fix this, because you 
 probably want update to have only relevant fields so that saving to the 
 database is effective.   However, this behavior clearly is not desirable.



 On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro 
 wrote:
>
> Can you show us an example?
>
> computed fields usually do not work when there is not enough 
> information to compute. The information must be in the arguments of 
> update_record or update. It will not retrive the info from the database.
>
>
>
>
> On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:
>>
>> - sqlite
>> - 2 compute fields do not seem to get call on update using both 
>> update_record and db().update
>> - They do work on crud/form updates though.
>>
>

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-24 Thread Massimo Di Pierro
Can you reproduce this from the shell and/or inside a controller?

On Sunday, 23 September 2012 16:41:15 UTC-5, Massimo Di Pierro wrote:
>
> What version are you using?
>
> This is what I get:
>
> >>> db=DAL()
> >>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
> >>> product.insert(cost1=10, cost2=20)
> 1
> >>> p = db.product(1)
> >>> p.update_record(cost1=5)
> , 
> 'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
> }>
> >>> print db.product[1].total
> 30
>
> On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:
>>
>> I figured out what I would call a bug.
>>
>> I'll give an example:
>>
>> Let's say we have this table:
>>
>>
>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>
>>
>> And if you do this:
>>
>> product.insert(cost1=10, cost2=20)
>> p = db.product(1)
>> p.update_record(cost1=5)
>>
>>
>> This update won't work.  What is worse is that it fails silently.   The 
>> reason it won't work is that the row input of the lambda does not have 
>> "cost2" in it.
>>
>> If, however, you do this:
>>
>> p.update_record(cost1=5, cost2=p.cost2)
>>
>> Then it will work, because now the parameter r (i.e. the row) has both 
>> cost1 and cost2.
>>
>>
>>
>> I think it'll be a little tricky for you to fix this, because you 
>> probably want update to have only relevant fields so that saving to the 
>> database is effective.   However, this behavior clearly is not desirable.
>>
>>
>>
>> On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> Can you show us an example?
>>>
>>> computed fields usually do not work when there is not enough information 
>>> to compute. The information must be in the arguments of update_record or 
>>> update. It will not retrive the info from the database.
>>>
>>>
>>>
>>>
>>> On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:

 - sqlite
 - 2 compute fields do not seem to get call on update using both 
 update_record and db().update
 - They do work on crud/form updates though.

>>>

-- 





[web2py] routes_out problem

2012-09-24 Thread Awerwew Fewef
Hi!

In routes_in works well:

('/(?Pindex$|fun1$','/myapp/default/\g'),
('/[\w._-]*','/myapp/default/show_page'),
('/myapp/default/(?!index$|fun1$)[\w._-]*','/myapp/default/show_page'),

Function show_page renders page on the basis of path_info.

so: 
mydomain.com/index ->  /myapp/default/index
mydomain.com/fun1 ->  /myapp/default/fun1
mydomain.com/_anything_else_ -> /myapp/default/show_page

mydomain.com/myapp/default/index ->  /myapp/default/index
mydomain.com/myapp/default/fun1 ->  /myapp/default/fun1
mydomain.com/myapp/default/_anything_else_ -> /myapp/default/show_page  **

Good until now.

Is it any possibility to write routes_out for ** to show in browser 
mydomain.com/_anything_else_ ??

I tried some solutions, but... didn't work. Actually... even:

routes_out = (
  ('/myapp/default/show_page','/index'),
)

Don't work... What am I doing wrong?
 

-- 





[web2py] Re: New web2py SaaS app, SiteLab.co!

2012-09-24 Thread samuel bonilla
9 seconds... in colombia

-- 





[web2py] Re: How to submit patches to web2py

2012-09-24 Thread Alan Etkin
A message like this could be used on top of the mail list with other 
instructions such as coding conventions, when a patch is likely to be 
accepted (minimum requirements, good patches against bad patches), etc

On Monday, September 24, 2012 2:30:48 PM UTC-3, Massimo Di Pierro wrote:
>
> Please do not submit patches as attachments to forum messages. They may 
> get lots. Instead, always make sure they apply to latest trunk and upload 
> them as attachment to a google code issue. I process them first.
>
> Massimo
>

-- 





[web2py] Re: is this a bug in the debugger?

2012-09-24 Thread Tim Richardson


On Tuesday, September 25, 2012 3:12:58 AM UTC+10, Massimo Di Pierro wrote:
>
> What do you mean by "If I reverse the string, it shows what I expect."?
>

I reversed the string teststring[::-1] just to make sure that it really did 
still contain ×tamp  

>
>
>>
>>
>

-- 





[web2py] Re: New web2py SaaS app, SiteLab.co!

2012-09-24 Thread Massimo Di Pierro
Nice job!

>From chicago it takes 700ms to load the main html page and images. It than 
takes more than 2 seconds to load this image from google-analyitics:

http://www.google-analytics.com/__utm.gif

Massimo


On Monday, 24 September 2012 13:00:40 UTC-5, JimK wrote:
>
> I just wanted to share my latest web2py application 
> http://SiteLab.co. 
>  In short, SiteLab helps small ecommerce websites load quickly and 
> available at all hours of the day.  Studies have shown that potential 
> customers expect a site to load in less than 2 seconds and will abandon it 
> if it doesn't load in 3 seconds.  That's a huge number of potential 
> customers lost to simple website load time issues!
>
> With the "Value" plan, SiteLab will also load customer's websites in a 
> browser every 5 minutes to make sure it's always available.  Lastly, 
> customers can get screenshots of their websites in any modern browser/OS 
> combination imaginable  -- yes, this includes iPad, iPhone and Android 
> devices!
>
> SiteLab was written in Python using the Web2Py framework and hosted using 
> the Rackspace Cloud.  You can view my blog post about it here: 
> http://qamusings.com/2012/09/24/introducing-sitelab-co/
>
>
> Cheers!
>
> Jim Kellas
>

-- 





[web2py] Re: about web2py and this mailing list

2012-09-24 Thread Massimo Di Pierro
Please do not submit patches as attachments to forum messages. They may get 
lots. Instead, always make sure they apply to latest trunk and upload them 
as attachment to a google code issue. I process them first.

Also. If you submit a pull request on GitHub, I do not get notified so I 
may notice it for a while. Please use Google Code or email me if you use 
GitHub.

-- 





[web2py] Re: Starting a simple project from scratch

2012-09-24 Thread samuel bonilla
design in web2py handles twitter bootstrap (
http://twitter.github.com/bootstrap/)
it is easy to quickly layout websites 

-- 





[web2py] Re: New web2py SaaS app, SiteLab.co!

2012-09-24 Thread JimK
It's really quick to load the HTML from Chicago because I'm using 
Rackspace's Chicago hub -- it better be fast!  :)

There's not much I can do about the analytics pixel but since it's at the 
bottom, it won't block user's from using the website.

As for the site loading slowly in South America, I might be able to speed 
things up by adding a CDN but I don't know what that'll run me.  If the 
price is not insane, I'll set it up.

Jim

On Monday, September 24, 2012 2:03:24 PM UTC-7, Massimo Di Pierro wrote:
>
> Nice job!
>
> From chicago it takes 700ms to load the main html page and images. It than 
> takes more than 2 seconds to load this image from google-analyitics:
>
> http://www.google-analytics.com/__utm.gif
>
> Massimo
>
>
> On Monday, 24 September 2012 13:00:40 UTC-5, JimK wrote:
>>
>> I just wanted to share my latest web2py application 
>> http://SiteLab.co. 
>>  In short, SiteLab helps small ecommerce websites load quickly and 
>> available at all hours of the day.  Studies have shown that potential 
>> customers expect a site to load in less than 2 seconds and will abandon it 
>> if it doesn't load in 3 seconds.  That's a huge number of potential 
>> customers lost to simple website load time issues!
>>
>> With the "Value" plan, SiteLab will also load customer's websites in a 
>> browser every 5 minutes to make sure it's always available.  Lastly, 
>> customers can get screenshots of their websites in any modern browser/OS 
>> combination imaginable  -- yes, this includes iPad, iPhone and Android 
>> devices!
>>
>> SiteLab was written in Python using the Web2Py framework and hosted using 
>> the Rackspace Cloud.  You can view my blog post about it here: 
>> http://qamusings.com/2012/09/24/introducing-sitelab-co/
>>
>>
>> Cheers!
>>
>> Jim Kellas
>>
>

-- 





[web2py] Re: (2.0.9) compute fields don't work on db update

2012-09-24 Thread VP
Inside a controller.



On Monday, September 24, 2012 3:05:05 PM UTC-5, Massimo Di Pierro wrote:
>
> Can you reproduce this from the shell and/or inside a controller?
>
> On Sunday, 23 September 2012 16:41:15 UTC-5, Massimo Di Pierro wrote:
>>
>> What version are you using?
>>
>> This is what I get:
>>
>> >>> db=DAL()
>> >>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>> >>> product.insert(cost1=10, cost2=20)
>> 1
>> >>> p = db.product(1)
>> >>> p.update_record(cost1=5)
>> , 
>> 'cost1': 5, 'cost2': '20', 'total': '30', 'id': 1, 'delete_record': 
>> }>
>> >>> print db.product[1].total
>> 30
>>
>> On Saturday, 22 September 2012 20:36:44 UTC-5, VP wrote:
>>>
>>> I figured out what I would call a bug.
>>>
>>> I'll give an example:
>>>
>>> Let's say we have this table:
>>>
>>>
>>> product = db.define_table('product', Field('cost1'), Field('cost2'), 
>>> Field('total', compute = lambda r: r['cost1'] + r['cost2']))
>>>
>>>
>>> And if you do this:
>>>
>>> product.insert(cost1=10, cost2=20)
>>> p = db.product(1)
>>> p.update_record(cost1=5)
>>>
>>>
>>> This update won't work.  What is worse is that it fails silently.   The 
>>> reason it won't work is that the row input of the lambda does not have 
>>> "cost2" in it.
>>>
>>> If, however, you do this:
>>>
>>> p.update_record(cost1=5, cost2=p.cost2)
>>>
>>> Then it will work, because now the parameter r (i.e. the row) has both 
>>> cost1 and cost2.
>>>
>>>
>>>
>>> I think it'll be a little tricky for you to fix this, because you 
>>> probably want update to have only relevant fields so that saving to the 
>>> database is effective.   However, this behavior clearly is not desirable.
>>>
>>>
>>>
>>> On Saturday, September 22, 2012 5:23:43 PM UTC-5, Massimo Di Pierro 
>>> wrote:

 Can you show us an example?

 computed fields usually do not work when there is not enough 
 information to compute. The information must be in the arguments of 
 update_record or update. It will not retrive the info from the database.




 On Saturday, 22 September 2012 15:43:59 UTC-5, VP wrote:
>
> - sqlite
> - 2 compute fields do not seem to get call on update using both 
> update_record and db().update
> - They do work on crud/form updates though.
>


-- 





[web2py] Re: Starting a simple project from scratch

2012-09-24 Thread Massimo Di Pierro
Hello Vixus,

If you want to use bootstrap, than it comes with it.
If not, then deleted everything but web2py.css, jquery.js, and web2py.js 
for components and grids you need those but they are small and un-intrusive.

massimo



On Sunday, 23 September 2012 10:05:46 UTC-5, Vixus wrote:
>
> So I'm reasonably experienced with python and grew up web developing with 
> PHP. I wanted to move all my web development over to python and web2py 
> seemed like the ideal way to get started. There's one thing I really don't 
> like however and is giving me a lot of trouble actually learning the 
> framework and that's all the default cruft that gets put in place when I 
> start a new application. Also a lot of things are hidden behind the IDE 
> (where is default.py getting all its module info from?) -- there doesn't 
> seem to be any technical explanation of what's  going on behind the scenes.
>
> For instance, yes, it's very nice that a user system is put in place for 
> me but all the other stuff like the bootstrap UI elements just gets in the 
> way of me developing my website because I spend more time sifting through 
> the huge CSS files trying to fix things. Basically, I'm used to building my 
> sites from the very ground up, because then I know how everything fits 
> together and works. With web2py I've found this really confusing. Yes, I'll 
> read through the entire book but I'd find it a lot easier to get the 
> examples if I had a really blank project to work with. 
>
> So what does everyone think? Do I just delete all the files and start from 
> scratch (I'm scared something will break or I won't have the right initial 
> setup) or continue trying to muddle through with the prefab setup?
>
> web2py feels amazingly powerful, and I want to add it to my arsenal, so 
> any help is appreciated. Thanks!
>

-- 





[web2py] Re: global name 'db' is not defined

2012-09-24 Thread samuel bonilla
db = DAL('sqlite://storage.sqlite') 
# db = sqlite, pymongo, mysql, postgresql etc...

db.define_table( 'document_body',
Field('name', requires=IS_NOTEMPTY()),
Field('number'),
Field('created', 'datetime', default=request.now),
Field('start_date', 'date'),
Field('end_date', 'date'),
Field('activity', 'boolean', default=True),
)

controller
def index():
  form = crud.create(db.document_body, 
 message='document uploaded')
   return dict(form=form)

   # return locals()



ready...

-- 





[web2py] Help with datatable initialization with server side processing

2012-09-24 Thread vivek
Hi , 


 I am a newbie and a sample view and controller with regard to the same 
will help me really kick start. Else anything really helps

Thanking you,
Vivek

-- 





[web2py] area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Derek
I get an error message now when I click the 'save' button. I'm using the 
codemirror editor. It says:

Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36

It was working in 2.0.6 - all I did was download the 2.0.9 source and 
overwrite everything.

Any ideas?

-- 





[web2py] Re: facebook comments

2012-09-24 Thread howesc
sounds like you need to add a meta property to the HEAD of your HTML:

http://www.starmakerstudios.com/song/106383654/starships"; 
property="og:url">

of course you'll want to use your page URL where my URL is.

i believe that you can use response.meta: 
http://web2py.com/books/default/chapter/29/04?search=response.meta

good luck!

cfh

On Sunday, September 23, 2012 4:31:53 PM UTC-7, Jose wrote:
>
> Hello
>
> I am developed a website and want to include the facebook comment box.
>
> I went to [1] and got the following code:
>
> {{url = 
> "http://www.my_domain.com%s/%s"%(request.url,request.env.query_string)}}  
>  
> 
> 
> (function(d, s, id) {
>   var js, fjs = d.getElementsByTagName(s)[0];
>   if (d.getElementById(id)) return;
>   js = d.createElement(s); js.id = id;
>   js.src = "//connect.facebook.net/es_ES/all.js#xfbml=1";
>   fjs.parentNode.insertBefore(js, fjs);
> }(document, 'script', 'facebook-jssdk'));  
>  
>  data-width="620">
>
> The comments work well, but the problem I have is that it shows the 
> message:
>
> Warning: http://www.my_domain.com/fpaa2/default/obra/6/ is unreachable.
>
>
> debugging:
>
> Errors That Must Be Fixed
>> Missing Required Property: The 'og:url' property is required, but not 
>> present.
>
>
>
> I saw many people it happens. I followed some suggestions, but can not 
> find solution
>
> Any idea?
>
> Jose
>
>
> [1] http://developers.facebook.com/docs/reference/plugins/comments/
>

-- 





[web2py] Re: area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Derek
Update - downloaded the nightly, same issue exists.

On Monday, September 24, 2012 4:11:33 PM UTC-7, Derek wrote:
>
> I get an error message now when I click the 'save' button. I'm using the 
> codemirror editor. It says:
>
> Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36
>
> It was working in 2.0.6 - all I did was download the 2.0.9 source and 
> overwrite everything.
>
> Any ideas?
>

-- 





[web2py] Re: area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Massimo Di Pierro
Is this in your ajax_editor.js:36?

https://github.com/web2py/web2py/blob/master/applications/admin/static/js/ajax_editor.js#L36

Does not look there a variable "area". Perhaps this file was not upgraded?

Massimo



On Monday, 24 September 2012 18:19:38 UTC-5, Derek wrote:
>
> Update - downloaded the nightly, same issue exists.
>
> On Monday, September 24, 2012 4:11:33 PM UTC-7, Derek wrote:
>>
>> I get an error message now when I click the 'save' button. I'm using the 
>> codemirror editor. It says:
>>
>> Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36
>>
>> It was working in 2.0.6 - all I did was download the 2.0.9 source and 
>> overwrite everything.
>>
>> Any ideas?
>>
>

-- 





[web2py] Attention: comet_messaging.py was renamed

2012-09-24 Thread Massimo Di Pierro
Attention everybody:

we renamed gluon/contrib/comet_messaging.py as 
gluon/contrib/websocket_messaging.py

We can do this because this is an experimental feature. Moreover you always 
use it as background process which must be called outside of web2py so it 
is not difficult to edit your code when you upgrade. Any "comet" has been 
replaced with "websocket".

Massimo

-- 





[web2py] Re: area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Derek
Well, I checked and it was there. I cleared my cache in google chrome and I 
got the new file. It's saving now. Thanks!

On Monday, September 24, 2012 4:26:23 PM UTC-7, Massimo Di Pierro wrote:
>
> Is this in your ajax_editor.js:36?
>
>
> https://github.com/web2py/web2py/blob/master/applications/admin/static/js/ajax_editor.js#L36
>
> Does not look there a variable "area". Perhaps this file was not upgraded?
>
> Massimo
>
>
>
> On Monday, 24 September 2012 18:19:38 UTC-5, Derek wrote:
>>
>> Update - downloaded the nightly, same issue exists.
>>
>> On Monday, September 24, 2012 4:11:33 PM UTC-7, Derek wrote:
>>>
>>> I get an error message now when I click the 'save' button. I'm using the 
>>> codemirror editor. It says:
>>>
>>> Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36
>>>
>>> It was working in 2.0.6 - all I did was download the 2.0.9 source and 
>>> overwrite everything.
>>>
>>> Any ideas?
>>>
>>

-- 





[web2py] Re: area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Derek
You don't suppose the if-not-modified tag isn't working?

On Monday, September 24, 2012 4:32:28 PM UTC-7, Derek wrote:
>
> Well, I checked and it was there. I cleared my cache in google chrome and 
> I got the new file. It's saving now. Thanks!
>
> On Monday, September 24, 2012 4:26:23 PM UTC-7, Massimo Di Pierro wrote:
>>
>> Is this in your ajax_editor.js:36?
>>
>>
>> https://github.com/web2py/web2py/blob/master/applications/admin/static/js/ajax_editor.js#L36
>>
>> Does not look there a variable "area". Perhaps this file was not upgraded?
>>
>> Massimo
>>
>>
>>
>> On Monday, 24 September 2012 18:19:38 UTC-5, Derek wrote:
>>>
>>> Update - downloaded the nightly, same issue exists.
>>>
>>> On Monday, September 24, 2012 4:11:33 PM UTC-7, Derek wrote:

 I get an error message now when I click the 'save' button. I'm using 
 the codemirror editor. It says:

 Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36

 It was working in 2.0.6 - all I did was download the 2.0.9 source and 
 overwrite everything.

 Any ideas?

>>>

-- 





[web2py] Re: area is not defined - Upgraded from 2.06 to 2.09 source on Windows

2012-09-24 Thread Derek
Well, this is strange. I added a new function to my existing controller...

just a simple thing...

def customerdisplay(cust):
customer = db(db.customers.customer_id == cust).select()
return dict(customer=customer)

now it doesn't show that it is exposed, and if i try to access it, I get 
"invalid function".

On Monday, September 24, 2012 4:32:53 PM UTC-7, Derek wrote:
>
> You don't suppose the if-not-modified tag isn't working?
>
> On Monday, September 24, 2012 4:32:28 PM UTC-7, Derek wrote:
>>
>> Well, I checked and it was there. I cleared my cache in google chrome and 
>> I got the new file. It's saving now. Thanks!
>>
>> On Monday, September 24, 2012 4:26:23 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> Is this in your ajax_editor.js:36?
>>>
>>>
>>> https://github.com/web2py/web2py/blob/master/applications/admin/static/js/ajax_editor.js#L36
>>>
>>> Does not look there a variable "area". Perhaps this file was not 
>>> upgraded?
>>>
>>> Massimo
>>>
>>>
>>>
>>> On Monday, 24 September 2012 18:19:38 UTC-5, Derek wrote:

 Update - downloaded the nightly, same issue exists.

 On Monday, September 24, 2012 4:11:33 PM UTC-7, Derek wrote:
>
> I get an error message now when I click the 'save' button. I'm using 
> the codemirror editor. It says:
>
> Uncaught ReferenceError: area is not defined  -- ajax_editor.js:36
>
> It was working in 2.0.6 - all I did was download the 2.0.9 source and 
> overwrite everything.
>
> Any ideas?
>


-- 





[web2py] Re: New web2py SaaS app, SiteLab.co!

2012-09-24 Thread lyn2py
The CSS doesn't look ok on my iPhone. Give a check?

-- 





[web2py] Problems with a validation procedure ? - a Canadian postal code !

2012-09-24 Thread Don_X
Hello web2py users :

Validating if numbers or decimals are entered on a form seem to be very 
straight forward and easy enough ! whether it is a phone number or a US 
postal code :
Like for example a US postal code would go like this :

requires = IS_MATCH('^\d{5}(-\d{4})?$',error_message='not a zip code')
>
>
however, a Canadian postal code on the other hand is another story :

a Canadian postal code is configured like this : Letter#Letter #Letter#
an example would be : A1B 2C3, or A1B-2C3, or again A1B2C3  :  All these 3 
postal codes are the same and equivalent in the Canadian postal code scheme 
!

How would I go about validating such input into a field on a form in python 
/ web2py ???

it seems that there is no easy simple way to do this ! ... is there a set 
of alphabetic characters only  without numbers in python / web2py ?  I 
only found alpha numeric characters that take numbers as characters !! and 
it is not what I want !! ..

Please help !

thank you

Don

-- 





[web2py] Strange quirks with GAE

2012-09-24 Thread Pystar
There are some strange quirks I noticed while working extensively with 
Google App Engine. These include:
1. You can not send HTML messages using mail.send() without doing some 
extensive work arounds.
2. You can not send html messages from GAE from any address apart from your 
Gmail address, although the documentation states that you should be able to 
do so with any address that you can also use to login to the app engine 
control panel, this isnt so.

Has anyone noticed any more?

-- 





[web2py] Re: Strange quirks with GAE

2012-09-24 Thread Pystar
In respect to (1) I actually meant sending HTML messages generated using 
the templating system.

On Tuesday, September 25, 2012 2:15:10 AM UTC+1, Pystar wrote:
>
> There are some strange quirks I noticed while working extensively with 
> Google App Engine. These include:
> 1. You can not send HTML messages using mail.send() without doing some 
> extensive work arounds.
> 2. You can not send html messages from GAE from any address apart from 
> your Gmail address, although the documentation states that you should be 
> able to do so with any address that you can also use to login to the app 
> engine control panel, this isnt so.
>
> Has anyone noticed any more?
>

-- 





Re: [web2py] Problems with a validation procedure ? - a Canadian postal code !

2012-09-24 Thread Adnan Smajlovic
i use this one:

 Order.PC.requires =
IS_MATCH('^([A-Za-z][0-9][A-Za-z]\s*[0-9][A-Za-z][0-9])$',
 error_message=T('Not a valid Postal Code')), IS_NOT_EMPTY()


you can also try some of these others that I have, but the one above works
fine...

  # validate Canadian Postal Codes
# CA: ^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]●[0-9][A-Z][0-9]$
# CA: ^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$
# CA: [ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d
# CA: ^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z][ ]\d[A-Z]\d$
# UK: ^[A-Z]{1,2}[0-9R][0-9A-Z]?●[0-9][ABD-HJLNP-UW-Z]{2}$
# US: '^[0-9]{5}(?:-[0-9]{4})?$'




On Mon, Sep 24, 2012 at 9:13 PM, Don_X  wrote:

> Hello web2py users :
>
> Validating if numbers or decimals are entered on a form seem to be very
> straight forward and easy enough ! whether it is a phone number or a US
> postal code :
> Like for example a US postal code would go like this :
>
> requires = IS_MATCH('^\d{5}(-\d{4})?$',error_message='not a zip code')
>>
>>
> however, a Canadian postal code on the other hand is another story :
>
> a Canadian postal code is configured like this : Letter#Letter #Letter#
> an example would be : A1B 2C3, or A1B-2C3, or again A1B2C3  :  All these 3
> postal codes are the same and equivalent in the Canadian postal code scheme
> !
>
> How would I go about validating such input into a field on a form in
> python / web2py ???
>
> it seems that there is no easy simple way to do this ! ... is there a set
> of alphabetic characters only  without numbers in python / web2py ?  I
> only found alpha numeric characters that take numbers as characters !! and
> it is not what I want !! ..
>
> Please help !
>
> thank you
>
> Don
>
>  --
>
>
>
>

-- 





[web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-24 Thread Massimo Di Pierro
requires = IS_MATCH('^[A-Z]\d[A-Z][\- ]?\d[A-Z]\d$',error_message='not a 
zip code')

On Monday, 24 September 2012 20:13:03 UTC-5, Don_X wrote:
>
> Hello web2py users :
>
> Validating if numbers or decimals are entered on a form seem to be very 
> straight forward and easy enough ! whether it is a phone number or a US 
> postal code :
> Like for example a US postal code would go like this :
>
> requires = IS_MATCH('^\d{5}(-\d{4})?$',error_message='not a zip code')
>>
>>
> however, a Canadian postal code on the other hand is another story :
>
> a Canadian postal code is configured like this : Letter#Letter #Letter#
> an example would be : A1B 2C3, or A1B-2C3, or again A1B2C3  :  All these 3 
> postal codes are the same and equivalent in the Canadian postal code scheme 
> !
>
> How would I go about validating such input into a field on a form in 
> python / web2py ???
>
> it seems that there is no easy simple way to do this ! ... is there a set 
> of alphabetic characters only  without numbers in python / web2py ?  I 
> only found alpha numeric characters that take numbers as characters !! and 
> it is not what I want !! ..
>
> Please help !
>
> thank you
>
> Don
>
>

-- 





Re: [web2py] Re: is this a bug in the debugger?

2012-09-24 Thread Mariano Reingart
On Mon, Sep 24, 2012 at 6:02 PM, Tim Richardson  wrote:
>
>
> On Tuesday, September 25, 2012 3:12:58 AM UTC+10, Massimo Di Pierro wrote:
>>
>> What do you mean by "If I reverse the string, it shows what I expect."?
>
>
> I reversed the string teststring[::-1] just to make sure that it really did
> still contain ×tamp

Do you mean "×" ?
it seems to be an html entity (like  ), maybe something in middle
of the debugger and your browser is interpreting it instead of showing
the pure string text.

i don't remember if there is any special use case, and btw, the
debugger console is very similar to the shell console, that has a
longer history.

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com

-- 





[web2py] redirecting unauthorized user

2012-09-24 Thread shartha


Is there any way to redirect unauthorized user? 

For instance if the user doesn't have the membership for a particular 
group, e.g. *group1*, if the try to access a particular controller that is 
decorated with the following:
*@auth.requires_membership('group1')*
I'd like to be able to redirect them to another page, rather than showing 
the unauthorized page to them. Is this easily achievable? 

I know I can remove the decorator and use an if-block to check the 
membership and if it is not held, redirect the user to another page. But I 
am looking for an alternative simpler way if that exists.

-- 





[web2py] Re: Help with datatable initialization with server side processing

2012-09-24 Thread Vineet
Have you gone through web2py docs?

On Tuesday, 25 September 2012 03:16:06 UTC+5:30, vivek wrote:
>
> Hi , 
>
>
>  I am a newbie and a sample view and controller with regard to the 
> same will help me really kick start. Else anything really helps
>
> Thanking you,
> Vivek
>

-- 





[web2py] Re: redirecting unauthorized user

2012-09-24 Thread Anthony
You can set auth.settings.on_failed_authorization to the URL where you want 
to redirect.

Anthony

On Monday, September 24, 2012 10:33:31 PM UTC-4, shartha wrote:
>
> Is there any way to redirect unauthorized user? 
>
> For instance if the user doesn't have the membership for a particular 
> group, e.g. *group1*, if the try to access a particular controller that 
> is decorated with the following:
> *@auth.requires_membership('group1')*
> I'd like to be able to redirect them to another page, rather than showing 
> the unauthorized page to them. Is this easily achievable? 
>
> I know I can remove the decorator and use an if-block to check the 
> membership and if it is not held, redirect the user to another page. But I 
> am looking for an alternative simpler way if that exists.
>
>

-- 





[web2py] Re: Strange quirks with GAE

2012-09-24 Thread Pystar
Also in respect of (2), it works, the thing is that the domain or email you 
would be sending mails from should be the admin email, or an email that has 
admin permission in the control panel. Its really simple.

On Tuesday, September 25, 2012 2:18:43 AM UTC+1, Pystar wrote:
>
> In respect to (1) I actually meant sending HTML messages generated using 
> the templating system.
>
> On Tuesday, September 25, 2012 2:15:10 AM UTC+1, Pystar wrote:
>>
>> There are some strange quirks I noticed while working extensively with 
>> Google App Engine. These include:
>> 1. You can not send HTML messages using mail.send() without doing some 
>> extensive work arounds.
>> 2. You can not send html messages from GAE from any address apart from 
>> your Gmail address, although the documentation states that you should be 
>> able to do so with any address that you can also use to login to the app 
>> engine control panel, this isnt so.
>>
>> Has anyone noticed any more?
>>
>

--