Re: [web2py] Re: Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-11 Thread AlighaThor
Sorry for my delay. Thanks both Anthony and Richard for your excellent 
explanations!

Well, I changed for now to DB sessions. The settings mentioned by Anthony 
about renewing sessions are great, I did'nt know that. Anyway I still found 
that DB handling is by far easier/scalable/performant to me. :)

About locking sessions, I see there is a "locked" boolean field in the 
sessions table. What's stands for? I mean, I expect that it has something 
to do with sessions locking, but when and where it is triggered?

Thanks again guys!

-- 
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: Updated Version of web2py and sending emails stopped working

2018-04-04 Thread AlighaThor
Hi. Could you post the entire ticket?

-- 
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] Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-04 Thread AlighaThor
Well, I will stick with DB sessions from now.

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] Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-03 Thread AlighaThor
Hi. I'm experimenting for the first time (but I'm quite a bit old using 
this amazing framework :)) storing sessions in the DB instead the 
filesystem, as I always did. I'm monitoring those two behaviours and 
somehow it feels (at least for me) that the DB session handling is far away 
more efficient/manteinable than the filesystem session handling.

Look at this:

*When using the filesystem handling:*

1 - I go to my login form. A session file is created (for the form key I 
suposse.).





2 - Then I finally log in. Another session file is created.




3 - Next I log out. A new file is created or somehow "moved" or "deleted" 
from the directory "165".



4 - Next I log in again. This time my form action did not create any new 
file, but a new one after the log in.




5 - Everything is repeated again. I log out, then a new file is created.


*Now let's see the DB behaviour:*


1 - Login form. A session record is created.





2 - I log in. The same record remains, but instead, as we expect, the 
unique_key is updated.



3 - I log out. Again, the record remains and the unique_key field is 
updated.






Whatever I do, only one record is stored according my session origin (IP, 
Browser, etc) and this remains true until my session expires or is deleted.

Maybe I'm talking nonesenses, but it is feel "better" to me, having a "true 
one instance per session", using the DB, that many files/folders created 
over and over again related to the same origin using the filesystem.

What I am missing here? 
Is this the normal/expected behaviour when the default FS session handling 
is used? 
Can we consider that is more performant using the DB alternative that the 
FS one?

BTW: It seems that the admin option to "cleanup" only clear the sessions 
store in the filesystem, not the DB alternative.

Thanks for reading!

-- 
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: prevent multiple session at the same time

2018-04-03 Thread AlighaThor
I would do not perform the database check in every request (and I think 
Massimo did'nt mean that :)), only during the the second (or more) attempt 
to log in with the same user. 

Let's say you have the X user logged in. You stored the uuid in the 
auth_user.uuid field as mentioned. Then in another session there is an 
attempt to log in with those same credentials. You generate a second uuid, 
and validate that new uuid against the older store in the user record..

If the auth_user.uuid field is blank, there have been no session with that 
user. So you proceed to log in.
If it exists, but it is different from the stored one, the user is already 
logged in, so you must prevent the second one.

-- 
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: ImportError with packages in site-packages.

2018-03-29 Thread AlighaThor
And yes...I restarted the server several times without any effect. The same 
ImportError excepction.

-- 
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: ImportError with packages in site-packages.

2018-03-29 Thread AlighaThor
Hi. Thanks for anwser. Well, I was trying to import "requests" in 
PythonAnywhere. I found that they have it pre-installed (I did'nt know). 
So, problem solved by now. I could'nt import the standalone request package 
inside site-packages or the app specific "modules" directory neither.

El jueves, 29 de marzo de 2018, 13:39:16 (UTC-5), Leonel Câmara escribió:
>
> The application's modules folder is the last place the importer looks 
> that's why you get the error there. Have you restarted web2py after putting 
> requests in the site-packages folder? 
>

-- 
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] ImportError with packages in site-packages.

2018-03-29 Thread AlighaThor
Hi! I'm stuck importing packages within site-packages (the web2py one). I'm 
trying to import the Request library:

<https://lh3.googleusercontent.com/-bpxPLoNuSI4/Wr0LyHehBvI/JNI/zU-6SjpYCkUx_2gfuzcGMg6ovKRcI-6ygCLcBGAs/s1600/Selecci%25C3%25B3n_001.jpg>


Ticket ID

127.0.0.1.2018-03-29.10-43-13.c356e4d3-44b6-4b74-a896-d0da7de9d0b1
 (ImportError("Cannot import module 
'applications.myapp.modules.requests'",), )Versión
web2py™ Version 2.16.1-stable+timestamp.2017.11.13.23.50.07
Python Python 2.7.12: 
/home/alighathor/Documentos/python-virtual-envs/web2py/bin/python2.7 
(prefix: /home/alighathor/Documentos/python-virtual-envs/web2py)Rastreo

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File 
"/home/alighathor/Documentos/Desarrollo/web2py/web2py/gluon/restricted.py", 
line 219, in restricted
exec(ccode, environment)
  File 
"/home/alighathor/Documentos/Desarrollo/web2py/web2py/applications/myapp/controllers/default.py"
 <http://localhost:8000/admin/default/edit/lista_negra/controllers/default.py>, 
line 7, in 
    import requests
  File 
"/home/alighathor/Documentos/Desarrollo/web2py/web2py/gluon/custom_import.py", 
line 104, in custom_importer
raise ImportError(e1, import_tb)  # there an import error in the module
ImportError: (ImportError("Cannot import module 
'applications.myapp.modules.requests'",), )


I don't get why is telling me is trying to import from 
*applications.myapp.modules.requests*, when the package is not even there.

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: Django guys get a job easily. Why don't web2py guys get a job? How to get a job?

2017-10-19 Thread AlighaThor
Well, a year has past...but anyway, here comes my appreciation:

I agree with Massimo. Companies that ask for Django (or whatever X 
technology) developers, it is because maybe there are some constraits with 
that particulary tool. In my humble opinion:

   - They already have systems in that X technology, and they want to 
   extend/migrate/support those systems.
   - They already have an expert (or used to) team in that X techonology.
   - Also maybe they are small and startups companies with little knowing 
   of software development or trends, and they fall in that "popularity 
   story". Windows is by far more popular than Linux. Does that makes it 
   better? I think no, in fact, recently I migrated totally from Windows to 
   Linux Mint and I have never being so happier in my life (in software 
   development term ;) )
   
So, as a conclussion for my two cents, I really suggest that in your CV you 
need to emphasize that you are "Python Web developer", or even better, just 
a "Web developer." Later in your skill sections sumarize your technologies, 
your tools, etc.

I really think that 2 + 2 must be 4 no matter the procedure involved. 
That's the idea of being a web developer.

Greetings and good luck.

El domingo, 6 de marzo de 2016, 2:02:58 (UTC-5), Mike Stephenson escribió:
>
> I am in a very pathetic situation. I know web2py but now I realise 
> learning Django would have been better. Am I wrong?
>

-- 
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 specific migrations files per sqlite database in same app

2017-10-15 Thread AlighaThor
Yep...that worked. In the meantime I did this per table definition:

def migration(table):
return '{0}/{1}.table'.format(tenant_folder, table)

#In the tables definitions
...
migrate=migration('buildings')


That worked, but I like your clarification more. Thanks mate.

El domingo, 15 de octubre de 2017, 11:23:53 (UTC-5), Bernhard Radermacher 
escribió:
>
> Not sure if that's the issue, but first you should use os.path.join to 
> join every part:
>
> os.path.join(request.folder, 'databases', 'clients', 
> 'client_{0}'.format(tenant))
>
> otherwise you introduce a OS dependency.
>
> I would try 
>
> con='sqlite://' + os.path.join(request.folder, 'databases', 'clients', 
> 'client_{0}'.format(tenant))
> db=DAL(con, pool_size)
> i.e. using the complete, absolute path.
>
>

-- 
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 create specific migrations files per sqlite database in same app

2017-10-12 Thread AlighaThor
Hi everyone. I'm experimenting with an multi-tenant app. My goal is to use 
a sqlite file per tenant (the tenant data). I have a main sqlite file where 
I have defined the auth tables and a Client (tenant) table.

The structure I'm looking for is something like this, where inside a 
tenant folder there should be the migrations files and the sqlite db (in 
this example I only got working the sqlite db creation, not the migrations 
files):




So, I have two DB models, one for the main database and the second for the 
tentant DB. The tenant model loads a variable wich contains the identifier 
of the requested tenant, so It should create the sqlite file and generate 
the migrations files.


My problem is that I want specific migrations files per database, not the 
same .table files for every sqlite db. So, I'm trying (whitout success) to 
generate the migration files inside the tenants folders. The sqlite db is 
created without problems, but the following example does not:


In the tenant model:






So, whatever path I put in the folder argument of the DAL's constructor, I 
get a time out exception. I don't know why. I've tried relative paths, 
joining the os.path with the request.folder, nothing works. Also the error 
I'm getting is a time-out exception, so I don't know what is the conflict, 
because according to the book, the folder parameter is "where .table files 
will be created". If "folder" is empty or not defined, it works, but as I'm 
saying, I would like specific migrations files per tenant database. 

It this possible? What's wrong?

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 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 start web2py.py

2017-09-03 Thread AlighaThor
Nevermind..my bad. The problem seems to be that I have pyDAL installed 
globally (for other purposes besides web2py) and it's conflicting with the 
pyDAL's version inside web2py. I created an virtualenv and now It's solved.

Thanks anyway.

-- 
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 start web2py.py

2017-09-03 Thread AlighaThor
Hi. Latest build 2.15.4. I got this while starting web2py.py.

Traceback (most recent call last):
  File "web2py.py", line 21, in 
import gluon.widget
  File 
"/home/alighathor/Documentos/Desarrollo/web2py/web2py/gluon/__init__.py", 
line 38, in 
from .dal import DAL, Field
  File "/home/alighathor/Documentos/Desarrollo/web2py/web2py/gluon/dal.py", 
line 17, in 
from pydal.migrator import Migrator, InDBMigrator
ImportError: cannot import name InDBMigrator

I'm running from Linux Mint 18.1 with Python 2.7.12. So? I tested with a 
previous build, I think 2.15.2 and it worked. However with 2.15.3 and 
2.15.4 I got this issue. 

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] What do you think about Orator?

2017-08-19 Thread AlighaThor
Hey guys! I recently have been working with Laravel (yes, I know, this is a 
group about web2py, but please, keep reading). I used to hate PHP and all 
things related to it, but thanks to Laravel now I have a love-hate 
relation, so it's a kind of improvement, :)

Personally one of the things I love more about Laravel is its Eloquent ORM. 
I think is great.

But my beloved one always wil be web2py, Python, PyDAL and so on. I just 
googled "Eloquent ORM python equivalent" and voilá...there is one. It's 
called Orator. So, have any of you saw this? 

PyDAL is awesome. But Orator/Eloquent has its magic too. One of the things 
that impress me about it is the no need to define fields in the models. 
Yes, of course there must be an initial schema and that is accomplished by 
migrations. As we know PyDAL does migrations for us and that's good. In 
fact, actually in my Laravel projects I'm using PyDAL for create my schema, 
because I find a bit hard using the Laravel's migrations or I'm not used 
to, and already I'm used to the PyDAL way.

But another thing that I find cool it's the way to deal whit relations 
across models. I don't know whow Django or AlchemySQL does with this, but 
Orator makes it simple, fluent, and flexible. I also don't know about 
performance issues, but hey, that's why I opened this post to see if 
someone of you guys have criterias or comparission topics about this matter.

Thanks in advance! ¡Have a nice day!

-- 
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 web2py dying?

2016-11-17 Thread AlighaThor
Thanks for your quick reply.

By the way, with 4 years of experience, why not start contributing too
>

Exactly for that reason I asked this. I'm really thinking about request 
being a contributor. I want do my best efforts for this awesome technology 
and I dont want it to die.

-- 
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 web2py dying?

2016-11-17 Thread AlighaThor
I'm a web2py developer with 4 years of experience. This framework 
introduced me in web development in general. I really thanks web2py for 
that.

Now, my question is: Is web2py dying? The last release I got is from May, 
2016. Is it's development, let's sayslower??

-- 
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 propagate a web2py enviroment to several test modules?

2016-07-27 Thread AlighaThor
Hi. Here's my question:
¿How do I propagate my web2py enviroment to several test modules?
Following this recipe  im 
starting doing TDD with web2py.

My problem is that Im organizing my test cases in several modules, so im 
only executing my main test runner:

*-S bodega -M -R applications/bodega/tests/run_tests.py*

So, in the module run_tests.py im discovering my test modules with PyTest:

import pytest

pytest.main('applications/bodega/tests')


That's it. The problem is that in my test files Im unable to "see" the 
web2py globals variables. So, ¿How do I propagate it to them?

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] Extending the completation support from IDEs for DAL objects

2014-06-06 Thread AlighaThor


Hello to the community.

 

I want to share with you a simple tool I created to extend the capabilities 
of completion of the DAL code. So far I've only tested PyCham. Experiment 
with other IDEs and tell me. 

 

Given the dynamic nature of Python and how web2py defines the tables, it 
becomes impossible (or very difficult) for the IDE to know the structure of 
these (tables names, fields, etc..). Based on the dummy code in gluon / 
__init__.py to activate the completion code, we can show to the IDE 
objects that exist only at runtime, such as tables and fields of the DAL. 

 

Well, suppose we have the following table: 

 

db.define_table ('student', 

Field ('name'), 

Field ('age', 'integer'), 

Field ('career') 

) 

 

We want the IDE to recognize its structure. Here are the steps: 

 

1.   Copy the package wood in the models directory.


2.   The module zwood.py is the wood activator. Follow the instructions 
explained there. 


3.   Run the appadmin of the app. If all went well, a new python 
module should appear in wood, named prefix_aliases.py. The dummy module 
contains code that simulates the structure of the tables and fields of the 
DAL. 


4.   Comment out the line db = DAL() in gluon.__init__.py to avoid 
possible conflicts. 

5.   Comment / replace db = DAL (...) line by the exec db = DAL (...) 
equivalent sentence, to avoid possible conflicts.


6.   Finally, create a model and insert the following: 

if 0: 

wood.prefix_aliases from import * 

 

7.   Where prefix is the value entered in step 2. 

 

Done. If all went well, the completion should work. 

 

I hope you like it.

-- 
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.