[web2py] implementing mailing list

2012-11-02 Thread José Eloy
Hello!

I'm migrating a PHP-Joomla 1.5 system to web2py. In Joomla I have a mailing 
system using a component called Acymailing, which is great. With this 
component I'm able to create a newsletter and send it to many contacts 
(aprox 1000). This component also notify to user which mail is being 
sending. Due to Hostgator constrains I can't send more of 500 mails per 
hour (so they can not be considered spam), so the component send 500 mails, 
wait 1 hour and then send the next 500.

My question is:
Is it possible to send emails in an form the user continue working and 
being notified about the mail is being sending?

Thanks in advance for the help.

P.D. My english is not very good, I hope you understand me.

-- 





[web2py] equivalent PHP $_SERVER['REMOTE_ADDR']

2013-01-08 Thread José Eloy
Hello!

Is there an equivalent to PHP variable $_SERVER['REMOTE_ADDR']?
I need to get the IP of the clients that are visiting my page to implement 
a counter page.

Thanks

-- 





Re: [web2py] equivalent PHP $_SERVER['REMOTE_ADDR']

2013-01-08 Thread José Eloy
Thanks


-- 





[web2py] sending mail to multiple clients

2013-01-30 Thread José Eloy
Hello.

I'm thinking about solutions for this problem:

I have an application that have a list of 900 members to which to send 
mail. I need to send the mails and get notification about the status of 
every sending mail and when all they were succesfully sending. The trouble 
is my host provider limit me to send 500 mails per hour. 

What is the best form to do this?

Thanks in advance and sorry for my english, I hope you can understand me.

Regards.

-- 

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




[web2py] Re: sending mail to multiple clients

2013-01-31 Thread José Eloy
Thanks Bruno for your answer:
 

> You should not do this on a "request" time.
>
> It needs to be done on background process.
>
> You can check the web2py book example on email chapter, the scheduler or 
> redis[3]
>
>
> [3] http://rochacbruno.com.br/web2py-and-redis-queue/
>

Maybe I can use the redis library. I have to check if my hosting provider 
can install it.

But I'm confused about using a background task. Really I need is to get 
feedback about the status of every sending mail and when these were finally 
sending even if the user change of web page (controller).

Regards. Thanks, your help is greatly appreciated.


 
 
 

-- 

--- 
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] serving php and python in shared hosting

2013-02-04 Thread José Eloy
Hello everybody!

I got to install web2py in Hostgator following this instructions: 
https://groups.google.com/forum/?fromgroups=#!topic/web2py/h8uLiDCerx0

The website made with web2py works very well (http://www.transicion.mx).

But I have to serve also php pages (especifically a joomla site). The 
joomla instalation is in /www/joomla.

In the root of /www I have the web2py directory and I use these files (also 
in /www):

*dispatch.fcgi*:
#!/usr/bin/python
import sys 
from flup.server.fcgi_fork import WSGIServer 
import gluon.main 
application=gluon.main.wsgibase 
## or 
# application=gluon.main.wsgibase_with_logging 
WSGIServer(application).run() 

*and* *.htaccess:*
AddHandler fcgid-script .fcgi 
Options +FollowSymLinks  +ExecCGI 
RewriteEngine On 
RewriteBase / 
RewriteRule ^dispatch\.fcgi/ - [L] 
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] 

How Can I to serve php files in my site?

Thanks for the help

-- 

--- 
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: serving php and python in shared hosting

2013-02-05 Thread José Eloy
Any idea?

-- 

--- 
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: serving php and python in shared hosting

2013-02-06 Thread José Eloy

Maybe the solution is add a new RewriteRule, but I don't be an expert in 
apache configuration. Any idea? 

-- 

--- 
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: serving php and python in shared hosting

2013-02-09 Thread José Eloy
Please!

Nobody can help me? I'm desperate to solve this problem. How can web2py 
work together con php apps? (in this case joomla).


-- 

--- 
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: serving php and python in shared hosting

2013-02-11 Thread José Eloy
Thanks to all for your help. I'll share with you all my progress.

Well, first I created a subdomain: 
http://www.administracionjoomla.transicion.mx. In /www I created a folder 
called joomla, inside I copied all the joomla instalation. For access 
joomla site I had to go http://www.administracionjoomla.transicion.mx/joomla. 
The first time i wanted access the joomla site the web browser send me a 
Invalid Request message. Then I rename the htaccess.txt file (in joomla 
folder) to .htacess. I pressed the F5 key again and voilá! the joomla site 
worked!. But, after pressed several times the F5 I got again: Invalid 
Request. I opened an ssh terminal and wrote: ps ax, and I got a lot of of 
dispafth.fcgi instance running, I kill them and pressed F5 in my web 
browser and the joomla site worked again.

I still have many questions...

Why I have a lot of dispatch.fcgi process? I noted the number of this 
process increase every time the web2py app is invoked.

Does anybody have an answer?

P. D. Sorry for my English. Is not very well

-- 

--- 
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: serving php and python in shared hosting

2013-02-13 Thread José Eloy
Thanks howesc 

Do you have an idea where to learn to configure these processor threads in 
Apache?

Regards

-- 

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




[web2py] Re: serving php and python in shared hosting

2013-02-15 Thread José Eloy
Thanks howesc. I'll read these documents.

Regards.

-- 

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




[web2py] php and web2py together in shared hosting

2013-06-20 Thread José Eloy
Hello!

This question was made by me several months ago. The matter is simple: How 
to serve php apps and web2py apps from the same shared hosting? In my case 
I'm using Hostgator. The web2py app is in the root of the domain (\www 
folder), the php is in a sub URL (from \www\phpAppFolder), but when I 
request the php app I always get "Invalid Request". I think web2py is 
always catching the request and the php apps never is executed. 

Somebody can help me?

Thanks in advanced.


-- 

--- 
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: php and web2py together in shared hosting

2013-06-21 Thread José Eloy
I'll try this. I hope it works. Later I say you if I have success.

Regards

-- 

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




[web2py] Deploying in Windows server and SSL (no IIS)

2016-01-07 Thread José Eloy

Hi there!

How I can deploy a web2py app using Windows and SSL? Is it OK if I use the 
rocket web server included in Web2py? I'm thinking in use Open SSL because 
I'm not using the IIS web server, also I'm thinking in create a self signed 
certificated, the app is running in a intranet.

I´ve downloaded and installed OpenSSL (using a binary from 
http://slproweb.com/products/Win32OpenSSL.html). I have the web2py source 
folder, and my app is working correctly using http. What else do I need to 
start?

Thanks ind advanced.
P. D. (Sorry for my bad english, I hope you can understandme)

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-08 Thread José Eloy
Thanks Niphlod for your answer.

I'm very newbie creating SSL certificates. How can create my first 
certificate using OpenSSL in PEM format?

Thanks in advanced

-- 
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] Error No module named copy_reg after upgrading web2py

2016-01-14 Thread José Eloy
Hi there!

I upgrade my web2py source folder (2.9.6) with the most recent version 
(2.13.4), but when I run my application I get the error: No module named 
copy_reg. Mi app was running well before the upgrade. I´m runnig my app in 
Windows Server 2008 R2. The upgrade was made using the administrative 
interface and copy/paste the new version over the old version.

How I can to fix this error?

Regards.

Sorry for my bad english!  I hope you can understandme.

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-19 Thread José Eloy
Thanks Niphlod for your answer, sorry by my delay in answering. 

I was trying running my app using the Rocket Web Server and https. I 
created the cerfificate as you indicate me and all is working well, but I 
noted the app is slow returning the html views.

I've reading that is better to use web2py behind IIS or Apache to serve web 
pages. I'm using Windows Server 2008 and IIS 7.5. Now I've deploying my 
application in Windows and IIS reading the instructions of cap 9 of manual. 
The app is working well and better, the html pages are loading faster, but 
How can I create a certificate SSL autosigned using IIS and Web2py?

Regards.

My English is not very well, I hope you can understand me.

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-19 Thread José Eloy
Thanks again for the help.

I coud create my own certificate, but I have a dude: The standard port for 
SSL is 443 and my application runs using the port 8001, How I have to 
configure the port in IIS and web2py?

Regards.

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-20 Thread José Eloy
Then, How I should run web2py? 

python web2py.py -a 'yourpassword' -i IP

without port?


Regards

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-20 Thread José Eloy
Niphlod: You are right! IIS is now serving my web2py pages! Thanks!

A question: If I create a directory under wwwroot (let's say web2pyapps) 
and move my web2py app, I readed the manual and say this:

   - move the code to a subfolder named web2pyapps
   - create a routes.py file with routers = dict(BASE=dict(path_prefix = 
   "web2pyapps")) in it
   - inside the IIS Manager, locate the web2pyapps folder, right click on 
   it and select "Convert to Application"

But if I run my app I get error 500. Is maybe an error with the web.config 
file? I understand this file must is in the same folder that web2py.py

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-20 Thread José Eloy
Richard:

Could you show me how to generate my own Certificate Authority and my own 
certificate?

Regards

-- 
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: Deploying in Windows server and SSL (no IIS)

2016-01-21 Thread José Eloy
SOLVED:

Niphlod:
I copied the web2py folder inside C:\inetpub\wwwroot

And then I created a new Web site, with main folder in 
C:\inetpub\wwwroot\web2py with https and port 443 and with a SSL 
certificate auto signed and vualá! my site is running.

Thanks for the help.

-- 
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] Opening PDF files in web browser

2014-07-22 Thread José Eloy
Hello!

I've developed an application that allows users to upload document files 
(doc, pdf, xls) and then download them. The problem is when the user wants 
download the files the web browser always opens a window to ask where to 
download them (or the file is downloaded in the download folder). In the 
case of doc and xls files is fine, but would it be possible that the pdf 
files will open directly in the web browser?. To upload/download the files 
I use the standard way of web2py. This problem occurs with Firefox, Safari, 
Chrome, IE 10. The version of web2py I use with the application is the 
1.99.7.

I hope you can understand me, my english is not very good.

Thanks ins advanced.

Regards

José Eloy Torres

-- 
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] Cannot resolve reference error

2014-09-09 Thread José Eloy
Hi!

I'm developing an web2py application that use an external SQL Server 
database. I can connect to the SQL Server database using  migrate=False in 
those tables I need to access. In addition I create my own tables from 
web2py (also they connect to SQL Server). My troubles begin when one of my 
tables (created with web2py) intents to connect with the external database. 
When I try to connect I get the "cannot resolve reference" error.

Below I show the significant code of my application:

In db.py:
db = DAL('mssql://connection to SQL Server database created with web2py') 
db2= DAL('mssql://connection to External SQL Server database')

# Table personal_personal is external (was not created with web2py, it's 
not complete, only show the most important)

db2.define_table('personal_personal',
 Field('foto_personal', 'blob', notnull=False),
 Field('firma_personal', 'blob', notnull=False),
 Field('id_personal', 'id', requires=IS_NOT_IN_DB(db2, 
'personal_personal.id_personal'), unique=True, notnull=True), #Primary key, 
not auto-increment
 Field('id_categoria', db2.personal_catalogo_categoria, 
requires = IS_IN_DB(db2, db2.personal_catalogo_categoria.id_categoria, 
'%(id_categoria)s'), notnull=True),
 Field('id_areataller', db2.mtto_areataller, requires = 
IS_IN_DB(db2, db2.mtto_areataller.id_areataller, '%(id_areataller)s'), 
notnull=False),
 Field('id_area', 'reference general_area.id_area', 
requires = IS_IN_DB(db2, db2.general_area.id_area, '%(id_area)s - 
%(nombre)s'), notnull=True),
 Field('id_depto', 'reference 
general_departamentos.id_depto', requires = IS_IN_DB(db2, 
db2.general_departamentos.id_depto, '%(id_depto)s - %(descripcion)s'), 
notnull=False),
 Field('cant_hijos', 'integer', notnull=False),
 Field('status_foto', 'integer', notnull=False),
 Field('status_firma', 'integer', notnull=False),
 Field('porcent_ret_descuent', 'integer', notnull=False),
 
Migrate=False)

Below personal_personal is defined the following table:

db.define_table('unidades',
Field('nombre', requires=IS_NOT_EMPTY()),
Field('descripcion'),
Field('tipo_unidad', db.tipo_unidades),
Field('operador', 'reference 
db2.personal_personal.id_personal', requires = IS_IN_DB(db2, 
db2.personal_personal.id_personal, '%(nombre)s')),
format='%(operador)s'
)

The 'operador' field reference the table personal_personal.

In a controller I have the following code:

def nueva_unidad():
form=SQLFORM(db.unidades, submit_button="Aceptar")
if form.accepts(request.vars, session):
redirect(URL(r=request, f='nueva_unidad'))
response.flash = 'Se ha creado una nueva unidad'

return dict( form=form)

When I call this function is when I get the error: 
 'Cannot resolve reference 
db2.personal_personal.id_personal in unidades definition'


How can I to correct this error? Any Idea?

Thanks in advanced.

Regards.



-- 
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: Cannot resolve reference error

2014-09-10 Thread José Eloy
Thanks Niphlod for the answer.

I didn't know that was not possible to reference tables from a database to 
another. The solution to this is to move the required tables to the 
external database.

Regards.

-- 
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] Accesing table from external database

2014-09-17 Thread José Eloy
Hello!

I need to populate a combobox in a FORM (or SQL FORM) with the content of a 
field of a table which is in an external SQL Server database. I know that 
is not possible to reference an external database using DAL, but how can I 
to load the content of the external field in a SQLFORM field (combobox)?

Any idea?

Regards.

-- 
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: Accesing table from external database

2014-09-19 Thread José Eloy
Thanks Brian and Carlos for the answer and sorry for my delay.

"external database" means it's a database not created by Web2py. The matter 
is I'd like to reference a web2py table with another table from the 
"external database". I know that this is not possible, but what could be 
the best way to load a combobox (using a SQLForm) with data from a field 
from that external database?

I hope you can understand me, my english is not very good.

Regards.

-- 
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: Accesing table from external database

2014-09-20 Thread José Eloy
Thanks for all answers.

I put an example about I want to do:

In db.py I define 2 databases:

db= DAL('mssql://SQL SERVER DATABASE')  #db is a SQL Server database 
doesn't created with web2py
db2 = DAL('mssql://SQL SERVER DATABASE') #db2 is a SQL Server database 
created with web2py

#Below are some of the tables I need:
db.define_table('personal_personal',
 Field('id_personal', 'id'), # Primary key, not 
auto-increment
 Field('nombre', 'string', length=40, 
requires=IS_LENGTH(40), notnull=False),
 migrate=False 
 )  
 
db2.define_table('unidades',
Field('nombre', length=100, requires=IS_LENGTH(100), 
notnull=False),
Field('descripcion', length=250, requires=IS_LENGTH(250), 
notnull=True),
Field('operador'),
format='%(operador)s'
)

In a controller I have the following code:

def nueva_unidad():

form=SQLFORM(db2.unidades, submit_button="Aceptar")

if form.accepts(request.vars, session):
redirect(URL(r=request, f='nueva_unidad'))
response.flash = 'Se ha creado una nueva unidad'

return dict(form=form)

I wish to load the content of field nombre (table personal_personal) in the 
field operador of the table unidades. Is this possible?

Please excuse my english, is not very good.

Regards

-- 
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] SQLFORM.factory deletable field

2014-10-07 Thread José Eloy
Hello!

Is it possible to implement a SQLFORM.factory deletable field? I can't to 
use the normal SQLFORM because I'm using keyed tables.

The SQLFORM.factory I'm using is:

   form= SQLFORM.factory(
Field('nombre', requires=[IS_NOT_EMPTY(), IS_UPPER(), 
IS_NOT_IN_DB(db2, 'unidades.nombre')]),
Field('descripcion', label="Descripción", requires=IS_UPPER()),
Field('tipo_unidad', requires=IS_IN_SET(unidades_list), default= 
tipo_unidad, unique=True),
Field('operador', requires=IS_IN_SET(operarios_list), 
default=operador_unidad, unique=True),
submit_button = 'Aceptar')

I'd like to implement the deletable=true functionality, it means, that 
appears the deletable checkbox and if it is marked to delete the record.

Is this possible? How can I do this?

Regards.

P. D. Sorry for my english, is not very well.

-- 
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.factory deletable field

2014-10-07 Thread José Eloy
Thanks Leonel.

That's is working well.

Regards


El martes, 7 de octubre de 2014 16:50:27 UTC-5, José Eloy escribió:
>
> Hello!
>
> Is it possible to implement a SQLFORM.factory deletable field? I can't to 
> use the normal SQLFORM because I'm using keyed tables.
>
> The SQLFORM.factory I'm using is:
>
>form= SQLFORM.factory(
> Field('nombre', requires=[IS_NOT_EMPTY(), IS_UPPER(), 
> IS_NOT_IN_DB(db2, 'unidades.nombre')]),
> Field('descripcion', label="Descripción", requires=IS_UPPER()),
> Field('tipo_unidad', requires=IS_IN_SET(unidades_list), default= 
> tipo_unidad, unique=True),
> Field('operador', requires=IS_IN_SET(operarios_list), 
> default=operador_unidad, unique=True),
> submit_button = 'Aceptar')
>
> I'd like to implement the deletable=true functionality, it means, that 
> appears the deletable checkbox and if it is marked to delete the record.
>
> Is this possible? How can I do this?
>
> Regards.
>
> P. D. Sorry for my english, is not very well.
>
>

-- 
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: Opening PDF files in web browser

2014-10-23 Thread José Eloy
Sorry for my delay in answer. I've taken back the project.

The solution of Leonel works well if I want to show an pdf from another 
website, but when I try to download a file loaded in my own web site 
(Web2py's upload/download method) I get the message that the file is not 
found.

I show you the table definition:

db.define_table('enlacesweb_documentos',
Field('categoria', db.categorias_documentos),
Field('nombre'),
Field('documento', 'upload', 
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('fecha', 'date'),
Field('descripcion_documento', 'text'),
Field('muestra_en_portada','boolean'),
Field('imagen_portada', 'upload', 
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('texto_imagen_portada', label="Texto de la imagen en 
portada"),  
format='%(categoria)s')


As you see I'm using an subfolder inside uploads folder.

The download function, serving swf, pdf and another type of files:

def download():
"""
allows downloading of uploaded files
http:///[app]/default/download/[filename]
"""
   
import os
   
if (request.args(0) or '').endswith('swf'):
   
response.headers['Content-Disposition'] = ''
filename = os.path.join(request.folder, 'uploads', request.args(0))
   
return response.stream(open(filename,'rb'))
   
elif (request.args(0) or '').endswith('pdf'):

filename=os.path.join(request.folder, 'uploads', request.args(0))
response.headers['ContentType'] ="application/pdf"
response.headers['Content-Disposition']="inline; filename.pdf" + 
filename
   
return response.stream(open(filename), chunk_size=65536)   

else:
return response.download(request,db)


The elif section works well with external pdf to show, but for those 
uploaded with Web2py's upload method I get the error the pdf is not found, 
if I omit the elif and use the else I can to download the pdf file, but I 
want the web browser open it.

I hope you can understand me. 

How to fix this?

Thanks in advanced.

-- 
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: Opening PDF files in web browser

2014-10-23 Thread José Eloy
Hello.

I've discovered if I use

return response.download(request, db, attachment=False) 

in the else statement of the download function of my code, I can do the web 
browser can open the pdf file, but I miss the original filename. How I can 
to recover it?

Regards.

-- 
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: Opening PDF files in web browser

2014-10-24 Thread José Eloy
Any Idea?

Regards

-- 
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] DAL upper() in SQL Server

2014-10-28 Thread José Eloy
Hello!

How can I to save fields in uppercase mode using SQL Server? I know that 
the DAL have the upper() method, but I don't understand how can I to use it.

Regards.

-- 
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: DAL upper() in SQL Server

2014-10-30 Thread José Eloy
Thanks Leonel for your answer.

Finally I resolved this using the python's upper() method apply to the 
variables before to save the record.

Thanks anyway.

Regards.

El martes, 28 de octubre de 2014 12:36:23 UTC-6, José Eloy escribió:
>
> Hello!
>
> How can I to save fields in uppercase mode using SQL Server? I know that 
> the DAL have the upper() method, but I don't understand how can I to use it.
>
> Regards.
>
>

-- 
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] SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
Hi!

I have a SQLFORM.factory that define a SELECT. I want multiple=False, but 
is it not working. I can select one o more elements.

Code:

1.form = SQLFORM.factory(
2.Field('numero', requires=IS_NOT_EMPTY()), 
3.Field('fecha', 'datetime', requires=IS_NOT_EMPTY()),
4.Field('gasto', requires= IS_IN_SET(gastos_list, 
multiple=False), widget=lambda field, value: 
SQLFORM.widgets.multiple.widget(field, value, size=20)), 
5.Field('unidad', requires=IS_NOT_EMPTY()),
6.Field('unidades_asignadas'),
7.Field('operador', requires=IS_IN_SET(operarios_list)),
8.Field('carta', requires=IS_NOT_EMPTY()),
9.Field('importe ($)', 'decimal(15,2)', 
requires=IS_NOT_EMPTY()),
10.  Field('observaciones')
   )

Originally the line 4 was:
Field('gasto', requires= IS_IN_SET(gastos_list)),

But this produce an dropdown combo, instead, I want a SELECT, but with 
multiple=False 

Any Idea? I'm using web2py 2.9.6

Regards.

Regards

-- 
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.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
Thanks Anthony

But if I use options I get a dropdown combo, instead I want a SELECT. Is 
this possible?

Regards

-- 
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.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
Anthony

With options I mean SQLFORM.widgets.options.widget. I checked and 
discovered that using either SQLFORM.widgets.options.widget or 
SQLFORM.widgets.multiple.widget I get an html select element. My question 
is how to create a SELECT (no dropdown) with multiple=False. I want to 
select only an element of the list.

Sorry for my english, is not very well

Regards.


-- 
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.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
(SOLVED)

Anthony:

Thanks for your ideas. Finally I solved this:

Code:

1. form = SQLFORM.factory(
2.Field('numero', requires=IS_NOT_EMPTY()),  
3.Field('fecha', 'datetime', requires=IS_NOT_EMPTY()),
4.Field('gasto', requires= IS_IN_SET(gastos_list, 
multiple=(0,1))),
5.Field('unidad', requires=IS_NOT_EMPTY()),
6.Field('unidades_asignadas'),
7.Field('operador', requires=IS_IN_SET(operarios_list)),
8.Field('carta', requires=IS_NOT_EMPTY()),
9.Field('importe ($)', 'decimal(15,2)', 
requires=IS_NOT_EMPTY()),
10.  Field('observaciones'), 
11.  table_name="form_numeros",
12.  _id="form_numeros"  # id form
13.   )

multiple=(0,1) was the solution.

And with a little help of jQuery I get the SELECT appears like a combo box.

In the view:


jQuery(function(){

jQuery('#form_numeros_gasto').attr({   //form_numeros_gasto is the 
id of the SELECT
size:20
});
});


Why I need a combobox with multiple=False?, Well, is for aesthetics.

Regards.

-- 
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] loading grid ajax and redirect

2014-11-07 Thread José Eloy
Hello!

I'm having troubles to load an SQLFORM grid in an ajax component and then 
redirect to another whole page.

First, the controller:

This controller create a FORM and send it to the view. Once the user press 
the submit button, is loaded a grid .

def consulta_por_numero_tipo_asunto():

# Se crea la parte fija del form
variable_form=DIV(
LABEL('Escribe un número de asunto ', 
_for="input_numero_asunto"),
INPUT(_type="text", _name="numero_asunto", _value="", 
_id="input_numero_asunto", _class="buscar"),
FIELDSET(
LEGEND("Rango de fechas",
LABEL('del', _for="del"),
INPUT(_type="text", _name="del", _id="del", 
_value="", _class='date'), # _class="date" hace que se utilice el widget 
date de SQLFORM
LABEL('al', _for="al"),
INPUT(_type="text", _name="al", _id="al", 
_value="", _class='date'),  # _class="date" hace que se utilice el widget 
date de SQLFORM
) # fin LEGEND
) # fin FIELDSET
,_id="numero_y_rango") # fin DIV

form = FORM(variable_form, _id="form_buscar_por_numero_asunto") #fin 
FORM

# Se crea la parte variable del form compuesta por la lista de los 
tipos de gastos guardados en la base de datos
gastos=db2(db2.gastos).select(orderby=db2.gastos.nombre)

tipos_gastos_list=[]

for g in gastos:
tipos_gastos_list += [INPUT(_type="checkbox", _name="lista_gastos")]
tipos_gastos_list += [" " + g.nombre]
tipos_gastos_list += [" (" + g.abreviatura +")"]
tipos_gastos_list += [BR()]
  
variable_form.append(FIELDSET(LEGEND('Selecciona tipo de asunto', 
DIV(tipos_gastos_list, _id="l_gastos"), _for="l_gastos")))

variable_form.append(INPUT(_type="submit", _name="enviar", 
_value="Enviar"))

if form.validate():
pass

return dict(orm=form)

The view(consulta_por_numero_tipo_asunto.html):

{{extend 'layout.html'}}


{{=form}}



Resultados de la búsqueda





jQuery('#form_buscar_por_numero_asunto').submit(function() {

var valor_num_asunto= jQuery("#input_numero_asunto").val();

ajax('{{=URL('default', 
'busca_consulta_por_numero_tipo_asunto')}}',['numero_asunto'], 
'tabla_resultados_busqueda');

return false;
});


This function load the SQLFORM grid:

def busca_consulta_por_numero_tipo_asunto():
 
num_asunto=request.vars.numero_asunto

 grid = SQLFORM.grid(db2.numeros_asunto, selectable = lambda ids : 
redirect(URL('default', 'modificar_numero_asunto', args=ids), 
extension=False, client_side=True))

return dict(grid=grid)

This code works well, but when the user select a row of the grid, the grid 
MUST to redirect to another page, but, reload the same page 
consulta_por_numero_tipo_asunto.html

Can anyone help me? I would be very grateful.

Regards

-- 
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] Query of two dates sql server

2014-11-17 Thread José Eloy
Hi!

I'm having troubles in making a query with 2 dates in SQL Server 2005.

First, my table definition:

db2.define_table('tabla_datos',
Field('na', requires=IS_NOT_EMPTY()), 
Field('fecha', 'datetime', requires=[IS_NOT_EMPTY(), 
IS_DATETIME(format=T("%d/%m/%Y %H:%M:%S"), error_message='Debe ser 
DD-MM- HH:MM:SS!')]),
Field('ta', db2.tipos_de_asunto),
Field('unidad',  requires=IS_NOT_EMPTY()),
Field('operador'),
Field('carta', requires=IS_NOT_EMPTY()),
Field('importe', 'decimal(15,2)', requires=IS_NOT_EMPTY()),
Field('observaciones') 
)

In my controller I receive from a form (via ajax) two dates for searching 
in the database:

def busca_consulta():

num_asunto = request.post_vars.input_na   
desde = request.post_vars.input_desde   # User write a date using 
the Web2py widget. Format: %d/%m/%Y (time is not necessary)
hasta = request.post_vars.input_al   # User write a date 
using the Web2py widget. Format: %d/%m%Y (time is not necessary)

rows= db2(((db2.tabla_datos.fecha>=desde) & 
(db2.tabla_datos.fecha<=hasta)) & (db2.tabla_datos.na==num_asunto)).select()
 
but I get error, Is it necessary to convert the variables "desde" and 
"hasta" to datetime? How can I convert them?

I've checked the SQL Server datetime format, the datetime is saved in the 
records using the following format: %Y-%d-%m %H:%M:%S. I live in Mexico, 
the format we use is: %d/%m/%Y %H:%M:%S

My english is not very good, I hope you can understand me.

Regards.

-- 
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] jquery ui dialog icon

2014-12-10 Thread José Eloy
Hello!

I'm using jquery ui 1.11.2 in my web2py application. I put the jquery ui 
folder at /static/jquery-ui-1.11.2.custom, then I import the library and 
the css in the layout.html file using:

  
   

When I use the dialog widget, the dialog shows well, but the X of the 
window is not shown. Is it necessary to modify the paths of the images in 
the css file of jquery ui?

Regards.

PD: Sorry for my english, is not very good.

-- 
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: jquery ui dialog icon

2014-12-11 Thread José Eloy

I've discovered that is not only the icon is not displayed, but other 
controls aren't themed correctly, by example the buttons. Is web2py css 
blocking the jquery ui css?

What's the better way to include jquery ui in web2py?

Regards.

-- 
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] jquery ui theming

2014-12-11 Thread José Eloy
Hello!

What's the correct way to include jquery ui in my web2py application? 
Actually I use the following:

  
   

after   {{include 'web2py_ajax.html'}} in layout.html

But, if I use the dialog widget the buttons are not themed, and the X of 
the dialog doesn't appear.

I downloaded jquery ui (themed) and copied at 
/static/jquery-ui-1.11.2.custom.

Where is the error?

Thanks for any help.

Regards

-- 
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: jquery ui dialog icon

2014-12-12 Thread José Eloy
Thanks Derek for your suggestion.

Finally I've resolved this mistery! Only I had to put the lines:


 

below to: 

  
  

These lines are near the end of layout.html.

The icon and the theme are now displayed correctly.

-- 
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: jquery ui theming

2014-12-12 Thread José Eloy
Thanks Wewe for your answer.

I'm very novice with bootstrap, but I'd like to learn it.

Finally I've resolved this mistery. Only I put the lines:


 

below to: 

  
  

These lines are near the end of layout.html.

The X icon and the theme are now displayed correctly.

-- 
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] None in deletable field label

2014-12-17 Thread José Eloy
Hi there!

When I use a SQLFORM update/delete form, always appear the "None" text at 
the end of the delete_label. Why? No matter the text I write, it is always 
ending in None. I'm using web2py 2.9.6. The default language of my app is 
spanish.

Thanks in advanced.


-- 
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] variable query

2015-01-27 Thread José Eloy
Hello!

I need to build a variable query to select rows from a database. I need to 
get the last 11 records from my database, but only the even.

This the code of the controller:

# Muestra los últimos 11 artículos 
limite_articulos = 11

# Getting the max id of the table:
maxID = 
db(db.articulos).select(db.articulos.id.max()).first()[db.articulos.id.max()]
# Getting the maxID-11
limite_bajo = maxID-limite_articulos

cuenta=0
even_query = ""

for i in range(limite_bajo,maxID):
cuenta+=1
if cuenta%2==0: # only the even records are saved
#print str(i) + " es " + str(cuenta)
query_par += "(db.articulos.id=='" + str(i) + "') | "
   
even_query = query_par[:-2]

The resulted even_query is as follows:
  even_query= (db.articulos.id=='2297') | (db.articulos.id=='2299') | 
(db.articulos.id=='2301') | (db.articulos.id=='2303') | 
(db.articulos.id=='2305')

I use the resulted string in a query:
articulos = db(even_query).select(db.articulos.id, db.articulos.titulo, 
db.articulos.contenido, db.articulos.autor,orderby=~db.articulos.id) 

But, I get the following error:
*class 'gluon.contrib.pymysql.err.ProgrammingError'> (1064, u"You have an 
error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near '=='2297') | 
(db.articulos.id=='2299') | (db.articulos.id=='2301') | (db.articulo' at 
line 1")*
If I write the query directy I don't get the error:
articulos = db((db.articulos.id=='2297') | (db.articulos.id=='2299') | 
(db.articulos.id=='2301') | (db.articulos.id=='2303') | 
(db.articulos.id=='2305')).select(db.articulos.id, db.articulos.titulo, 
db.articulos.contenido, db.articulos.autor, orderby=~db.articulos.id) 

The database is SQL Server 2005, Web2py 1.99.7.

How can to write a variable query? 

Thanks for any help. Regards.

P. D. I know my english is not very well, I hope you can understand me.

-- 
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: variable query

2015-01-28 Thread José Eloy
Thanks Leonel and Anthony for your answers.

Leonel:  Your solution works well if the id are consecutive (this fail if 
user delete a record). 

Antony: Your solution sounds well, but, How I can build the query 
dinamically as you propose? Can you write an example?

Regards.


-- 
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] Passing python string to javascript

2015-01-28 Thread José Eloy
Hello!

How can I pass a python string to javascript? I know how to pass an integer 
variable to javascript.

Example:

def pass_variable():
variable = 25
return dict(variable=variable)

In the view:

   var v={{=variable}};
   console.log(v);


If I pass a integer variable, javascript receive it well, but if I pass a 
string, javascript doesn't recognize it. 

Now, let's assume that we use variable = "HOLA"

I get the error: (using Firefox console)
---
ReferenceError: HOLA is not defined
var v = HOLA;
---
What am I doing wrong?

Regards.

-- 
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: Passing python string to javascript

2015-01-29 Thread José Eloy
Thanks guys for your answer.

Making var v="{{=variable}}" was the solution.

I didn't know the ASSIGNJS helper. Is not in the manual. It would be great 
if is included.

Regards.

-- 
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: variable query

2015-02-02 Thread José Eloy
Sorry for my delay in answer.

Anthony:

Your solution works well:

db(db.articulos.id.belongs(list_of_ids)).select()

Creating a list of ids and using belongs was the correct for me.

Thanks guys for the help.

-- 
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] Options selected in form

2015-02-13 Thread José Eloy
Hi there!

I'm facing troubles with my application. I need to create a dynamic set of 
options (SELECT-OPTION) from a database table. When the user push the 
submit button of a form I need to know what options were selected. I Would 
like to know this from the controller, not from javascript

Part of code in my controller:

# Get the options from a table (field nombre)
tipos_de_asunto = 
db2(db2.tipos_de_asunto).select(orderby=db2.tipos_de_asunto.nombre)

tipos_asuntos_list = []  # I use a list to save the options

   # Looping the resulted set of query 
for g in tipos_de_asunto:
#  I Create checkbox
tipos_asuntos_list += [INPUT(_type="checkbox", 
_name="lista_tipos_asunto", _class="checkbox", _value=g.id, )]

# I create the text of the checkbox
tipos_asuntos_list += [" " + g.nombre]
tipos_asuntos_list += [" (" + g.abreviatura + ")"]
tipos_asuntos_list += [BR()]

# I create the form (update form)
form = SQLFORM(db2.auth_user, administrador, submit_button="Aceptar", 
deletable=True, showid=False, formstyle='divs', _id='form_administrador')

# I create an variable that contains form elements and the options of a 
SELECT (tipos_asuntos_list)
checkboxes_tipos_asunto = DIV(
DIV(
LABEL("Tipos Asunto:", 
_for="listado_tipos_asuntos_administradores"),
_class="w2p_fl"
),
DIV(
DIV(tipos_asuntos_list, 
_id="listado_tipos_asuntos_administradores"),
_class ="w2p_fw"
),
DIV(_class ="w2p_fc")
)

# I insert the variable checkboxes_tipos_asunto and the content of list 
tipos_asuntos_list
form[0].insert(6, checkboxes_tipos_asunto)   # 6 is because I insert 
other form elements, not shown in this code

if form.validate():
 ?

The big question: How I know what options were selected?

I had thought in use the form.elements with the name of the options, 
but I get all the options without knowing what were selected:

elementos=form.elements('[name=lista_tipos_asunto]')
for e in elementos:
 print e

 RESULT OF PRINT:



















Any help will be appreciated.

Regards.

-- 
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: Options selected in form

2015-02-16 Thread José Eloy
Hi!

Thanks Richard for your answer.

I've solved my problem. Only I needed to ask if elementos is checked:

if form.validate():
...
elementos = form.elements(_name="lista_tipos_asunto")

for e in elementos:
if e['_checked']=='checked':
   print e['_value']

With this I know if a option is checked

Regards

-- 
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] no email field in auth_user

2015-02-16 Thread José Eloy
Hello!

I'm wonder if it is possible to disable (or remove) the field email from 
auth_user. In my application I don't need it.

Thanks for any help.

Regards.

-- 
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: no email field in auth_user

2015-02-17 Thread José Eloy
Thanks Anthony.

I did this:

db2.auth_user.email.readable = db2.auth_user.email.writable = False

(db2 is the DAL variable)

But, When I fill my form and the email field is empty I get the error "Too 
short". Really I don't want the email field. How can I fix this?

Regards.

-- 
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: no email field in auth_user

2015-02-17 Thread José Eloy
Anthony: 

Here's how I did it (db.py):

auth = Auth(db2)

auth.settings.extra_fields['auth_user'] = [
  Field('tipo_asunto', 'list:reference tipos_de_asunto'),
  Field('modificar_numero_asunto', 'boolean'),
  Field('cancelar_numero_asunto', 'boolean'),
  Field('capturar_nuevas_unidades', 'boolean'),
  Field('acceso_configurar_sistema', 'boolean'),
  Field('capturar_num_asunto_cualquier_unidad', 'boolean'),
  Field('modificar_carta_porte', 'boolean'),
  Field('unidades_asignadas', 'list:reference unidades')
]

auth.define_tables(username=True, signature=False)

db2.auth_user.email.readable = False
db2.auth_user.email.writable = False

Should I use a custom auth_user table?

Regards.

-- 
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: no email field in auth_user

2015-02-18 Thread José Eloy
Thanks guys for your answers:

I'm using a standard SQLFORM to create my form:

form = SQLFORM(db2.auth_user, submit_button="Aceptar", deletable=True, 
showid=False, formstyle='divs', _id='form_administrador')

Where is the problem?

-- 
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: no email field in auth_user

2015-02-23 Thread José Eloy
Thanks guys for all the help.

I checked my program again and now it works:

db2.auth_user.email.readable = False
db2.auth_user.email.writable = False

were the solution. The email field is not shown as I did wish. My fault, I 
was checking the password field! (sorry, I was confused).

Regards.

-- 
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] manually update password

2015-02-23 Thread José Eloy
Hello!

I have an auth_user form with extra fields. To update a record I use a 
SQLFORM and the update command of DAL instead of the standard update way of 
SQLFORM. How can I manually update the password field? I receive the actual 
password from request.vars.password, but I don't know how to save this 
value in the database.

I'm using Web2py 2.9.6.

Thanks for any help.

Regards.

-- 
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: manually update password

2015-03-30 Thread José Eloy
Sorry for the delay in answering.

I have the following code for modify the auth_user table:

administrador = db2.auth_user(request.args(0)) or 
redirect(URL('ver_administradores'))
form = SQLFORM(db2.auth_user, administrador, submit_button="Aceptar", 
deletable=True, showid=False)  # update SQLFORM

if form.validate():
 
nombre = request.vars.first_name
apellidos = request.vars.last_name
usuario = request.vars.username
myPassword = request.vars.password # I received the password 
field of the form
...
  

db2(db2.auth_user.id==id_administrador).update(first_name=nombre, 
last_name=apellidos, username=usuario, 
password=db2.auth_user.password.validate(myPassword)[0], ..) 

I need to save the password using the update method. 
How can I know if the user change the password or if the password is the 
same? How can I save it? Is it correct to use 
password=db2.auth_user.password.validate(myPassword)[0]?

Regards.


-- 
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: manually update password

2015-04-01 Thread José Eloy
Hello Niphlod

*Because I've *modified* the presentation of the form (I use check boxes to 
represent multiselect box) and save another variables that they aren't  
part of the form.*

All I need is to know how to recover the password value and save if this 
changed.

Regards.



-- 
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] Show remainig time in session

2015-07-25 Thread José Eloy
Hello!

What's the best way to show the user the remaining time of the session? By 
default the session time will be 1 hour.

Thanks in advanced.

José Eloy.

-- 
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] Using form.element to show hide form element

2015-08-27 Thread José Eloy
Hi!

Is it possible to use form.element to show/hide form elements?

I'd like to use:
form.element("#id_element")['_show'] = True
to show an element
or 
form.element("#id_element")['_show'] = False
to hide an element

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.


[web2py] Re: Using form.element to show hide form element

2015-08-29 Thread José Eloy
Thanks Anthony for your answer.

Yes, I want to show/hide elements dinamically based in values of other 
fields, I know I can do this using javascript or css, but I'd like to use 
form.element. Is it possible?

Regards.

-- 
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: Using form.element to show hide form element

2015-08-29 Thread José Eloy
Hi Anthony. 

I understand. Thanks for telling me about conditional fields, I'll try them.

Regards.

-- 
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] Deleting files

2021-03-05 Thread José Eloy

Hi there.

I made a Web2py app. This app create pdf reports, which are opened by the 
Web Browser. The pdf files are saved in Download folder of the user. Is 
there any way to delete these files from Download directory? I tried 
several ways and I get   [WinError 5] Denied 
access:in  'c:\\Users\\x\\Downloads' . The app runs behind IIS server.

The code i'm using in a controller is:

sistema = platform.system()
if sistema == "Windows":
rutaDescargas = Path(r"c:\Users\\Downloads")

archivosRecibos = rutaDescargas.glob("*.pdf")
for archivo in archivosRecibos:
os.remove(archivo)

xxx represents the name of user on compuer user

The app is running in a small office, in internal network, no Internet 
server.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/32e5d178-fe8c-40a0-88a0-6807bfeb5210n%40googlegroups.com.


Re: [web2py] Re: Opening PDF files in web browser

2014-10-23 Thread José Eloy Torres Monreal
Sorry for my delay in answer. I've taken back the project.

The solution of Leonel works well if I want to show an pdf from
another website, but when I try to download a file loaded in my own
web site (Web2py's upload/download method) I get the message that the
file is not found.

I show you the table definition:

db.define_table('enlacesweb_documentos',
Field('categoria', db.categorias_documentos),
Field('nombre'),
Field('documento', 'upload',
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('fecha', 'date'),
Field('descripcion_documento', 'text'),
Field('muestra_en_portada','boolean'),
Field('imagen_portada', 'upload',
uploadfolder=os.path.join(request.folder,'uploads/docs_y_normatividad')),
Field('texto_imagen_portada', label="Texto de la
imagen en portada"),
format='%(categoria)s')


As you see I'm using an subfolder inside uploads folder.

The download function, serving swf, pdf and another type of files:

def download():
"""
allows downloading of uploaded files
http:///[app]/default/download/[filename]
"""

import os

if (request.args(0) or '').endswith('swf'):

response.headers['Content-Disposition'] = ''
filename = os.path.join(request.folder, 'uploads', request.args(0))

return response.stream(open(filename,'rb'))

elif (request.args(0) or '').endswith('pdf'):

filename=os.path.join(request.folder, 'uploads', request.args(0))
response.headers['ContentType'] ="application/pdf"
response.headers['Content-Disposition']="inline; filename.pdf"
+ filename

return response.stream(open(filename), chunk_size=65536)

else:
return response.download(request,db)


The elif section works well with external pdf to show, but for those
uploaded with Web2py's upload method I get the error the pdf is not
found, if I omit the elif and use the else I can to download the pdf
file, but I want the web browser open it.

I hope you can understand me.

How to fix this?

Thanks in advanced.



2014-07-22 14:11 GMT-05:00 Leonel Câmara :
> You need to change your download for PDFs controller, this would work if you
> don't use uploadseparate (which I usually do) :
>
> def download_pdf():
>   filename=request.args[0]
>   path=os.path.join(request.folder,'uploads', filename)
>   response.headers['ContentType'] ="application/pdf"
>   response.headers['Content-Disposition']="inline; filename.pdf"
> +filename
>   return response.stream(open(filename), chunk_size=65536)
>
> --
> 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/uu7Bd7aSVLQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/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.