[web2py] is it possible to do something like SELECT column1, column2 is null FROM table.. in DAL?

2023-06-21 Thread Dragan Matic
Postgresql allows this syntax:

SELECT column1, column2 is null FROM table WHERE...

Which returns the value from column one and a true/false for column2 like 
this:

column1  column2
value1  true
value2  false

To summarize, I just want for database to tell me whether column2 is null 
or not, I do not want to read the whole column2 and check it in program as 
it may contain a lot of text and will slow down execution. Can I translate 
this select to DAL?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b5d1573f-a5dc-4aad-8394-c2de75640cffn%40googlegroups.com.


[web2py] Re: wev2py 2.22.1 is out

2022-02-12 Thread Dragan Matic
Hi Massimo, 

As already pointed out, when I try to download source code from this addres 
https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip the dal 
directory is empty and it breaks web2py. 

On Tuesday, February 1, 2022 at 4:59:33 AM UTC+1 Massimo Di Pierro wrote:

> Hello Everybody,
>
> web2py 2.22.1 is out.
>
> Includes a few bug fixes and some changes including:
> - support for mail.sent(reply_to=...), thanks Ofa
> - fix a bug to enable redis with python3, thanks Leonel
> - upgraded to latest pydal and yatl
>
> Please report any breakages or issues.
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b1d6d36f-1af7-458e-a0b4-036911089644n%40googlegroups.com.


Re: [web2py] Does oauth2.0 work with python3?

2021-10-09 Thread Dragan Matic
It was a problem in the web2py/oauth20_account.py. A fix is in the 
repository now, but until a new stable version comes out this is what you 
need to change:

https://github.com/web2py/web2py/commit/28cc4446d90ad2f3877ceb293275ce1b2917f887


On Tuesday, October 5, 2021 at 3:51:25 PM UTC+2 Noobie wrote:

> hi can you send me working code, i am fiddling with similar issue,
>
> On Friday, September 24, 2021 at 10:51:09 AM UTC+5:30 
> muratkas...@gmail.com wrote:
>
>> Hi Dragan,
>> I used this when upgrading. Maybe it helps you:
>> try:
>> # For Python 3.0 and later
>> from urllib.request import urlopen
>> except ImportError:
>> # Fall back to Python 2's urllib2
>> from urllib2 import urlopen
>>
>> Best regards,
>> Murat. 
>>
>>
>>
>>
>> Dragan Matic , 23 Eyl 2021 Per, 13:06 tarihinde 
>> şunu yazdı:
>>
>>>
>>> I have the oauth2.0 login enabled in my application as shown in the 
>>> oauth2.0 
>>> example in the web2py book 
>>> <http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms>
>>>  
>>> using google and facebook as providers. 
>>> The application uses python2 and I am now trying to convert it to python 
>>> 3 and I am getting the following error: 
>>>
>>> TypeError: POST data should be bytes, an iterable of bytes, or a file 
>>> object. It cannot be of type str. 
>>>
>>> [image: error1.png]
>>>
>>> I have solved that by adding the "b" before the token url like this:
>>>
>>> TOKEN_URL=b"https://accounts.google.com/o/oauth2/token";
>>>
>>> but now I have the following error:
>>>
>>> AttributeError: 'int' object has no attribute 'decode'
>>>
>>> [image: error2.png]
>>>
>>> Is anybody using oauth2.0 with python3 and if yes, what changes need to 
>>> be made to the code?
>>>
>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/web2py/5acd20a7-75e1-4b6e-895c-d7c47785145bn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/web2py/5acd20a7-75e1-4b6e-895c-d7c47785145bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a3a1e0bd-6208-486c-a022-83841e95b141n%40googlegroups.com.


[web2py] Can I limit wiki articles visibility only for logged in users.

2019-07-05 Thread Dragan Matic
As the title says, I would like to limit visibility of some built-in wiki 
articles. Ideally, I would like to have articles that would be visible to 
everybody and then some of them visible only to logged-in users. Is it 
possible to have some auth functionality for articles or if not is it 
possible to have two wikis?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b7e0a134-cb3f-497f-a555-5e415b982b23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] welcome app - broken menu on 2.17.2

2018-10-11 Thread Dragan Matic
welcome app's menu is broken on both firefox and chromium. 
This is how it looks on chromium:

[image: chromium.png]



And this is how it looks on firefox:


[image: firefox.png]


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is there a way to donate money to web2py

2018-01-31 Thread Dragan Matic

It would be nice if web2py had a patreon page or something similar. I see 
that similar questions have been asked before and I know that there was a 
'send bitcoins' link but most of us still pay online with credit cards or 
paypal. If web2py had a patreon page people could just send a predefined 
amount monthly. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is there a way to put icon or image picker in form?

2018-01-09 Thread Dragan Matic
I would like to have an icon or image picker in form where user could 
choose from a set of predefined icons. 
Form would contain a few other fields like a title, text and an icon that 
would visually mark the topic of the text. Icons could be either pictures 
in 'static' folder or in 'uploads' (site admin would preload a few icons in 
a table, something like 'text_topic_symbols' or something similar). 

I've tried doing something like this:

db.define_table('topic_icon', 
Field('topic_icon_image', 'upload'))

db.define_table('content', 
Field('title', 'string', length=256, required=True),
Field('body', 'text', required=True),
Field('topic_type', 'reference topic_icon'))



But then I don'k know how to build a FORM that would show image picker. 

Would it be possible to do with web2py or I have to use some javascript 
magic?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to translate extra fields in auth form?

2017-12-18 Thread Dragan Matic
I've added a few extra fields to auth_user table like this

auth.settings.extra_fields['auth_user'] = [
Field('avatar', 'upload'), 
Field('avg_rating', 'decimal(3, 2)', default=0),
Field('receive_notifications', 'boolean', default=True)
]


I do not know how to translate them, the problem is that those extra fields 
do not appear in 'languages' files. 

Another way to do it would be to assign labels to fields like in SQLFORM 
but I do not think it is possible with simple form. 

Any suggestions how to solve this?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SSL database connections

2016-06-27 Thread Dragan Matic
Thanks Massimo, just in case anybody has the same problem, this is the full 
syntax for connecting in ssl mode:

DAL('postgres://postgres:draganova_si...@n1.theobviousthings.com/sshfw', 
driver_args={"sslmode":"require", "sslrootcert":"root.crt", "sslcert":
"postgresql.crt", "sslkey":"postgresql.key"})

where sslrootcert, sslcert and sslkey must contain the full paths to the 
files. 

On Sunday, June 26, 2016 at 7:21:43 AM UTC+2, Massimo Di Pierro wrote:
>
> you use postgres you can do:
>
> db = DAL(., driver_args=dict(sslmode="require"))
>
> should work fine. I do not know of other engines that support it but there 
> is always a way to tell the driver.
>
> On Friday, 24 June 2016 05:53:37 UTC-5, Dragan Matic wrote:
>>
>> Has there been any progress in connecting through SSL with DAL? Searching 
>> chapter 6 (DAL) of the web2py book for "ssl" or "secure" does not find 
>> anything. 
>>
>>
>> On Sunday, August 23, 2009 at 6:01:11 PM UTC+2, mdipierro wrote:
>>>
>>> We do not support that but now that I know it should be easy to add. 
>>> We will add it in the next version. 
>>>
>>> Please help us test it. Edit gluon.sql.py and change 
>>>
>>> msg = \ 
>>> "dbname='%s' user='%s' host='%s' port=%s 
>>> password='%s'"\ 
>>>  % (db, user, host, port, passwd) 
>>> self._pool_connection(lambda : psycopg2.connect(msg)) 
>>>
>>>
>>> with 
>>>
>>> msg = \ 
>>> "dbname='%s' user='%s' host='%s' port=%s password='%s' 
>>> sslmode='require'"\ 
>>>  % (db, user, host, port, passwd) 
>>> self._pool_connection(lambda : psycopg2.connect(msg)) 
>>>
>>> does it work? 
>>>
>>> Massimo 
>>>
>>> On Aug 23, 10:57 am, Don Lee  wrote: 
>>> > Yes.  PostgreSQL allows for an SSL connection between the client and 
>>> the 
>>> > server.  This can be done with psycopg2, for example: 
>>> > 
>>> > import psycopg2 as database 
>>> > db = database.connect (host="db.host.com", 
>>> >  sslmode="require", 
>>> >  database="dbname", 
>>> >  user="dbuser", 
>>> >  password="dbpass") 
>>> > 
>>> > On Sun, Aug 23, 2009 at 10:04 AM, mdipierro  
>>> wrote: 
>>> > 
>>> > > Then I do not understand what you mean by "secure connection". Is 
>>> > > there a secure connection function provided by postgresql and 
>>> psycopg2 
>>> > > that web2py is not using and should be using? 
>>> > 
>>> > > Massimo 
>>> > 
>>> > > On Aug 23, 8:14 am, Don  wrote: 
>>> > > > I do not have SSH access to the DB server.  Can I use psycopg2 
>>> > > > directly to create the connection? 
>>> > 
>>> > > > On Aug 23, 8:59 am, mdipierro  wrote: 
>>> > 
>>> > > > > Yes but not this way. 
>>> > > > > You have to open an ssh tunner outside web2py and then instruct 
>>> web2py 
>>> > > > > to connect to the database using the port used by the tunnel. 
>>> > 
>>> > > > > Massimo 
>>> > 
>>> > > > > On Aug 23, 7:47 am, Don  wrote: 
>>> > 
>>> > > > > > Is it possible to define a secure database connection? 
>>> > 
>>> > > > > > Ex: db = DAL(‘postgres://user:password@hostname/db’, pools=10, 
>>> > > > > > secure=True) 
>>> > 
>>> > > > > > My production DB and web servers are running on a different 
>>> machines.
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Instructions on how to deploy on Digital Ocean

2016-06-27 Thread Dragan Matic
I don't want to brag or anything similar but I think this 

 
covers the same topic with more in-depth explanations. 



On Sunday, June 26, 2016 at 5:58:01 PM UTC+2, Massimo Di Pierro wrote:
>
> https://experts4solutions.com/e4s/static/HOWTO-DigitalOcean.pdf
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SSL database connections

2016-06-24 Thread Dragan Matic
Has there been any progress in connecting through SSL with DAL? Searching 
chapter 6 (DAL) of the web2py book for "ssl" or "secure" does not find 
anything. 


On Sunday, August 23, 2009 at 6:01:11 PM UTC+2, mdipierro wrote:
>
> We do not support that but now that I know it should be easy to add. 
> We will add it in the next version. 
>
> Please help us test it. Edit gluon.sql.py and change 
>
> msg = \ 
> "dbname='%s' user='%s' host='%s' port=%s 
> password='%s'"\ 
>  % (db, user, host, port, passwd) 
> self._pool_connection(lambda : psycopg2.connect(msg)) 
>
>
> with 
>
> msg = \ 
> "dbname='%s' user='%s' host='%s' port=%s password='%s' 
> sslmode='require'"\ 
>  % (db, user, host, port, passwd) 
> self._pool_connection(lambda : psycopg2.connect(msg)) 
>
> does it work? 
>
> Massimo 
>
> On Aug 23, 10:57 am, Don Lee  wrote: 
> > Yes.  PostgreSQL allows for an SSL connection between the client and the 
> > server.  This can be done with psycopg2, for example: 
> > 
> > import psycopg2 as database 
> > db = database.connect (host="db.host.com", 
> >  sslmode="require", 
> >  database="dbname", 
> >  user="dbuser", 
> >  password="dbpass") 
> > 
> > On Sun, Aug 23, 2009 at 10:04 AM, mdipierro  
> wrote: 
> > 
> > > Then I do not understand what you mean by "secure connection". Is 
> > > there a secure connection function provided by postgresql and psycopg2 
> > > that web2py is not using and should be using? 
> > 
> > > Massimo 
> > 
> > > On Aug 23, 8:14 am, Don  wrote: 
> > > > I do not have SSH access to the DB server.  Can I use psycopg2 
> > > > directly to create the connection? 
> > 
> > > > On Aug 23, 8:59 am, mdipierro  wrote: 
> > 
> > > > > Yes but not this way. 
> > > > > You have to open an ssh tunner outside web2py and then instruct 
> web2py 
> > > > > to connect to the database using the port used by the tunnel. 
> > 
> > > > > Massimo 
> > 
> > > > > On Aug 23, 7:47 am, Don  wrote: 
> > 
> > > > > > Is it possible to define a secure database connection? 
> > 
> > > > > > Ex: db = DAL(‘postgres://user:password@hostname/db’, pools=10, 
> > > > > > secure=True) 
> > 
> > > > > > My production DB and web servers are running on a different 
> machines.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: how to create pdf report in web2py???

2016-05-16 Thread Dragan Matic
Here's a simple example, creating a PDF invoice in web2py app:

This is the controller code:
def show_pdf_invoice(invoice_number, invoice):
from fpdf import FPDF

pdf = FPDF()
pdf.add_page()

pdf.set_font('Arial', 'B', 10)
pdf.cell(25, 5, 'My company name', )
pdf.set_font('Arial', '', 10)
pdf.cell(60, 5, 'My company address', ln=1)
pdf.cell(40, 5, 'My company additional data', ln=1)
pdf.line(10, 20, 180, 20)

pdf.set_xy(140, 25)
pdf.cell(25, 5, 'Date issued: {0}'.format(invoice[0].date))
pdf.set_xy(140, 30)
pdf.cell(25, 5, 'Invoice Number: {0}'.format(str(invoice_number)))

pdf.line(10, 40, 180, 40)
pdf.set_xy(10, 41)
pdf.cell(30, 5, 'Description')
pdf.cell(30, 5, 'Starts')
pdf.cell(30, 5, 'End')
pdf.cell(30, 5, 'Amount')
pdf.line(10, 46, 180, 46)

pdf.set_xy(10, 47)
pdf.cell(30, 5, invoice[0].invoice_item_name)
pdf.cell(30, 5, '')
pdf.cell(30, 5, '')
pdf.cell(30, 5, '{0} {1}'.format(invoice[0].total, invoice[0].currency)
pdf.line(10, 51, 180, 51)

pdf.set_xy(150, 52)
pdf.cell(30, 5, 'Total: {0} {1}'.format(invoice[0].total, invoice[0].
currency)

pdf.set_xy(10, 60)

pdf.cell(30, 5, 'Bill To:', 0, 1)
pdf.cell(30, 5, invoice[0].invoice_address_name, 0, 1)
pdf.cell(30, 5, invoice[0].invoice_address_street, 0, 1)
pdf.cell(30, 5, invoice[0].invoice_address_city)
pdf.cell(30, 5, invoice[0].invoice_address_zip, 0, 1)
pdf.cell(30, 5, invoice[0].invoice_address_country)

pdf.output('invoice.pdf', 'F')

response.headers['Content-Type'] = 'application/pdf'
return XML(pdf.output('', 'S'))



And that's it, your view named "show_pdf_invoice.html" should be empty.  



On Monday, May 16, 2016 at 12:19:08 PM UTC+2, prashant joshi wrote:
>
> i also try this but i could not understadplease anybody send a simple 
> example that i will understd
>
> On Wed, May 11, 2016 at 1:57 AM, Carlos Cesar Caballero Díaz <
> desar...@spicm.cfg.sld.cu > wrote:
>
>> Take a look to jsPDF (https://parall.ax/products/jspdf) if you are more 
>> familiar with javascript.
>>
>>
>>
>> El 10/05/16 a las 15:52, Jim S escribió:
>>
>> I use ReportLab... 
>>
>> -Jim
>>
>> On Tuesday, May 10, 2016 at 1:40:42 PM UTC-5, José L. wrote: 
>>>
>>> Latest fpdf code is in the contrib section of gluon libraries, and works 
>>> correctly. If your report is not too complicated I'd recommend you this 
>>> way. The demo from the above link is easy to follow. 
>>>
>>> 2016-05-10 20:26 GMT+02:00 Dave S :
>>>
 On Tuesday, May 10, 2016 at 9:59:47 AM UTC-7, prashant joshi wrote: 
>
> how to create pdf report in web2py?  i saw video on vimeo but this 
> plugin not found..
>


 There are multiple ways to do it, but one way (which is briefly 
 mentioned in the web2py book, and the pieces are in contrib)
 is shown at 
 https://groups.google.com/d/msg/web2py/fio15y9n2EU/95223fifCgAJ>

  The fpdf link shown in the book appears to be out of date; try
 https://github.com/reingart/pyfpdf/blob/master/docs/Tutorial.md>
 (Mariano has additional credits in contrib)

 /dps

 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscrib

[web2py] Is web2py the right tool for this kind of project?

2016-03-22 Thread Dragan Matic
I want to create a service where users could remotely manage some services 
on their computers which are behind the firewall. 

Users could register their account, under their account they could register 
one or more (let's say up to 20) client computers, for each of these they 
could download a script which they could install on their computers and 
that script would periodically contact the server (for instance every 5 
seconds) and do certain things based on the response from the server. It 
would be a json-based service where the server would answer something like 
{"startSomeService": "False"} or {"startSomeService": "True", "param1": 
"aaa", "param1" : "bbb"...}. Web interface would be just a simple list of 
registered computers and their status with a few buttons for service 
management. Web interface would be made using web2py and now comes the 
tricky part:

I've calculated that if I find some 200 paying customers that could earn me 
some basic income. Let's say those 200 users each have 20 registered 
computers that would be 200x20 = 4000 json service requests within 5 
seconds, so some 800 requests per second. Or let's say I somehow manage to 
get 1000 users, that would be 2 requests within 5 seconds, so around 
4000 requests per second or more. These would only be json requests plus 
there would be normal html requests for web interface. I am worrying if 
web2py can handle this kind of traffic and what kind of hardware would I 
need? I plan this to work on nginx web server + postgresql database 
(properly configured and indexed). Is this a feasible solution or I need to 
rethink everything over?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: how to create dev site for my web2py postgres app on pythonanywhere.com

2016-02-21 Thread Dragan Matic
Here's explained:

http://blog.draganmatic.com/init/default/show_page/3

On Sunday, February 21, 2016 at 9:30:14 AM UTC+1, Alex Glaros wrote:
>
> can anyone please walk me through the concepts of creating a dev site for 
> my web2py postgres app on pythonanywhere.com?
>
> I'd like to have a copy of production app so that I can use it as a 
> dev/testing area.  
>
> How to have a copy of the postgres database and web2py app created?
>
> thanks
>
> Alex Glaros
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] A guide how to install your web2py app on your own server (using DigitalOcean droplets)

2016-02-15 Thread Dragan Matic
Hey guys, I wrote a guide for beginners how to install and configure your 
own server and how to host your web2py app on it, if anybody's interested 
here's the link:

http://blog.draganmatic.com/init/default/show_page/3

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to hide app name and how to prevent name "leakage" if hosting multiple apps on one server?

2015-03-01 Thread Dragan Matic
Let's say that I have application named app1 and I am hosting it on 
www.app1.com domain. I would like application name not to be shown. If for 
instance I have two controllers, ctr1 and ctr2, URL helper will always 
generate addresses like www.app1.com/*app1*/ctr1/some_function and www.app1/
*app1*/ctr2/some_function and I would like to have something like 
www.app1.com/ctr/some_function - URL without application name. 

Second question is if I have two applications hosted on the same server 
(app1 and app2, registered on www.app1.com and www.app2.com domains) I know 
that if I setup routes.py something like domains = {'www.app1.com' : 
'app1', 'www.app2.com' : 'app2'} then app1 will be shown on www.app1.com 
and app2 will be shown on www.app2.com. However, that doesn't prevent the 
user to type something like www.*app1*.com/*app2*/default/index and app2 
will we shown on www.app1.com domain. Is there a way to prevent this or 
each application must be hosted on separate server?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web2py Funding

2014-11-20 Thread Dragan Matic
Is there a way to donate money to web2py project? I can only see "donate 
bitcoins" on front page. 

On Thursday, November 20, 2014 4:44:37 AM UTC+1, Massimo Di Pierro wrote:
>
> Honestly I do not understand how Meteor pulled it off. 
> I would have been happy to rebuilt something better than meteor for them 
> for 1/10th of that amount.
> But nobody asked me.
>
>
>
>
> On Tuesday, 18 November 2014 06:40:12 UTC-6, Leonel Câmara wrote:
>>
>> I think this would be hard to do. Funding is a lot easier when you're 
>> riding some kind of hipster wave like meteor did.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-18 Thread Dragan Matic
for centos6 you should use setup-web2py-fedora.sh, it does the job. 
for centos7 there is setup-web2py-centos7.sh as Massimo mentioned but it 
will not work on centos 6 due to differences is these two systems. 

On Tuesday, November 11, 2014 12:29:34 PM UTC+1, lesssugar wrote:
>
> Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking 
> for deployment script, as I'm no expert.
>
> Apache and MySQL is in place, but I'm looking for relatively painless way 
> to automatically install web2py, configure mod_wsgi etc.
>
> Any help?
>
> *EDIT:*
>
> This looks OK, I guess: 
> http://web2py.googlecode.com/hg/scripts/setup-web2py-fedora.sh
> However, I would like to change the path from */opt/web-apps/ *to 
> */var/www/*. Don't think this could cause problems.
>
> What do you think about the linked script? Seems quite outdated (it was 
> posted on web2pyslices in 2010 if I'm correct).
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Mercurial?

2014-11-18 Thread Dragan Matic
Also, file scripts/setup-web2py-centos7.sh is missing from mercurial 
repository. Obviously there is a problem in syncing two repositories. 

On Monday, November 17, 2014 8:25:44 AM UTC+1, Johann Spies wrote:
>
> According to https://code.google.com/p/web2py/source/checkout the 
> Mercurial repository should still  be valid, but it differs from the git 
> repository e.g. the file gluon/dal/adaptors/postgres.py does not appear in 
> the mercurial repository while the problem has been corrected in the git 
> repository:  postgre.py => postgres.py.
>
> If the mercurial repository is no longer to be trusted, then I suppose the 
> information on the abovementioned link should be updated.
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Supplied setup scripts for fedora and centos do not work under centos 7. Here is the updated script.

2014-10-06 Thread Dragan Matic
Because of the changes in apache configuration and in the way iptables are 
configured in centos 7 none of the automated scripts could install web2py. 
In the attachment is the updated script that will install web2py with 
apache on fresh install of centos 7. SELinux configuration is still 
missing, though. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
echo "This script will:
1) Install modules needed to run web2py on Fedora and CentOS/RHEL
2) Install Python 2.6 to /opt and recompile wsgi if not provided
2) Install web2py in /opt/web-apps/
3) Configure SELinux and iptables
5) Create a self signed ssl certificate
6) Setup web2py with mod_wsgi
7) Create virtualhost entries so that web2py responds for '/'
8) Restart Apache.

You should probably read this script before running it.

Although SELinux permissions changes have been made,
further SELinux changes will be required for your personal
apps. (There may also be additional changes required for the
bundled apps.)  As a last resort, SELinux can be disabled.

A simple iptables configuration has been applied.  You may
want to review it to verify that it meets your needs.

Finally, if you require a proxy to access the Internet, please
set up your machine to do so before running this script.

(author: berubejd)

Press ENTER to continue...[ctrl+C to abort]"

read CONFIRM

#!/bin/bash

# (modified for centos7: Dragan (spamperakojotgen...@gmail.com)

###
###  Phase 0 - This may get messy.  Lets work from a temporary directory
###

current_dir=`pwd`

if [ -d /tmp/setup-web2py/ ]; then
mv /tmp/setup-web2py/ /tmp/setup-web2py.old/
fi

mkdir -p /tmp/setup-web2py
cd /tmp/setup-web2py

###
###  Phase 1 - Requirements installation
###

echo
echo " - Installing packages"
echo

# Verify packages are up to date
yum update

# Install required packages
yum install httpd mod_ssl mod_wsgi wget python

###
### Phase 2 - Install web2py
###

echo
echo " - Downloading, installing, and starting web2py"
echo

# Create web-apps directory, if required
if [ ! -d "/opt/web-apps" ]; then
mkdir -p /opt/web-apps

chmod 755 /opt
chmod 755 /opt/web-apps
fi

cd /opt/web-apps

# Download web2py
if [ -e web2py_src.zip* ]; then
rm web2py_src.zip*
fi

wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
mv web2py/handlers/wsgihandler.py web2py/wsgihandler.py
chown -R apache:apache web2py

###
### Phase 3 - Setup SELinux context
###
### SELinux doesn't behave well with web2py, for details
### see https://groups.google.com/forum/?fromgroups#!searchin/web2py/selinux/web2py/_thPGA9YhK4/dSnvF3D_lswJ
###
### For now you'll have to disable SELinux


# Allow http_tmp_exec required for wsgi
RETV=`setsebool -P httpd_tmp_exec on > /dev/null 2>&1; echo $?`
if [ ! ${RETV} -eq 0 ]; then
# CentOS doesn't support httpd_tmp_exec
cd /tmp/setup-web2py

# Create the SELinux policy
cat > httpd.te  /etc/httpd/ssl/self_signed.key
openssl req -new -x509 -nodes -sha1 -days 365 -key /etc/httpd/ssl/self_signed.key > /etc/httpd/ssl/self_signed.cert
openssl x509 -noout -fingerprint -text < /etc/httpd/ssl/self_signed.cert > /etc/httpd/ssl/self_signed.info

chmod 400 /etc/httpd/ssl/self_signed.*

###
### Phase 6 - Configure Apache
###

echo
echo " - Configure Apache to use mod_wsgi"
echo

# Create config
if [ -e /etc/httpd/conf.d/welcome.conf ]; then
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.disabled
fi

cat  > /etc/httpd/conf.d/default.conf <
  WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1
  WSGIProcessGroup web2py
  WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
  WSGIPassAuthorization On

  
AllowOverride None
Order Allow,Deny
Deny from all

  Require all granted
  Allow from all

  

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/web2py/applications/\$1/static/\$2

  
Options -Indexes
Order Allow,Deny
Allow from all
Require all granted
  

  
Deny from all
  

  
Deny from all
  

  CustomLog /var/lo

Re: [web2py] Re: Appadmin redirect after upgrading to 2.9.7

2014-09-05 Thread Dragan Matic
+1 Here. It does the same thing to me, 2.9.7 appadmin redirects to web2py 
admin. 2.9.6 is working correctly. 

On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote:
>
> because the only change we made was making the access to appadmin more 
> secure when web2py is behind a proxy.
>
> However, if you get redirected to admin it shouldn't matter, as the 
> "change" would affect you accessing admin also.
> Seeing the code of appadmin.py (assuming is the latest from 2.9.7) the 
> redirection is made on line 54. Look at those conditions and add a few log 
> (or print) statements to pinpoint the root cause.
>
> On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta Podazza 
> wrote:
>>
>> Hi Niphlod,
>>
>> No, I'm working locally and no proxies at all. Why you ask?
>>
>>
>> On Fri, Sep 5, 2014 at 4:58 PM, Niphlod  wrote:
>>
>>> are you behind a proxy ?
>>>
>>>
>>> On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza 
>>> wrote:

 Hello,

 I was developing an application with web2py 
 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine 
 until I upgraded to latest 2.9.7.

 Now when I access appadmin for ANY app(welcome, examples, my app, etc) 
 it redirects to admin and nothing happens.

 Tried cleaning everything, even deleting the entire database and 
 starting from scratch and nothing happened.

 Any ideas about this?. Thanks in advance.

>>>  -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/9kXd30hW3j0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Atte
>> Luciano Laporta Podazza
>>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to show just entered value in the same form after self-submitting?

2014-08-19 Thread Dragan Matic
Unfortunately that won't work, if you recreate the form it does not 
self-submit, in fact in that case submit button does nothing, try this - it 
won't work:

form=SQLFORM.factory(
Field('some_text', 'string'))

if form.accepts(request): 
form=SQLFORM.factory(
Field('some_text', 'string'))

return dict(form=form)




On Sunday, August 17, 2014 3:58:58 PM UTC+2, Kirill Shatalaev wrote:
>
> Why not recreate form again? 
> if form.vars.field1==None
> dictionary_of_typed_values.append(form.vars.field2)... or something 
> like
> form=
> return dict(form=form)
>
> ?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to show just entered value in the same form after self-submitting?

2014-08-14 Thread Dragan Matic
I have a form with two fields, one field is a selection box of previously 
typed values and the other is a text box. User can choose a value from a 
selection box or can type a value in text box and submit it in which case I 
would like to add a value to a selection box, something like this:


# some code that reads values from db into dictionary_of_typed_values

#  create a form
form=SQLFORM.factory(
Field('field1', requires=IS_EMPTY_OR(IS_IN_SET(
dictionary_of_typed_values))), 
Field('field2', 'string'))

if form.accepts(request, session):
# insert new value into db 
new_value_id = db.table.insert(column1=form.vars.field1, column2
=form.vars.field2)

if form.vars.field1 == None:
# here I would like to add form.vars.field2 to set of 
values in field1

return dict(form=form)


The problem is that values are already loaded when program flow reaches 
insert statement so inserting value into dictionary will not change what is 
in the form. 

I would like to have a solution that whenever user types something in 
field2 page reloads with the typed value in the selection box. Is there an 
elegant way to do it?

Dragan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
I have found what causes it, in dal.py in PostgreSqlAdapter this method is 
supposed to return last inserted id:

def lastrowid(self,table = None):
self.execute("select lastval()")
return int(self.cursor.fetchone()[0])

This here 
http://stackoverflow.com/questions/17819001/postgres-not-returning-lastval-properly
  
says this the wrong way to ask for ID and that it should be returned this 
way:

insert into table ([columns]) values  ([values]) returning id

So it will return wrong ID everythime there is trigger that inserts 
something else somewhere else. 

I'm sending a bug report 





On Wednesday, August 6, 2014 12:43:38 PM UTC+2, Dragan Matic wrote:
>
> Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
> PostgreSQL(pg8000), IMAP(imaplib)
>
> Postgresql 9.3 on linux mint 17. 
>
> trigger is BEFORE_INSERT
>
> On Wednesday, August 6, 2014 12:30:30 PM UTC+2, Niphlod wrote:
>>
>> it doesn't have to do with after_insert . it's something "broken" at 
>> the backend level. what backend are you using dragan ?
>>
>> On Wednesday, August 6, 2014 12:24:15 PM UTC+2, Leonel Câmara wrote:
>>>
>>> Check _after_insert it's probably what you want.
>>>
>>>
>>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)

Postgresql 9.3 on linux mint 17. 

trigger is BEFORE_INSERT

On Wednesday, August 6, 2014 12:30:30 PM UTC+2, Niphlod wrote:
>
> it doesn't have to do with after_insert . it's something "broken" at 
> the backend level. what backend are you using dragan ?
>
> On Wednesday, August 6, 2014 12:24:15 PM UTC+2, Leonel Câmara wrote:
>>
>> Check _after_insert it's probably what you want.
>>
>>
>> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
If I do something like this:

new_id = db.table1.insert(...)

and there is a trigger that inserts row in another table (table2) based on 
insert in table1 then the value of new_id is the id that is inserted in 
table2 instead of table1. Is this a bug or a feature? If it is a feature 
how can I get id from table1?

Dragan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Bootstrap is really killing web2py

2014-07-30 Thread Dragan Matic
Anthony, 

Thanks for the answer, I was aware of that completely. It is just that 
Massimo said that it is trivial to replace BS2 with BS3 yet when I try to 
do it the trivial way and then create a FORM in controller (whether it be 
simple form, sqlform or sqlform.factory) the form looks completely wrong. 
The same is with main menu. 

Now I know that in this case I should create form in HTML using appropriate 
BS3 classes and then use that form in controller but I think you will agree 
that this takes away the ease of use which is one of the main strengths of 
web2py. 

I suppose that was why OP named this thread "Bootstrap is killing web2py". 
I think a lot of web2py users (like myself) are novices in web programming 
and while it may be trivial for versed web programmer to use BS3 with 
web2py it is not the case for the beginners. BS3 is more than a year old 
but I still develop my web apps using BS2 because that is what ships with 
web2py. I don't want to criticize, web2py is an excellent framework but I 
think it needs to ship with BS3, otherwise it will lose a lot of novice 
programmers and I think novice programmers are important because those are 
the future user base of web2py. 

Just my 2c. 

On Wednesday, July 30, 2014 1:12:44 AM UTC+2, Anthony wrote:
>
> On Tuesday, July 29, 2014 12:16:13 PM UTC-4, Dragan Matic wrote:
>>
>> Is there some tutorial how to do it for those of us not so versed in CSS? 
>> If you just replace bootstrap.min.css in static/css the menus and forms do 
>> not work the way they used to in BS2.
>>
>
> Note, in general, you should not expect to simply replace the CSS for one 
> framework with that of another and have it work. The reason is that 
> front-end frameworks require a combination of CSS and specific HTML 
> structure with framework-specific classes. So, the layout must be 
> customized for the framework.
>
> The layout and CSS of the web2py scaffolding app is just intended as a 
> basic template. It is not part of the web2py framework nor coupled to the 
> framework. It is just one layout that you can use if you want. If you want 
> to use a different front end framework or some other template, you should 
> mostly throw out the scaffolding app layout and instead start with an 
> external template. You can then modify your template to turn it into a 
> layout.html view file (look at the scaffolding layout.html for ideas of how 
> to set it up). Check out 
> http://web2py.com/books/default/chapter/29/05/the-views#Page-layout for 
> more details.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Bootstrap is really killing web2py

2014-07-29 Thread Dragan Matic
Is there some tutorial how to do it for those of us not so versed in CSS? 
If you just replace bootstrap.min.css in static/css the menus and forms do 
not work the way they used to in BS2. 

On Tuesday, July 29, 2014 5:36:06 PM UTC+2, Massimo Di Pierro wrote:
>
> web2py includes bs2 but this is client side and it is trivial to replace 
> it with bs3. I do it all the times. The problem is that it takes some JS to 
> style the grid.
>
> Massimo
>
> On Tuesday, 29 July 2014 06:36:27 UTC-5, Stodge wrote:
>>
>> My guess is that web2py includes BS2.
>>
>> On Saturday, 26 July 2014 18:41:24 UTC-4, sasogeek wrote:
>>>
>>> So... I'm not really sure what this whole conversation is about, as to 
>>> whether it's an issue of web2py coming with bs2 by default or some 
>>> difficulty in implementing bs3. I use bs3 just fine in my web2py apps and 
>>> really haven't had any issues..
>>>
>>> On Friday, 18 July 2014 19:17:34 UTC, Moustafa Mahmoud wrote:

 I have been using web2py for 3 years know, and I was really impressed 
 by it, I defended it in every discussion, even implemented all my projects 
 using it and even convinced my Graduation Project Team to use it in our 
 GP. 
 However, as my skill increased and I began looking more into customizing 
 my 
 applications, I have hit a brick wall discovering how tightly bound web2py 
 is to bootstrap2, I wanted to use bootstrap 3 but was faced with tons of 
 problems. If I want to move to another front end framework then I 
 discovered that it would be easier to use another framework because of the 
 time and effort I would need to invest in modifying all parts of web2py 
 that are tightly bound  to bootstrap.
 This will result in making web2py a headache to me rather than my best 
 friend. I am writing this message because I am really sad that an amazing 
 framework like web2py is forcing me to consider an alternative because I 
 do 
 really feel it is constraining me at this point.
 Any help or ideas about that ?

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to host a website from web2py homepage on pythonanywhere.com?

2014-07-08 Thread Dragan Matic
Check my answer on the same question here: 

https://groups.google.com/forum/?fromgroups#!searchin/web2py/dragan/web2py/IURWDAP2eTY/EBgPNBZ2kmwJ


On Sunday, July 6, 2014 1:46:09 PM UTC+2, Ritesh Bhat wrote:
>
> Hi everyone,
> I am a beginner and am using the web2py framework.for the first time. I 
> would like to host a website from my web2py page on to pythonanywhere.com 
> and i am not able to figure out the same. Any help in this regard will be 
> very helpful.
> Thankyou.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How do I do transaction in web2py?

2014-05-12 Thread Dragan Matic
All database operations in your controllers which are executed through DAL 
are executed in a transaction. 
So every time you do a database operation in your controller it starts a 
new transaction which is automatically commited if there were no errors. If 
it encounters any error then the transaction is rolled back. 

If you still want to control your transactions (e.g. if you wish to have 
more transaction in a single controller call) you can do it through 
db.commit() and db.rollback(). 

Take a look at this: 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=transaction#commit-and-rollback

On Monday, May 12, 2014 2:34:00 AM UTC+2, Xiaojian Huang wrote:
>
> I want to insert records into two tables A  and B. I will insert into A 
> first then B.
>
> and I like to rollback A when inserting into B failed. Is there any way to 
> do this?
>
> Thanks!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Free opensource Janrain alternative - Python Social auth

2014-04-02 Thread Dragan Matic
I have installed the plugin and I think I have configured it according to 
manual but it keeps giving me this error: 

 name 'current' is not defined

File c:\web2py\applications\authtest\models\plugin_social_auth.py in 
 at line 41



Am I missing something?


On Thursday, February 27, 2014 8:27:57 PM UTC+1, Quint wrote:
>
> Thanks!
>
> You could help by installing and testing the plugin:
>
>
>1. You need at least a API key/secret for 1 oauth provider. I know 
>that the Twitter  or Live 
>work with the version of python-social-auth packaged with the plugin. But 
>python-social-auth  supports 
>many more providers. 
>2. Install the plugin in a (test / development / new / welcome) web2py 
>app. (copy the modules/controllers/models to their respective folders)
>3. Configure the plugin like described 
> here
> 
>4. Post any issues you find in the issue list
>
> Quint
>
> On Thursday, February 27, 2014 5:57:33 PM UTC+1, mweissen wrote:
>>
>> Ok, what can I do, how can I help?
>>
>> Regards, Martin
>>
>>
>> 2014-02-27 16:39 GMT+01:00 Quint :
>>
>>> Hi,
>>>
>>> I need some people to test-drive this.
>>>
>>> Who want to help here and try it out?
>>>
>>> As soon as I get the initial bugs out and any bugs resulting from 
>>> platform differences, it can be advertised.
>>>
>>> Thanks!
>>>
>>> Quint
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>>
>>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: janrain and web2py

2014-03-27 Thread Dragan Matic
It still works with Google in version 2.8.x. 

But as someone mentioned, their prices are pretty high, it would be nice to 
have an alternative. 

On Wednesday, March 26, 2014 9:03:13 PM UTC+1, Niphlod wrote:
>
> it's been sitting on issues and roadmap for quite a while
>
> On Tuesday, March 25, 2014 10:27:19 PM UTC+1, Michele Comitini wrote:
>>
>> Quint has done all the hard work for web2py: 
>>
>> https://code.google.com/p/w2p-social-auth/ 
>>
>>
>> 2014-03-25 22:24 GMT+01:00 Michele Comitini : 
>> > I think we should switch to this: 
>> https://github.com/omab/python-social-auth 
>> > 
>> > 
>> > 2014-03-25 21:37 GMT+01:00 Anthony : 
>> >> Janrain + Google seems to work fine on web2py 2.5.1. I am having a 
>> different 
>> >> problem with Janrain, though. In IE 10 and 11 on Windows 8.1, login 
>> doesn't 
>> >> work with any provider. When the pop-up window goes to a URL like 
>> this: 
>> >> 
>> >> 
>> https://appname.rpxnow.com/xdcomm#opener;0:%7B%22stat%22:%20%22ok%22,%20%22redirectUrl%22:%20%22http://appname.rpxnow.com/redirect?loc=14ac2af5c12ae2f9ab46c5b6f6b4aa6ef9b2af3b%22,%20%22origin%22:%20null,%20%22widget_type%22:%20%22auth%22,%20%22provider%22:%20null,%20%22welcome_info_name%22:%20%22Doe%20Doe%22%7D
>>  
>> >> 
>> >> It generates the following JS error: 
>> >> 
>> >> SCRIPT5007: Unable to get property 'setTimeout' of undefined or null 
>> >> reference 
>> >> File: xdcomm.js, Line: 1, Column: 583 
>> >> 
>> >> Referring to this code: 
>> >> 
>> >> (function(c){var 
>> >> 
>> b=c.location.href,g=b.indexOf("#"),l,i,e,h,m,a,d,k,j;if(g>0){i=decodeURIComponent(b.substring(g+1))}else{throw
>>  
>>
>> >> new Error("RPX:receiver: Missing 
>> fragment.")}l=i.indexOf(";");if(l<0){throw 
>> >> new Error("RPX:receiver: Missing flags 
>> >> 
>> separator.")}e=i.substring(0,l).split(",");d=i.substring(l+1);l=d.indexOf(":");if(l<0){throw
>>  
>>
>> >> new Error("RPX:receiver: Missing func 
>> >> 
>> separator.")}a=d.substring(0,l);m=d.substring(l+1);k=function(f,o){for(var 
>> >> n=0;n> >> 
>> -1};if(k(e,"top")>=0){h=c.top}else{if(k(e,"opener")>=0){h=c.opener}else{h=c.parent}}h.setTimeout(function(){if(a=="close"){h.RPXNOW.Util.LightBox.close()}else{if(a=="janrainSignin"){h.janrainSignin()}else{if(a=="JANRAIN.LOGIN_HELPER._redirect"){h.JANRAIN.LOGIN_HELPER._redirect(m)}else{if(!isNaN(a)){h.RPXNOW._xdCallbacks[a](m)return
>>  
>>
>> >> false},0)})(this); 
>> >> 
>> >> No problem on Windows 7 or if emulating IE 9 on Windows 8. 
>> >> 
>> >> Anthony 
>> >> 
>> >> 
>> >> On Tuesday, March 25, 2014 1:30:39 PM UTC-4, Massimo Di Pierro wrote: 
>> >>> 
>> >>> Any janrain users? 
>> >>> 
>> >>> Some users have reported that janrain no longer works with google 
>> login. I 
>> >>> have experience the same problem. 
>> >>> In December (version 2.9.x) we moved to the new Janrain API. I looked 
>> into 
>> >>> this and the and the new API require a different and more complex 
>> >>> configuration on the janrain page to use Google login. Specifically, 
>> they 
>> >>> require a Google API. This is a show stopper for many. 
>> >>> 
>> >>> So the questions are: 
>> >>> - do you use Janrain? 
>> >>> - do you use Google with Janrain? 
>> >>> - if so, does the OLD api still works (web2py 2.8.x)? 
>> >>> - should we revert to the old API or have an option to use the old 
>> API? 
>> >>> 
>> >>> Massimo 
>> >>> 
>> >> -- 
>> >> Resources: 
>> >> - http://web2py.com 
>> >> - http://web2py.com/book (Documentation) 
>> >> - http://github.com/web2py/web2py (Source code) 
>> >> - https://code.google.com/p/web2py/issues/list (Report Issues) 
>> >> --- 
>> >> You received this message because you are subscribed to the Google 
>> Groups 
>> >> "web2py-users" group. 
>> >> To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> >> email to web2py+un...@googlegroups.com. 
>> >> For more options, visit https://groups.google.com/d/optout. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?

2014-03-03 Thread Dragan Matic
I did not know that. Thanks. 

On Monday, March 3, 2014 2:24:49 PM UTC+1, Anthony wrote:
>
> You can dynamically change the default value of a field at any time:
>
> db.my_table.my_column.default = 'my default'
>
> Anthony
>
> On Monday, March 3, 2014 8:07:57 AM UTC-5, Dragan Matic wrote:
>>
>> It shouldn't always be the same value, but is based on a certain 
>> condition. If for instance user chooses to view rows where value is '1', 
>> then every new row inserted should also have the value of '1'.
>>
>>
>>
>> On Monday, March 3, 2014 12:29:08 PM UTC+1, 黄祥 wrote:
>>>
>>> just a suggestion, why not using default in table field constructor?
>>> e.g.
>>>
>>> db.define_table('person',Field('name',*default='name'*),format='%(name)s')
>>>
>>>
>>> ref:
>>>
>>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation
>>>
>>> best regards,
>>> stifan
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?

2014-03-03 Thread Dragan Matic
It shouldn't always be the same value, but is based on a certain condition. 
If for instance user chooses to view rows where value is '1', then every 
new row inserted should also have the value of '1'.



On Monday, March 3, 2014 12:29:08 PM UTC+1, 黄祥 wrote:
>
> just a suggestion, why not using default in table field constructor?
> e.g.
>
> db.define_table('person',Field('name',*default='name'*),format='%(name)s')
>
>
> ref:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] sqlform.grid - is there a way to set a column to certain value when entering new rows?

2014-03-03 Thread Dragan Matic
I have a grid and would like to show only rows where mytable.my_column == 
certain value

   
 form = SQLFORM.grid(db.my_table.my_column == my_value)



and I would also like that every new row has the same predefined value. Is 
there a way to say to a grid that every new row should have my_value in 
my_table.my_colum?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: WYSIWYG editor - CKeditor plug-in

2014-02-13 Thread Dragan Matic
I am using the same plugin in my project and it works perfectly, users can 
upload images without problems. If you think problem is in routes try 
without it.

On Thursday, February 13, 2014 12:53:36 PM UTC+1, Gael Princivalle wrote:
>
> Hello all.
>
> I need to add a WYSIWYG editor in my web2py application, with image 
> upload capabilities.
> I suggest that it could be available in the basic packaging of future 
> web2py versions.
>
> I'm trying to use this plugin from Bruno Rocha:
> https://github.com/rochacbruno/web2py_ckeditor
>
> For the text it works great, but when I try to upload an image web2py 
> turns me this error:
> Invalid function (default/plugin_ckeditor)
>
>
> I think there's a routes problem, here is my routes.py :
> routers = dict(
> BASE = dict(
> domains = {
> 'mysubdomain.mydomain.com' : 'myapp',
> },
> default_application='welcome',
> ),
> myapp = dict(languages=['en', 'it'], default_language='it'),
> )
>
> Someone have a solution for this problem, or another way to have a WYSIWYG 
> editor with image upload capabilities ?
>
> Thanks, regards.
> PS: I've try also with this solution but the widget don't load nothing:
>
> https://groups.google.com/forum/#!searchin/web2py/ckeditor/web2py/hfvdNeet1Sc/YBR7deCpgSMJ
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to use PythonAnywhere to host an already developed Web2py app?

2014-02-02 Thread Dragan Matic
If you name your application 'init' (like I wrote in step 3) it should be 
automatically started when you point to YOUR_USERNAME.pythonanywhere.com


On Friday, January 31, 2014 2:07:00 PM UTC+1, Bklynate wrote:
>
> This worked, Thank you very much.
>
> One more question though, How do I get my "
> YOUR_USERNAME.pythonanywhere.com/" to automatically direct to my webapp 
> instead of point to the generic "Welcome" HelloWorld app?
>
> Otherwise I have to constantly add the app in for "
> YOUR_USERNAME.pythonanywhere.com/app2"
>
>
> On Friday, January 31, 2014 4:14:44 AM UTC-5, Dragan Matic wrote:
>>
>>
>>1. Create an account on pythonanywhere and log in (I presume you want 
>>a "Beginner" account for 0$/month)
>>2. Click on "Dashboard"
>>3. Click on "Web"
>>4. Click on "Add a new web app"
>>5. Click "Next", click on "web2py"
>>6. Enter your admin password, click on "Next"
>>7. You can now see web2py installation on "
>>http://YOUR_USERNAME.pythonanywhere.com/welcome/default/index";
>>
>> Now you need to upload your web app from your computer to 
>> pythonanywhere.com
>>
>>
>>1. Go to your web2py dev machine (presumably on 
>>http://127.0.0.1:8000/admin/default/site) and press "Manage" and then 
>>"Pack all" on your application. Save it somewhere on disk
>>2. In order to upload your app go to 
>>https://YOUR_USERNAME.pythonanywhere.com/admin (note the *https://*), 
>>login with your admin password
>>3. On "Upload and install packed application", "Application name" 
>>type "init"
>>4. On "Upload package" select the file that you have saved in step 1
>>5. You should now have your application on 
>>http://YOUR_USERNAME.pythonanywhere.com/
>>
>>
>> On Thursday, January 30, 2014 9:11:01 PM UTC+1, Bklynate wrote:
>>>
>>> Okay,
>>>
>>> I couldn't really think of a title that accurately described the problem 
>>> I am having. I am currently working through a web2py beginner tutorial that 
>>> has me - well doing a lot of coding and tinkering. I would like to host the 
>>> web-app that I have been developing locally on my computer using 
>>> PythonAnywhere.com, but can't for the life of me figure out how to properly 
>>> get this app from my computer onto PythonAnywhere.com ...
>>>
>>> I really wanted to show my cousin whose currently learning HTML - what 
>>> could be possible using a web framework instead.
>>>
>>> [STEP-BY-STEP]Help on this matter would be greatly appreciated
>>>
>>> Thx,
>>> Nate 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to use PythonAnywhere to host an already developed Web2py app?

2014-01-31 Thread Dragan Matic

   
   1. Create an account on pythonanywhere and log in (I presume you want a 
   "Beginner" account for 0$/month)
   2. Click on "Dashboard"
   3. Click on "Web"
   4. Click on "Add a new web app"
   5. Click "Next", click on "web2py"
   6. Enter your admin password, click on "Next"
   7. You can now see web2py installation on 
   "http://YOUR_USERNAME.pythonanywhere.com/welcome/default/index";
   
Now you need to upload your web app from your computer to pythonanywhere.com


   1. Go to your web2py dev machine (presumably on 
   http://127.0.0.1:8000/admin/default/site) and press "Manage" and then "Pack 
   all" on your application. Save it somewhere on disk
   2. In order to upload your app go to 
   https://YOUR_USERNAME.pythonanywhere.com/admin (note the *https://*), 
   login with your admin password
   3. On "Upload and install packed application", "Application name" type 
   "init"
   4. On "Upload package" select the file that you have saved in step 1
   5. You should now have your application on 
   http://YOUR_USERNAME.pythonanywhere.com/


On Thursday, January 30, 2014 9:11:01 PM UTC+1, Bklynate wrote:
>
> Okay,
>
> I couldn't really think of a title that accurately described the problem I 
> am having. I am currently working through a web2py beginner tutorial that 
> has me - well doing a lot of coding and tinkering. I would like to host the 
> web-app that I have been developing locally on my computer using 
> PythonAnywhere.com, but can't for the life of me figure out how to properly 
> get this app from my computer onto PythonAnywhere.com ...
>
> I really wanted to show my cousin whose currently learning HTML - what 
> could be possible using a web framework instead.
>
> [STEP-BY-STEP]Help on this matter would be greatly appreciated
>
> Thx,
> Nate 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to do a insert..select with DAL?

2014-01-28 Thread Dragan Matic
Sorry but I have read there and all I can see is simple insert and 
bulk_insert, neither of them are insert..select. 

On Tuesday, January 28, 2014 1:48:10 PM UTC+1, Paolo Valleri wrote:
>
> of course you can, I suggest to read here 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#insert
>
> On Tuesday, January 28, 2014 1:39:34 PM UTC+1, Dragan Matic wrote:
>>
>> Is there a way to do insert.. select with DAL? I would like to do 
>> something like this:
>>
>> insert into table1 (col1, col2, col3, col4)
>> select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3'
>>
>> Thanks
>>
>> Dragan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to do a insert..select with DAL?

2014-01-28 Thread Dragan Matic
Is there a way to do insert.. select with DAL? I would like to do something 
like this:

insert into table1 (col1, col2, col3, col4)
select col5, col6, 'val1', 'val2' from table2 where col5 = 'val3'

Thanks

Dragan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to make registrations invitation-only with Janrain login/registrations

2013-11-14 Thread Dragan Matic
In the first phase it would be used for beta testing where codes can't be 
used twice. 

Later on it could be also used for users to invite their friends, but for 
now I would just like to give users possibility to register with Janrain 
but only if they have invitation code. 

On Thursday, November 14, 2013 12:02:17 AM UTC+1, Derek wrote:
>
> Sure, there is a way to do that. Do you want to have users send out invite 
> codes to their friends, or is this a beta test type thing where once codes 
> are used up they can't use again, or is this for tracking sources?
>
> On Friday, November 8, 2013 5:57:08 AM UTC-7, Dragan Matic wrote:
>>
>> When using web2py authentication I can check if user is logging in or 
>> registering a new user and then I can check if it has proper invitation 
>> code in and deny him registration. 
>>
>> But what if user is using Janrain? Login and registraton is then done 
>> through an external app. Is there a way to intercept registration and check 
>> for invitation code and deny it somehow if necessary?
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to make registrations invitation-only with Janrain login/registrations

2013-11-08 Thread Dragan Matic
When using web2py authentication I can check if user is logging in or 
registering a new user and then I can check if it has proper invitation 
code in and deny him registration. 

But what if user is using Janrain? Login and registraton is then done 
through an external app. Is there a way to intercept registration and check 
for invitation code and deny it somehow if necessary?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Multiple login forms with ExtendedLoginForm example from book not working

2013-10-24 Thread Dragan Matic
I am trying to create Janrain login + web2py login with password so the 
users can choose login and registration method. When I try the following 
example from the book: 
from gluon.contrib.login_methods.rpx_account import RPXAccount
from gluon.contrib.login_methods.extended_login_form import 
ExtendedLoginForm

other_form = RPXAccount(request, 
api_key='...', 
domain='...', 
url='http://127.0.0.1:8000/%s/default/user/login' % request.application)

auth.settings.login_form = ExtendedLoginForm(auth, other_form, signals=[
'token'])

It breaks with *'DIV' object has no attribute 'add_button'* error. 

When I add the line 
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']

It now shows both login forms but now user can not register with web2py 
method, only with janrain method. 

Is there a way to show both login methods and to show a registration button 
and menu?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] ajax function is not called when passing non-ascii characters as arguments

2013-09-20 Thread Dragan Matic
On my page I have a set of links (page types) that loads its content 
dynamically when user clicks on the link. Clicking on each link calls a 
"LoadPage" javaScript function that calls python function that loads page 
content and puts it in "pageType" DIV. 
 
function LoadPage(pageType)
{
ajax('{{=URL("default", "ajax_LoadPage")}}' + '/' + {{=user_id}} 
+ '/' + pageType, [], pageType); 
}

Called ajax function users request.args[0] to retrieve pageType.

if "pageType" is ascii string (i.e: "default/ajax_loadPage/1/Kalc") then 
page is loaded without problems. But as soon as non-ascii characters are 
introduced as args (i.e:"default/ajax_loadPage/1/Kalč") ajax function is 
not called. 

Is there a way to call ajax function this way and function and pass it a 
non-ascii argument?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Newby, can't connect to a Postgresl database

2013-09-08 Thread Dragan Matic
Postgres probably doesn't have 'root' as user. Its root user is 'postgres'. 

After that check if your address is allowed to connect to postgres server 
in pg_hba.conf  and if server is listening on your network 
('listen_addresses' setting in postgresql.conf). It could also be a 
firewall issue, check is port 5432 is open. 

On Sunday, September 8, 2013 5:47:38 PM UTC+2, Sartglider wrote:
>
> Hi,
> I'm really new to web2py - less than 24 hours - 
> Trying to follow this example 
> http://web2py.com/books/default/chapter/29/03/overview#Say-hello
> it worked fine with sqlite, so I try to connect to a postgresql database 
> in another server:
> the model is this one:
> db = DAL("postgres://root:@192.168.0.98/teste")
>
> db.define_table('equipments',
>Field('eq_id', unique=True),
>Field('eq_model'),
>Field('eq_aka'),
>format = '%(title)s')
>
> db.equipments.eq_id.requires = IS_NOT_IN_DB(db, db.equipments.eq_model)
> db.equipments.eq_model.requires = IS_IN_DB(db, db.equipments.eq_id, 
> '%(title)s')
>
> db.equipments.eq_id.writable = False
>
> but I get no errors just the browser trying to connect.
>
> Thank you in advance for your help.
>
>
> Postgresq server: debian 6 & postgresql 8.4
> web2Py server: debian 7, python 2.7
>
>

-- 

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


[web2py] What is the best way to inform users that maintenance is in progress?

2013-08-05 Thread Dragan Matic
Let's suppose that I want to disable my web app for a certain period of 
time while I am updating the database and that I want to inform users that 
maintenance is in progress? 
1. In models I can create a global var MAINTENANCE_IN_PROGRESS = False 
which I could thange to True when I want to do some maintenance tasks. 
2. then in every function in every controller I could write something like:

def controller():
if MAINTENANCE_IN_PROGRESS:
Redirect_to_maintenance_message
else:
   #do_controller_task

Is there some smarter way to do it without checking if maintenance is in 
progress in every function?


-- 

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




[web2py] New conditional fields in SQLFORM.factory?

2013-07-31 Thread Dragan Matic
Is it possible to use conditional fields introduced in 2.5.1 with 
SQLFORM.factory and what would be the syntax?

-- 

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




[web2py] How to make app setup / is it possible to have modelless app?

2013-07-16 Thread Dragan Matic
What would be the best way to create an app setup? After 
uploading/installing an app to a server I would like a user to be able to 
start a setup page where he would choose a database/user/password and a few 
other configuration parameters. Problem is that for every called page model 
is executed and it wants to create a db object and create tables. Is it 
possible to execute a controller without a model and execute a model only 
after setting up database parameters?

-- 

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




[web2py] Re: What would be the best way to optimize/resize images after upload

2013-05-19 Thread Dragan Matic
Is there a way to make imageutils.py work with SQLFORM.FACTORY? It works 
perfectly with database tables but if I upload a picture through 
SQLFORM.factory like this:

form = SQLFORM.factory(Field('pic', 'upload', uploadfolder=os.path.join(
request.folder, 'uploads/')), Field('description', 'text'), table_name=
'test')

form.table.pic.requires = RESIZE(50, 50)
The picture is not resized. 

On Thursday, May 9, 2013 10:41:14 AM UTC+2, Niphlod wrote:
>
> there's also a /contrib/imageutils.py ready to use.
>
> Il giorno giovedì 9 maggio 2013 07:22:06 UTC+2, weheh ha scritto:
>>
>> There are numerous ways to resize uploaded images. Some are done via the 
>> web server. Others are done within the app. For a couple of my apps I use 
>> the python PIL package to resize uploaded images to thumbnails and the 
>> like. Here's a code fragment that shows how to do it:
>>
>> def resize_image(img_file, indx):
>> from PIL import Image
>> im = Image.open(img_file)
>> im.thumbnail((w, h), Image.ANTIALIAS)
>> return im
>>
>> You then have to use im.save('path', 'jpeg') to get a jpeg out. You also 
>> have to do a little extra work to save it to db or do some file management 
>> to discard the original, if  you so desire.
>>
>>
>>
>> On Thursday, May 9, 2013 5:43:45 AM UTC+8, Dragan Matic wrote:
>>>
>>> Is there a way to automatically optimize and convert images after users 
>>> upload it on my web app? I am pretty sure lots of users will upload 
>>> uncompressed .bmp pictures or extra large pictures directly from camera. I 
>>> think it would be best if I could resize and compress them immediately 
>>> after upload. What would be the best way to do it? 
>>>
>>

-- 

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




[web2py] What would be the best way to optimize/resize images after upload

2013-05-08 Thread Dragan Matic
Is there a way to automatically optimize and convert images after users 
upload it on my web app? I am pretty sure lots of users will upload 
uncompressed .bmp pictures or extra large pictures directly from camera. I 
think it would be best if I could resize and compress them immediately 
after upload. What would be the best way to do it? 

-- 

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




[web2py] Re: Bootstrap typeahead

2013-04-23 Thread Dragan Matic
I'm not sure if typeahead will accept json as source but for me it worked 
the following way:
I created a string from values in which values were in double quotes and 
delimited by comma and I sent that string to the view:

For example:

source_string = '"one", "two", "three"'
return dict(sstr=source_string)

In the view just put that source string as typeahead source:


$(document).ready(function(){
  var sourceString = [{{=sstr}}];

  $("#no_table_locality").typeahead({source: sourceString});
});


And it works like a charm!

On Tuesday, April 23, 2013 4:08:13 PM UTC+2, Annet wrote:
>
> I have been using jQueryUI's auto complete for a while, but I'd like to 
> switch to Bootstrap's type ahead.
>
> In the view I had the following code:
>
> 
> $(document).ready(function(){
>   $(function() {$("#no_table_locality").autocomplete({source: 
> "{{=URL('jqueryui', 'locality_autocomplete')}}",minLength: 2});});
> });
> 
>
> and in a controller:
>
> def locality_autocomplete():
> rows=db(db.locality.name.like(request.vars.term+'%'))\
> .select(db.locality.name,distinct=True,orderby=db.locality.name
> ).as_list()
> result=[r['name']for r in rows]
> return response.json(result)
>
>
> I changed this code the following way:
>
> 
> $(document).ready(function(){
>   $("#no_table_locality").typeahead({source: "{{=URL('typeahead', 
> 'locality_typeahead')}}"});
> });
> 
>
> and in the controller:
>
> def locality_typeahead():
> rows=db(db.locality.name.like(request.vars.term+'%'))\
> .select(db.locality.name,distinct=True,orderby=db.locality.name
> ).as_list()
> result=[r['name']for r in rows]
> return response.json(result)
>
>
> This doesn't work, most likely because the source isn't defined correctly. 
> This is what the Boostrap documentation
> says:
>
> The function is passed two arguments, the query value in the input field 
> and the process callback. The function 
> may be used synchronously by returning the data source directly or 
> asynchronously via the process callback's single argument.
>
> How do I code this correctly to get it to work. I am using Bootstrap 2.3.1
>
> Kind regards,
>
> Annet
>

-- 

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




[web2py] auth.settings.extra_fields - do not show on registration?

2013-04-22 Thread Dragan Matic
Is it possible to add extra fields into auth and not have them shown/asked 
on the registration page but only on the user settings page?

-- 

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




[web2py] webiste language based on domain name?

2013-04-09 Thread Dragan Matic
Is it possible to present a language based on domain name? If I have a 
multiple national domains registered for my web site - for example if I 
have www.mywebsite.com, www.meinewebseite.de or www.misitioweb.es I would 
like to do something like:

if userentered=='www.mywebsite.com':
T.force('en')
if userentered=='www.meinewebseite.de':
T.force('de')
if userentered=='www.misitioweb.es':
T.force('es')




-- 

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




[web2py] Re: DAL is not joining tables if I have multiple clauses?

2013-03-30 Thread Dragan Matic
Thanks a lot to everybody, it seems that I have just skimmed over this part 
of the book. I will have to re-read it again more carefully. 

On Friday, March 29, 2013 2:23:36 PM UTC+1, Niphlod wrote:
>
> Annet got it right.
>
> On Friday, March 29, 2013 1:16:34 PM UTC+1, Cliff Kachinske wrote:
>>
>> For starters, look closely.
>>
>> db(db.family_members.user_id == auth.user_id and 
>> db.family_members.connected_to==db.auth_user.id).select(db.family_members.connected_to,
>>  
>> db.auth_user.last_name, db.auth_user.first_name)
>>
>>  
> PS: auth.user_id is perfectly fine ... returns either the id of the 
> logged-in user or None. 
>
>

-- 

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




[web2py] DAL is not joining tables if I have multiple clauses?

2013-03-29 Thread Dragan Matic
I have a table that shows family connections for users (I need one way 
connections) defined as: 

db.define_table('family_members', 
Field('user_id', 'integer'), 
Field('connected_to', 'integer'))

I need to read and to show all users that are connected to a logged user, 
basically an inner join between auth_user and family_members table. This 
select is giving me the following sql query:

family_members_set = db(db.family_members.user_id == auth.user_id and db.
family_members.connected_to==db.auth_user.id).select(db.family_members.
connected_to, db.auth_user.last_name, db.auth_user.first_name)

SELECT family_members.connected_to, auth_user.last_name, auth_user.first_name 

FROM auth_user, family_members 
WHERE (family_members.connected_to = auth_user.id);

According to documentation I think it should have created this query:

SELECT family_members.connected_to, auth_user.last_name, auth_user.first_name 

FROM auth_user, family_members 
WHERE (family_members.connected_to = auth_user.id and family_members.user_id
=2)


Obviously it is ignoring that I want to select only rows for current_user. 

When I explicitly say it to use join, it generates the correct sql:

family_members_set = db(auth.user_id==db.family_members.user_id).select(db.
family_members.connected_to, db.auth_user.last_name, db.auth_user.first_name
, 
join=db.family_members.on(db.family_members.connected_to==db.
auth_user.id))

SELECT family_members.connected_to, auth_user.last_name, auth_user.first_name 
FROM auth_user JOIN family_members ON (family_members.connected_to =auth_user
.id) WHERE (family_members.user_id = 2);

What am I doing wrong in the first query?


-- 

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




[web2py] How to use auth.requires_permission with record_id?

2013-03-07 Thread Dragan Matic
I'm having problems grasping the mechanism of function decoration with 
auth.requires_permission().

For instance I have a simple table defined like this:

db.define_table('messages', Field('messagetext', 'string'))
And I would like users to be able to see just their own messages. 

I have a controller named show_my_messages() which should show only 
messages visible by user, how can I give record_id in decorator when 
record_id is not known before read? 

# what goes in record_id?
@auth.requires_permission('read', 'messages', record_id)
def show_my_messages():
# I should read just messsages visible by user, but how?
set = db().select(db.messages.messagetext)

# sending set to view
return dict(set=set)

Also, If I am inserting records into database using SQLFORM and not CRUD, 
should I insert new row into auth_permissions for each row inserted into 
table 'messages' or web2py can somehow do it automatically?

Sorry if questions are dumb, but I couldn't find an appropriate example. 

-- 

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




[web2py] Re: uploading a picture through SQLFORM.factory?

2013-02-08 Thread Dragan Matic
Thank you Sir. The information about table and file names was the key 
information for a problem than I was trying to solve for a week and I 
couldn't find it in the book. You have just saved my day. 

Dragan

On Friday, February 8, 2013 2:41:51 PM UTC+1, Anthony wrote:
>
> The download() function calls response.download() to find and serve the 
> file, and response.download() gets the database table and field names from 
> the filename in the URL. SQLFORM.factory works by creating a dummy DAL 
> instance with a dummy DAL Table, and by default it names that table 
> "no_table", which is then used in constructing the filename, as you can see 
> in the URL below. Of course, there is no "no_table" table, so 
> response.download() can't find the file. To get around this problem, you 
> can explicitly specify the name of the dummy table so it is the same as the 
> name as the real table containing the upload field:
>
> form = SQLFORM.factory(
> Field('description', 'string'),
> Field('mypicture', 'upload', uploadfolder=os.path.join(request.
> folder, 'uploads/')),
> table_name='mypictures')
>
> With that change, the filenames will begin with "mypictures" instead of 
> "no_table", and response.download() should then be able to locate the real 
> database table and properly serve the file.
>
> Anthony
>
> On Friday, February 8, 2013 7:21:50 AM UTC-5, Dragan Matic wrote:
>>
>> Here is a model table for holding picture names:
>>
>> db.define_table('mypictures', 
>> Field('description', 'string'),
>> Field('mypicture', 'upload'))
>>
>> If I try to upload a picture through simple SQLFORM everything works ok, 
>> picture is renamed to something like 
>> 'mypictures.mypicture.be0ff92956b815ab.70756c6933312e6a7067.jpg' and I can 
>> show it in view. 
>>
>> def SendPicture():   
>> form=SQLFORM(db.mypictures)
>> 
>> if form.accepts(request, session):
>> response.flash = "picture uploaded"
>> 
>> return dict(form=form)
>> This is the created html and everything works ok, I can show it or 
>> download it:
>> > "/showpics/default/download/mypictures.mypicture.be0ff92956b815ab.70756c6933312e6a7067.jpg"
>>  
>> width="300" />
>>
>>
>> However if I try to upload a picture through SQLFORM.factory and then 
>> insert values into database and then if I try to show it or download it 
>> web2py responds with "400 not found" although picture is uploaded. 
>>
>> def SendPicture():   
>> form = SQLFORM.factory(
>> Field('description', 'string'),
>> Field('mypicture', 'upload', uploadfolder=os.path.join(request.
>> folder, 'uploads/')))
>> 
>> if form.accepts(request, session):
>> response.flash = "picture uploaded"
>> db.mypictures.insert(description=form.vars.description, mypicture
>> =form.vars.mypicture)
>>
>> return dict(form=form)
>>
>> This is the html code created, picture is not shown and if I try to 
>> download it, I get a '400 not found' response although the picture exists 
>> on a given location.
>>
>> > "/showpics/default/download/no_table.mypicture.80201cf3260698b3.70756c695f73615f6a657a696b6f6d322e6a7067.jpg"
>>  
>> width="300" />
>>
>>
>>
>>
>>

-- 

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




[web2py] uploading a picture through SQLFORM.factory?

2013-02-08 Thread Dragan Matic
Here is a model table for holding picture names:

db.define_table('mypictures', 
Field('description', 'string'),
Field('mypicture', 'upload'))

If I try to upload a picture through simple SQLFORM everything works ok, 
picture is renamed to something like 
'mypictures.mypicture.be0ff92956b815ab.70756c6933312e6a7067.jpg' and I can 
show it in view. 

def SendPicture():   
form=SQLFORM(db.mypictures)

if form.accepts(request, session):
response.flash = "picture uploaded"

return dict(form=form)
This is the created html and everything works ok, I can show it or download 
it:



However if I try to upload a picture through SQLFORM.factory and then 
insert values into database and then if I try to show it or download it 
web2py responds with "400 not found" although picture is uploaded. 

def SendPicture():   
form = SQLFORM.factory(
Field('description', 'string'),
Field('mypicture', 'upload', uploadfolder=os.path.join(request.
folder, 'uploads/')))

if form.accepts(request, session):
response.flash = "picture uploaded"
db.mypictures.insert(description=form.vars.description, mypicture=
form.vars.mypicture)

return dict(form=form)

This is the html code created, picture is not shown and if I try to 
download it, I get a '400 not found' response although the picture exists 
on a given location.






-- 

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




[web2py] Is there a way to use query in autocomplete with SQLFORM.factory?

2013-01-24 Thread Dragan Matic
I would like autocomplete to show just a subset of data, not all rows in 
table. Is it possible to use query in autocomplete like this? 

  
query = db.recipe.user_id==auth.user_id

form=SQLFORM.factory(Field('title', 'string', required=True, requires=
IS_NOT_EMPTY()),
Field('type', 'string', 
 widget=SQLFORM.widgets.autocomplete(request, db(query).select(
db.recipe.type), limitby=(0, 10), min_length=2)), 
Field('body', 'text'))


This currently throws the following exception:
 'Rows' object has no attribute 
'tablename'

-- 





[web2py] auth.wiki() writes apsolute links for wiki pages. Can I change it to write only relative url?

2012-12-07 Thread Dragan Matic
Currently if I write markmin link in auth.wiki() like this: [[Some link 
text @some-wiki-page]] - link is written as absolute URL. If I move my 
database to another site all the links in wiki pages break. Can I change 
this behavior or is this a feature?

Dragan

-- 





Re: [web2py] Unique constraint/index on multiple fields?

2012-11-19 Thread Dragan Matic
I'm using postgres too, that will be the way to go, tnx

On Monday, November 19, 2012 7:57:32 AM UTC+1, Johann Spies wrote:
>
> On 16 November 2012 15:59, Dragan Matic 
> > wrote:
>
>> It has been asked before but I haven't seen any definitive answer. Is 
>> there a way to enforce unique constraint or index on multiple fields or if 
>> not are there any plans to implement it? It can come handy in checking data 
>> integrity and lots of databases support it. 
>>
>>
> I use the database backend (PostgreSQL in my case) to enforce that.  
> Web2py will then receive an error message from the backend when the 
> constraint has been violated.  
>
> You can do a try...  except   to cach the exception. 
>
> Regards
> Johann
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

-- 





[web2py] Unique constraint/index on multiple fields?

2012-11-17 Thread Dragan Matic
It has been asked before but I haven't seen any definitive answer. Is there 
a way to enforce unique constraint or index on multiple fields or if not 
are there any plans to implement it? It can come handy in checking data 
integrity and lots of databases support it. 

Without this feature a user can easily insert the same row more than once 
and checking needs to be done in controller whereas this type of error 
could have been easily checked by database. 

For example, using appadmin I can easily insert duplicate values in 
auth_membership where it doesn't make sense to have these rows duplicated. 

auth_membership.id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.id>
auth_membership.user_id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.user_id>
auth_membership.group_id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.group_id>
1 <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/1>Dragan 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) 
<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>2<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/2>Dragan
 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) 
<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>3<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/3>Dragan
 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>


Regards
Dragan 
















-- 





[web2py] Re: 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2012-11-08 Thread Dragan Matic
I can confirm and replicate this bug, the same happens on windows binaries 
and on ubuntu with source with latest stable version - 2.2.1. 

Here are the steps to replicate the bug:

1. create new app
2. create new page (default/wikipage.html) and controller that returns 
auth.wiki(manage_permissions=True)
3. go to wikipage, I am now redirected to user login
4. register first user, go to default/wikipage
5. create first wiki page, accept defaults and submit
6. logout, register second user
7. go to appadmin, check auth_membership table, second user is not a member 
of wiki_editor
8. with second user visit default/wikipage
9. go to appadmin, check auth_membership table, second user has now 
automatically become a member of wiki_editor


On Thursday, November 8, 2012 5:23:24 PM UTC+1, Massimo Di Pierro wrote:
>
> The rule is the first user to register is also a wiki_editor. This should 
> not happen for other users. If it happens it is a bug. Can you confirm this 
> is working as intended?
>
> On Thursday, 8 November 2012 08:00:31 UTC-6, Dragan Matic wrote:
>>
>> I am doing an auth.wiki(manage_permissions=True). 
>>
>> Basically, I want to have a wiki writer and a wiki_reader who will not be 
>> able to edit wiki posts. Two users (reader and writer) are registered and 
>> two groups are automatically opened (user_1 and user_2). For every wiki 
>> post user_1 and user_2 are set to read it and only user_1 can edit it. 
>> However, whenever wiki reader logs in, a row is automatically inserted into 
>> auth_membership table which maps wiki_reader user to wiki_editor group, so 
>> he can also edit posts. Is this a bug or is there a way to set a user to be 
>> a wiki reader only?
>>
>> Thanks
>> Dragan
>>
>

-- 





[web2py] 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2012-11-08 Thread Dragan Matic
I am doing an auth.wiki(manage_permissions=True). 

Basically, I want to have a wiki writer and a wiki_reader who will not be 
able to edit wiki posts. Two users (reader and writer) are registered and 
two groups are automatically opened (user_1 and user_2). For every wiki 
post user_1 and user_2 are set to read it and only user_1 can edit it. 
However, whenever wiki reader logs in, a row is automatically inserted into 
auth_membership table which maps wiki_reader user to wiki_editor group, so 
he can also edit posts. Is this a bug or is there a way to set a user to be 
a wiki reader only?

Thanks
Dragan

--