[web2py] Content-Type for generic.json

2010-11-08 Thread olivier
According to RFC 4617 (http://www.ietf.org/rfc/rfc4627.txt),
"The MIME media type for JSON text is application/json."

Community seems to agree:
http://stackoverflow.com/questions/477816/the-right-json-content-type

However, in 'generic.json' Content-Type is set to 'text/json'
>> response.headers['Content-Type']='text/json'

Is there any reason for the type to be set as 'text'?
Is there any wide-spread client framework that requires 'text/json'
content-type?
If not, shouldn't it be modified to stick to standard?

(one of the reasons I ask is because JSONView, a FF addon, will
apparently only work for 'application/json' responses;  and this is
nice to have when developing with lots of AJAX)


[web2py:27719] Re: Default CRYPT() is unsecure

2009-07-31 Thread olivier

> I'd prefer some less-predictable salt than the suggestion below,  
> though. How about the old Unix passwd trick of choosing a some random  
> salt, and appending the salt in plaintext to the hash?

we could do that, without braking backward compatibility i think...
- store password in the following format:   hashtype$salt
$passwordhash  (with '$' separators, pretty standard stuff...)

to authenticate user:
- add a special case:   if no hashtype:  passwordhash -> md5$
$passwordhash
- use hashtype(password + salt),  for most of the standard hashtypes
(md5, sha1, sha256, ...)
(- do other weird stuffs...  like add a special hashtype bottiger,
bottiger$$passwordhash   will use the function md5( f(password) ) , f
being a deterministic function ) ;-)

we could add a special attribute for migration. if set to True, then
storage is migrated from the old format to the new format when user
logs in
the length of the salt can also be a parameter (if you really want to
play with some trade-off between storage/security, bad idea)

i can work on that, if it makes sense to you guys

 -olivier

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:28022] Template syntax for comments

2009-08-05 Thread Olivier

Hi,

I'd like to know how to comment blocks of code in web2py templates.

{# COMMENT #} does not work
and
{{""" COMMENT """}} works partially: simple comments works but not if
there are code syntax.

I didn't find anything on this subject in the documentation.

By the way, I didn't find anything about the template engine in the
documentation (except in the paid book).

Thank you,

--
Olivier
Developer
OpenERP - Tiny sprl
Web: http://www.openerp.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:28303] Re: Template syntax for comments

2009-08-10 Thread Olivier

On Aug 5, 3:57 pm, mdipierro  wrote:
> You can comment individual lines {{#}}. To comment an a multiline
> block {{""""""} should work. What problem do you have with it?

If there are '{{}}' syntax in the comments, an error is thrown:

Traceback (most recent call last):
  File "/home/oli/work/dev/python/web2py/web2py/gluon/restricted.py",
line 176, in restricted
ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
  File "/home/oli/work/dev/python/web2py/web2py/applications/wiki/
views/default/index.html", line 66
"""\n[ {{response.write(A('search', _href=URL(r=request,
f='search')))\nresponse.write(' ]\n"""}}\n\n',escape=False)
\n"""\n  vi: ft=htmljinja\n"""\nresponse.write('\n\n  
\n  \n\n\n  \n\nCopyright
© 2009 -\nPowered by web2py\n\n  \n
\n  \n\n  \n\n',escape=False)
 
^
SyntaxError: invalid syntax

--
Olivier
Developer
OpenERP - Tiny sprl
Web:http://www.openerp.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:28707] Re: Template syntax for comments

2009-08-15 Thread Olivier

On Aug 10, 11:33 pm, mdipierro  wrote:
> {{ and }} have precedence over everything else in the views. This
> means you cannot have }} in comments. This is by design because it
> reduces the scope of the possible errors you can have. If you have
> a }} in a comment you need to add a space in between as in } }
> > Web:http://www.openerp.com

OK. Thanks for the answer.

--
Olivier
Developer
OpenERP - Tiny sprl
Web:http://www.openerp.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:31210] custom auth method

2009-09-17 Thread olivier

For legacy reasons, I will have to use a custom auth method...

I need to have a custom function to check password at login time.
(basically, I have htpassword-like stored in a field "password_http"
in the auth_user table.
I therefore need a custom login function: hash password obtain form
the login form and check if matches db.)

What is the best to ensure that auth is done properly in that context?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:31853] API for web2py projects

2009-09-29 Thread olivier

i would like to setup an authenticated API for my web2py project.
how could i use a custom login_methods to authenticate user through
basic http authentication?
it seems that 'login_bare' doesn't use auth.settings.login_methods?

thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:31899] Re: API for web2py projects

2009-09-30 Thread olivier

thanks for the answer, Massimo.

for legacy reason, the password i have in the db are stored as apache
passwords
(...because those passwords are also used to authenticated user for
different services using apache [svn, wiki, etc...])

i therefore developed a custom login method (added to
auth.settings.login_methods) which can check provided credentials
against those stored passwords.
i was wondering if it was possible to use this custom method for basic
http auth also (but it seems that login_bare only does "web2py"
authentication right?)

what i mean by this is that login_methods is very useful for
developing custom auth methods INSIDE web2py (not only restricted to
third party auth provider) and i believe this could be extended so
that the login_bare function also allows for custom auth methods.

what do you think?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:31986] Re: Security advice

2009-10-01 Thread olivier

hi mr.freeze,

I believe this is not secure
The entire purpose of storing hashes of password is to protect against
database exploitation.
If some part of your db is publicly revealed, it doesn't mean that
passwords are revealed (because hash functions are "one way
functions").

In your proposition here, it seems to me you will allow anyone with
access to the hashed password to authenticate correctly: the password
hash becomes the password which you are now storing in cleartext in
the database.

If it actually solves your "secure authentication" problem, it goes
back to "secure password storage" problem.

As mentioned by Massimo here under, it is similar to assuming that
server does not store password already hashed.


I believe you are aware of this but I though I mention it for the
record! ;-)



On Sep 30, 3:10 am, "mr.freeze"  wrote:
> Perhaps I misunderstand.  Here is my plan:  When the login page is
> requested, the server will generate a random token, store it somewhere
> (session most likely) and send it to the client.  The user then enters
> their password which is hashed using the jQuery plugin.  The hashed
> password is concatenated with the token then hashed again.  The result
> is transmitted to the server.   To authenticate, the server pulls the
> password hash from the database, the hashed token from wherever it was
> stored (probably the session), concatenates them and generates a hash
> which is compared to the hash from the client.  Neither the password
> nor the password hash are ever transmitted.
>
> Does that seem secure?  The only weak spots are registration and
> password changes I think.
>
> On Sep 29, 7:43 pm, mdipierro  wrote:
>
> > Basic concepts in digital identity are message integrity, non-
> > repudiation, and confidentiality.
>
> > The point using SSH/HTTPS is that it performs a key exchange using
> > public key encryption and that critical to confidentiality (the
> > password and information cannot be stolen in transit). Public key
> > allows the two parties to agree on one encryption key without ever
> > transferring that key. After this initial exchange all communications
> > are encrypted, including the transmission of the password.
>
> > Hashing (MD5, SHA, HMAC, etc) is a critical ingredient of integrity
> > (together with encryption, it allow you to detect, if data has been
> > tampered with). Hashing does nothing to protect your password in
> > transit. You may as well send it in the clear.
>
> > That jQuery plugin does not help at all the problem of transmitting
> > the password.
>
> > There are places where you get a free ssl certificate.
>
> > Massimo
>
> > > I'm going to try this:http://plugins.jquery.com/project/sha256
>
> > > On Sep 29, 6:18 pm, mdipierro  wrote:
>
> > > > If not running over http session.secure() will prevent sessions from
> > > > working and login will not work.
>
> > > > hashing with a salt can easily be attacked.
>
> > > > Massimo
>
> > > > On Sep 29, 6:11 pm, "mr.freeze"  wrote:
>
> > > > > Reddit seems to send a clear text password but Digg and a few others
> > > > > seem to be hashing on the client using a token salt before sending.
> > > > > I'm too cheap to pay for a unique IP and SSL so I will try that
> > > > > first.
>
> > > > > Question: Does session.secure do anything useful when *not* running
> > > > > over https?
>
> > > > > On Sep 29, 4:50 pm, mdipierro  wrote:
>
> > > > > > I did not notice and that is bad.
>
> > > > > > If your app uses authentication you should have
>
> > > > > >      session.secure()
>
> > > > > > and use HTTPS. The latter line will not accept sessions cookies
> > > > > > without HTTPS.
>
> > > > > > Massimo
>
> > > > > > On Sep 29, 4:28 pm, "mr.freeze"  wrote:
>
> > > > > > > What are sites like reddit.com doing to secure their logins?
> > > > > > > Anything?  The login request goes over http according to firebug. 
> > > > > > >  I'm
> > > > > > > just wondering if my wiki site needs https for login or http is
> > > > > > > acceptable or if there is another trick I can use.
>
> > > > > > > Thanks!
> > > > > > > Nathan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:36085] wsgi and http_authorization

2009-11-27 Thread olivier
I am using web2py build-in server for development and basic http auth
works fine!
However, when pushing the code on my server (on which my provider
propose to use wsgi...) it is not working anymore.  :-(
On the server, I checked the "request.env", "http_authorization" is
indeed missing.

I confess I am a fcgi/wsgi ignorant ;-)  Any help on that side?
Is anyone using basic http authorization?

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py] update_or_insert doesn't always return the corresponding row id

2011-12-30 Thread olivier
The "insert" method returns the id of the inserted row.
The "update_or_insert" method returns the id of the inserted row, but
returns None in case of an update...

Why is it so?

I have a case in which I want to update_or_insert and then further
update the corresponding row (to track the status of a long running
process).
I would rather have the method to always output the id of the updated/
inserted row...
Or is there any use-case you would like to discriminate between the
fact you inserted or update a row?

What do you think?

  -Olivier


>From dal.py (I added the proposed modification)
===

def update_or_insert(self, key=DEFAULT, **values):
  if key==DEFAULT:
record = self(**values)
  else:
record = self(key)
   if record:
record.update_record(**values)
newid = None  #--> why not record['id'] 
   else:
 newid = self.insert(**values)
   return newid


[web2py] SQLFORM.smartgrid | linked_tables with

2011-11-10 Thread olivier
Hi here!

I am experimenting with the smartgrid. Very nice time-saving feature
which reminds me why I love web2py! ;-)
(I believe there is still no doc about grid and/or smartgrid?)

I have a problem with linked_tables.

The model looks like this:

db.define_table('person',Field('name'))
db.define_table('relationship',
   Field('personA', db.person),
   Field('relationship_type'),
   Field('personB', db.person)
)

When I use
g = QLFORM.smartgrid(db.person, linked_table=['relationship'])
the action buttons generated include a 'relationship' button twice...
(which makes sense)

Can I avoid this replication? (I am only interested in showing the
existence of a relationship)
Is it possible to have a merge of those two button which will access
all relationships for that person, regardless of the fact it is a
personA or personB in that relationship?

I believe I can go with a custom link here, but I was wondering if
there was a quicker way to achieve this.

I can wait for the 4th version of the book... I had to leave
developing with web2py for a few months and I can no more catch up
with all the amazing new features!  ;-)

Many thanks,

  Olivier







[web2py] can web2py "internal webserver" handle serveral requests in parallel?

2011-03-21 Thread olivier
I plan to use web2py as a simple desktop app service (using the
packaged web2py for windows).
Will the web server (I don't know which server ships in the stand
alone version) handle several requests in parallel if I use ajax calls
to several controller functions?

I am wondering if this could be an easy way to launch different
webcrawls from a page - by hitting a controller function with
differents parameters - and easily scale the app by leveraging the
multiprocess/multithread aspect of the web server. Am I assuming
something wrong here?

Thanks!



[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-22 Thread olivier
thanks for the answer.
I will follow your advice!

On Mar 22, 6:59 pm, Ross Peoples  wrote:
> To answer simply, yes the embedded Rocket server will handle
> multiple simultaneous requests. However, if you have long-running processes,
> they may force Rocket to wait until they are finished before responding to
> additional requests. This is easy to overcome by using Python's multiprocess
> module. For example, I have a script to batch insert a bunch of records into
> the database. The script takes about a minute to run and is started by an
> ajax call. So in web2py, I created a scripts.py module and imports
> multiprocessing, then subclasses the Process class.
>
> When the ajax call comes in, web2py instantiates my script module, then
> calls run() to start a new process that does all the work. The moment that
> run() is called, execution continues so that other incoming requests can be
> handled and the script runs in the background. Just for fun, I also made my
> script report progress so that another ajax call could get the status of it.


[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-23 Thread olivier
Thanks for the clarification on session behavior.
I tried to unlock the session (or to forget it) in the controller but
it seems requests from the same user are still handled sequentially.
Is it possible to have the same user request two pages at the same
time or am I missing something?


On Mar 22, 8:27 pm, Massimo Di Pierro 
wrote:
> web2py does not know whether the session is going to change or not so it 
> locks even if does not save it. To change it call session._unlock(request)
>
> On Mar 22, 2011, at 2:18 PM, Anthony wrote:
>
> > On Tuesday, March 22, 2011 2:39:45 PM UTC-4, Massimo Di Pierro wrote:
> > The only caveat is that - unless you unlock them - session are locked.
> > Therefore the same user cannot request two pages at the same time.
> > This in order to guarantee data integrity in sessions.
>
> > With the new changes in 1.94.5, is the session file still locked for every 
> > request, even if nothing is saved to the session, or does it only get 
> > locked if something is actually saved/changed?
>
> > Thanks.
>
> > Anthony
>
>


[web2py] Re: can web2py "internal webserver" handle serveral requests in parallel?

2011-03-25 Thread olivier
Thanks for all the answers.

To summarize:
- session will lock unless the controller calls session._unlock() or
session.forget()
- database locking may also occur

In my case, when calling (ajax) the same controller function with
different parameters, the requests would be handled sequentially.
Add a "session.forget()" at the begin of the controller function, it
seemed to me the requests were still handled sequentially, BUT it
wasn't the case!
The reason why is simple: my controller function makes a call to the
Google Analytics API and... those requests are not handled
concurrently! :-(
(Google Analytics has some weird limitation quotas, limiting to 4
concurrent calls per IP address | see here if interested:
http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html#quota
)
For small size api requests (for which the answer from the Google
Analytics server is response is fast), it works but for large requests
(which is my case), it seems Google Analytics doesn't always handle
those 4 requests concurrently! There is the origin of the confusion.

So, no bug on the web2py side!
I checked it: Rocket is able to handle concurrent request from the
same user, if session and db connections are not locked.

Thank everyone again for all the answers and insight!
Lesson of the day: don't take Google's word for granted when saying
their API handles 4 requests concurrently... :-(





On Mar 24, 4:59 pm, John Heenan  wrote:
> On Mar 22, 7:37 am, olivier  wrote:
>
> > I plan to use web2py as a simple desktop app service (using the
> > packaged web2py for windows).
> > Will the web server (I don't know which server ships in the stand
> > alone version) handle several requests in parallel if I use ajax calls
> > to several controller functions?
>
> Depends on what you mean by parallel.
>
> In normal terms, that is if you are not depending on some state or
> property that requires use of artifically managed parallel
> transactions, the answer is yes.
>
> Why not just test and see?
>
> There are practical limits. A severe practical limit comes form the OS
> overhead in using a thread for each web2py request to a controller
> function.
>
> The mentioned session and database locking issues are of course also
> relevant. Just beacuse a session or database locks occurs does not
> mean the request fails. They are just one more place queues or locks
> occur. IO (input-output) OS (operating systems) queues or locks are
> very common and are hidden.
>
> I hope this adds a bit more insight.
>
> John Heenan


[web2py] webfaction python2.5 -> python2.6

2011-05-06 Thread olivier
hi there,

I have an old installation of web2py on webfaction.  It is using
mod_wsgi 2.5 and Python 2.5.4
How can I a upgrade to python 2.6? (I need it for some modules I plan
to use)
Should I start a new installation from scratch or is there a simpler
way to migrate to mod_wsgi 3.3 and Python 2.6?

Thanks in advance!


[web2py] admin access under gunicorn on Heroku

2013-05-02 Thread olivier
Hi,

I'm trying to deploy on Heroku, using gunicorn.
My Procfile looks like this:

   web: python anyserver.py -s gunicorn -i 0.0.0.0 -p $PORT

Everything works well, but I can not access the admin app, because no 
password is set.
Does anyone know how I can set an admin password?

Thanks a lot!

Olivier

-- 

--- 
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: Removing Foreign Key constraint?

2013-07-12 Thread Olivier Johner
It's ok for the foreign key but when you archive records in another 
database, all fields comes in "big int" and raise a value error for string 
fields

ValueError: invalid literal for long() with base 10: 'v6 box spearmint'


Le dimanche 16 juin 2013 10:28:26 UTC+2, Massimo Di Pierro a écrit :
>
> This should now be fixed in trunk. Please check it.
>
> On Thursday, 6 June 2013 08:19:35 UTC-5, Lamps902 wrote:
>>
>> To clarify, due to the SQL Foreign Key constraint (which is retained when 
>> archive tables are created through auth.enable_record_versioning), some of 
>> the archive database's tables still retain an association with the 
>> auth_user table's id field. However, the rows with the ids on which the new 
>> tables depend may not necessarily be transferred from the application's 
>> primary database to the archive database. Is there a way to use the DAL to 
>> remove the Foreign Key constraint? Thanks.
>>
>

-- 

--- 
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: Removing Foreign Key constraint?

2013-07-15 Thread Olivier Johner
I propose this patch


Le vendredi 12 juillet 2013 14:08:21 UTC+2, Olivier Johner a écrit :
>
> It's ok for the foreign key but when you archive records in another 
> database, all fields comes in "big int" and raise a value error for string 
> fields
>
> ValueError: invalid literal for long() with base 10: 'v6 box spearmint'
>
>
> Le dimanche 16 juin 2013 10:28:26 UTC+2, Massimo Di Pierro a écrit :
>>
>> This should now be fixed in trunk. Please check it.
>>
>> On Thursday, 6 June 2013 08:19:35 UTC-5, Lamps902 wrote:
>>>
>>> To clarify, due to the SQL Foreign Key constraint (which is retained 
>>> when archive tables are created through auth.enable_record_versioning), 
>>> some of the archive database's tables still retain an association with the 
>>> auth_user table's id field. However, the rows with the ids on which the new 
>>> tables depend may not necessarily be transferred from the application's 
>>> primary database to the archive database. Is there a way to use the DAL to 
>>> remove the Foreign Key constraint? Thanks.
>>>
>>

-- 

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


diff --git a/gluon/dal.py b/gluon/dal.py
index af20494..7671cd7 100644
--- a/gluon/dal.py
+++ b/gluon/dal.py
@@ -8307,8 +8307,11 @@ class Table(object):
 field_type = self if same_db else 'bigint'
 clones = []
 for field in self:
+fk = False
+if field.type.find('reference') != -1:
+fk = True if not same_db else False
 clones.append(field.clone(
-unique=False, type=field.type if same_db else 'bigint'))
+unique=False, type=field.type if (same_db or not fk) else 
'bigint'))
 archive_db.define_table(
 archive_name, Field(current_record,field_type), *clones)
 self._before_update.append(

[web2py] Re: Removing Foreign Key constraint?

2013-07-16 Thread Olivier Johner
Just a little modification and all is right.

Le lundi 15 juillet 2013 16:21:13 UTC+2, Massimo Di Pierro a écrit :
>
> I made some simplification to your patch. Please check it in trunk. Thank 
> you!
>
>
> On Monday, 15 July 2013 03:51:39 UTC-5, Olivier Johner wrote:
>>
>> I propose this patch
>>
>>
>> Le vendredi 12 juillet 2013 14:08:21 UTC+2, Olivier Johner a écrit :
>>>
>>> It's ok for the foreign key but when you archive records in another 
>>> database, all fields comes in "big int" and raise a value error for string 
>>> fields
>>>
>>> ValueError: invalid literal for long() with base 10: 'v6 box spearmint'
>>>
>>>
>>> Le dimanche 16 juin 2013 10:28:26 UTC+2, Massimo Di Pierro a écrit :
>>>>
>>>> This should now be fixed in trunk. Please check it.
>>>>
>>>> On Thursday, 6 June 2013 08:19:35 UTC-5, Lamps902 wrote:
>>>>>
>>>>> To clarify, due to the SQL Foreign Key constraint (which is retained 
>>>>> when archive tables are created through auth.enable_record_versioning), 
>>>>> some of the archive database's tables still retain an association with 
>>>>> the 
>>>>> auth_user table's id field. However, the rows with the ids on which the 
>>>>> new 
>>>>> tables depend may not necessarily be transferred from the application's 
>>>>> primary database to the archive database. Is there a way to use the DAL 
>>>>> to 
>>>>> remove the Foreign Key constraint? Thanks.
>>>>>
>>>>

-- 

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


diff --git a/gluon/dal.py b/gluon/dal.py
index d510711..f72b103 100644
--- a/gluon/dal.py
+++ b/gluon/dal.py
@@ -8307,7 +8307,7 @@ class Table(object):
 field_type = self if same_db else 'bigint'
 clones = []
 for field in self:
-nfk = same_db or field.type.startswith('reference')
+nfk = same_db or not field.type.startswith('reference')
 clones.append(field.clone(
 unique=False, type=field.type if nfk else 'bigint'))
 archive_db.define_table(

[web2py] GRID export broken for CSV but not for JSON

2016-02-12 Thread olivier hubert

I implemented a clone of Notifier application from Massimo.
If I try to export data from the grid via the grid bottom button I receive 
an error if I use export to CSV, HTML & TSV but not with JSON or XML.

*default.py*
@auth.requires_login()
def tasks():
db.task.created_on.readable = True
db.task.created_by.readable = True
db.task.title.represent = lambda title, row:A(title, _href=URL(
'view_task', args=row.id))
query = (db.task.assigned_to==me)|(db.task.created_by==me)
grid = SQLFORM.grid(query,
orderby=~db.task.modified_on,
create=False,
details=False,
editable=False,
deletable=lambda row: (row.created_by==me),
fields=[
db.task.status,
db.task.title,
db.task.created_on,
db.task.deadline,
db.task.created_by,
db.task.assigned_to
])
return locals()

*Traceback*

 Traceback (most recent call last):
 File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 227, 
in restricted
 exec ccode in environment
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>, 
line 134, in 
 File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, in 

 self._caller = lambda f: f()
 File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, in 
f
 return action(*a, **b)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>, 
line 31, in tasks
 db.task.assigned_to
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
in grid
 raise HTTP(200, oExp.export(), **response.headers)
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
in export
 self.rows.export_to_csv_file(s, represent=True)
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 2412, in export_to_csv_file
 value = field.represent(value, record)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>, 
line 17, in 
 db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 90, in __getattr__
 raise AttributeError
AttributeError


The error come from the bellow code line from the file default.py
db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))

If I remove the previous row the export function work for all format but I 
lose the cliquable link on the task title.

I checked with the Notifier application available on GitHub 
https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
see the same problem.

If you can help me it's very appreciate.

Kind regards
Olivier



-- 
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] extra_fields can't showed in auth_user db.

2014-09-07 Thread olivier hubert
I use the web2py version 2.9.8.
I create a simple new app "test_auth"

In Models I add "my_tables.py" with the contents below.

# -*- coding: utf-8 -*-

#Add authentication to the app.
from gluon.tools import Auth

auth = Auth(db, hmac_key=Auth.get_or_create_key())


*#Add some fields in auth_user table to have a complete user 
profile.*auth.settings.extra_fields['auth_user']= [
Field ('phone_number', 
'string'),
Field ('address', 'text'),
Field ('city', 'string'),
Field ('zip', 'string'),
Field ('phone', 'string'),
Field ('birthday', 
'date', requires = IS_DATE 
(format=('%d-%m-%Y')))]
auth.define_tables(username=True, signature=True)

I open the page http://127.0.0.1:8000/test_auth/default/user/register

The form doesn't show my extra field.

After a successful user registration, I open the db admin to see the record in 
the table "auth_user", but I can't see my extra fields.

I already try session cleanup, free cookies, create a new app, ... see and try 
some tricks from this forum or stack overflow. I probably miss something but I 
can't see what.

-- 
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: Appadmin redirect after upgrading to 2.9.7

2014-09-07 Thread olivier hubert
I encounter exactly the same issue if you try to open the db administration 
page in a app.

Le dimanche 7 septembre 2014 01:19:31 UTC+2, Luciano Laporta Podazza a 
écrit :
>
> Same issue :(, as mentioned before, tried testing default apps and my app 
> and it redirects to admin page.
>
>
> On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza <
> luciano...@gmail.com > wrote:
>
>> Right now! :), I'll get back to you with results.
>>
>> Cheers.
>>
>>
>> On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro > > wrote:
>>
>>> Possible fix in trunk. Can you help test it?
>>>
>>>
>>> On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote:

 ok. it hasn't anything to do with the "more security" change. It has to 
 do with the new session storage behaviour. Filing an issue right now, 
 shouldn't be hard to fix

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


 On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta 
 Podazza wrote:
>
> Hello,
>
> I was developing an application with web2py 
> 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked 
> fine until I upgraded to latest 2.9.7.
>
> Now when I access appadmin for ANY app(welcome, examples, my app, 
> etc) it redirects to admin and nothing happens.
>
> Tried cleaning everything, even deleting the entire database and 
> starting from scratch and nothing happened.
>
> Any ideas about this?. Thanks in advance.
>
  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in 
 the Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit https://groups.google.com/d/
 topic/web2py/9kXd30hW3j0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

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

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


[web2py] Re: extra_fields can't showed in auth_user db.

2014-09-08 Thread olivier hubert
I Massimo, thanks for your quick response.
Could you confirm the extra fields are normally showed in profile page 
after a successful registration or I need to create a custom view to do 
that?

This is the new code for my_tables.py modele

# -*- coding: utf-8 -*-
#Add authentication to the app.
from gluon.tools import Auth

auth = Auth(db)

#Add some fields in auth_user table to have a complete user profile.
auth.settings.extra_fields['auth_user']= [
Field('phone_number', 'string', writable = True, readable = True),
Field('address', 'text', writable = True, readable = True),
Field('city', 'string', writable = True, readable = True),
Field('zip', 'string', writable = True, readable = True),
Field('phone', 'string', writable = True, readable = True),
Field('birthday', 'date', requires = IS_DATE(format=('%d-%m-%Y')), 
writable = True, readable = True)]
auth.define_tables(username=True, signature=True)

Le dimanche 7 septembre 2014 17:42:59 UTC+2, Massimo Di Pierro a écrit :
>
> I cannot reproduce the problem. 
>
> Mind that you do not need
>
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>
> should be
>
> auth = Auth(db)
>
>
>
> On Sunday, 7 September 2014 07:54:27 UTC-5, olivier hubert wrote:
>>
>> I use the web2py version 2.9.8.
>> I create a simple new app "test_auth"
>>
>> In Models I add "my_tables.py" with the contents below.
>>
>> # -*- coding: utf-8 -*-
>>
>> #Add authentication to the app.
>> from gluon.tools import Auth
>>
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>>
>>
>> *#Add some fields in auth_user table to have a complete user 
>> profile.*auth.settings.extra_fields['auth_user']= [
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('phone_number', 
>> 'string'),
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('address', 
>> 'text'),
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('city', 
>> 'string'),
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('zip', 
>> 'string'),
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('phone', 
>> 'string'),
>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('birthday', 
>> 'date', requires = IS_DATE 
>> <http://127.0.0.1:8000/examples/global/vars/IS_DATE>(format=('%d-%m-%Y')))]
>> auth.define_tables(username=True, signature=True)
>>
>> I open the page http://127.0.0.1:8000/test_auth/default/user/register
>>
>> The form doesn't show my extra field.
>>
>> After a successful user registration, I open the db admin to see the record 
>> in the table "auth_user", but I can't see my extra fields.
>>
>> I already try session cleanup, free cookies, create a new app, ... see and 
>> try some tricks from this forum or stack overflow. I probably miss something 
>> but I can't see what.
>>
>>

-- 
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: extra_fields can't showed in auth_user db.

2014-09-08 Thread olivier hubert
I find my problem.
I double define auth.define_tables.
once in db.py and second in my_tables.py.
Only once definition can be declared.

Le dimanche 7 septembre 2014 18:14:27 UTC+2, olivier hubert a écrit :
>
> I Massimo, thanks for your quick response.
> Could you confirm the extra fields are normally showed in profile page 
> after a successful registration or I need to create a custom view to do 
> that?
>
> This is the new code for my_tables.py modele
>
> # -*- coding: utf-8 -*-
> #Add authentication to the app.
> from gluon.tools import Auth
>
> auth = Auth(db)
>
> #Add some fields in auth_user table to have a complete user profile.
> auth.settings.extra_fields['auth_user']= [
> Field('phone_number', 'string', writable = True, readable = True),
> Field('address', 'text', writable = True, readable = True),
> Field('city', 'string', writable = True, readable = True),
> Field('zip', 'string', writable = True, readable = True),
> Field('phone', 'string', writable = True, readable = True),
> Field('birthday', 'date', requires = IS_DATE(format=('%d-%m-%Y')), 
> writable = True, readable = True)]
> auth.define_tables(username=True, signature=True)
>
> Le dimanche 7 septembre 2014 17:42:59 UTC+2, Massimo Di Pierro a écrit :
>>
>> I cannot reproduce the problem. 
>>
>> Mind that you do not need
>>
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>>
>> should be
>>
>> auth = Auth(db)
>>
>>
>>
>> On Sunday, 7 September 2014 07:54:27 UTC-5, olivier hubert wrote:
>>>
>>> I use the web2py version 2.9.8.
>>> I create a simple new app "test_auth"
>>>
>>> In Models I add "my_tables.py" with the contents below.
>>>
>>> # -*- coding: utf-8 -*-
>>>
>>> #Add authentication to the app.
>>> from gluon.tools import Auth
>>>
>>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>>>
>>>
>>> *#Add some fields in auth_user table to have a complete user 
>>> profile.*auth.settings.extra_fields['auth_user']= [
>>> Field 
>>> <http://127.0.0.1:8000/examples/global/vars/Field>('phone_number', 
>>> 'string'),
>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('address', 
>>> 'text'),
>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('city', 
>>> 'string'),
>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('zip', 
>>> 'string'),
>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('phone', 
>>> 'string'),
>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('birthday', 
>>> 'date', requires = IS_DATE 
>>> <http://127.0.0.1:8000/examples/global/vars/IS_DATE>(format=('%d-%m-%Y')))]
>>> auth.define_tables(username=True, signature=True)
>>>
>>> I open the page http://127.0.0.1:8000/test_auth/default/user/register
>>>
>>> The form doesn't show my extra field.
>>>
>>> After a successful user registration, I open the db admin to see the record 
>>> in the table "auth_user", but I can't see my extra fields.
>>>
>>> I already try session cleanup, free cookies, create a new app, ... see and 
>>> try some tricks from this forum or stack overflow. I probably miss 
>>> something but I can't see what.
>>>
>>>

-- 
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] Reddit clone - make a menu by a query error

2014-09-12 Thread olivier hubert
I try implement Reddit clone from massimo video (2013 edition), but I have 
a strange problem with the dynamic menu construction part.

My menu.py (I remove all comments):

response.logo = A(B('web',SPAN(2),'py'),XML('™ '),
  _class="brand",_href="http://www.web2py.com/";)
response.title = request.application.replace('_',' ').title()
response.subtitle = ''

response.meta.author = 'Your Name '
response.meta.keywords = 'web2py, python, framework'
response.meta.generator = 'Web2py Web Framework'

response.google_analytics_id = None

response.menu = [
(T('Home'), False, URL('default', 'index'))
]

row = db(db.category).select().first()

I receive an error AttributeError: 'DAL' object has no attribute 'category'

But, if I execute the code db(db.category).select().first() in a shell 
window I get my first category.

In [2] : db(db.category).select().first()


-- 
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: Reddit clone - make a menu by a query error

2014-09-14 Thread olivier hubert
I find my problem. 
I define all my tables in my_table.py models file. 
This files is loaded by web2py after the menu.py file. 
So category is not know at the moment of menu.py logic is loaded and return 
an error.

I define my models logic in a db1.py file now and all is ok

Thanks for your reply :)

Le samedi 13 septembre 2014 16:23:35 UTC+2, Niphlod a écrit :
>
> any db.category call must go after db.define_table('category'). Have you 
> checked it ?
>
> On Friday, September 12, 2014 8:05:27 AM UTC+2, olivier hubert wrote:
>>
>> I try implement Reddit clone from massimo video (2013 edition), but I 
>> have a strange problem with the dynamic menu construction part.
>>
>> My menu.py (I remove all comments):
>>
>> response.logo = A(B('web',SPAN(2),'py'),XML('™ '),
>>   _class="brand",_href="http://www.web2py.com/";)
>> response.title = request.application.replace('_',' ').title()
>> response.subtitle = ''
>>
>> response.meta.author = 'Your Name '
>> response.meta.keywords = 'web2py, python, framework'
>> response.meta.generator = 'Web2py Web Framework'
>>
>> response.google_analytics_id = None
>>
>> response.menu = [
>> (T('Home'), False, URL('default', 'index'))
>> ]
>>
>> row = db(db.category).select().first()
>>
>> I receive an error AttributeError: 'DAL' object has no attribute 
>> 'category'
>>
>> But, if I execute the code db(db.category).select().first() in a shell 
>> window I get my first category.
>>
>> In [2] : db(db.category).select().first()
>> 
>>
>

-- 
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] MARKMIN image margin

2014-09-14 Thread olivier hubert
Is it possible to add a margin with a MARKMIN syntax to a image ?

-- 
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 multiple buttons in SQLFORM

2014-09-14 Thread olivier hubert
I have a simple FORM with a submit button and I want to add a second button 
to open a new window with Markmin info.

I declare my form like that

form = SQLFORM(db.comm, buttons=['submit', A("Markmin 
syntax",_class='btn',_href="http://www.web2py.com/init/static/markmin.html";, 
_target="_blank")]).process()

But I see only the submit button and not the new one.
If I remove the submit button from the form, the Markmin syntax button is 
showed and open a new window.

-- 
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] url rewriting and url mapping

2014-09-17 Thread olivier hubert
My application is a clone of Reddit clone app from Massimo.

This is the url I use to show all the posts in a category.
http://127.0.0.1:8000/list_posts_by_votes/16
16 = category id
I would like this url in place of.
http://127.0.0.1:8000/my_category_name

It's the same to show a post
http://127.0.0.1:8000/view_post/1507
1507 = post id
I would like this url in place of.
http://127.0.0.1:8000/my_category_name/my_post_name

Is it possible to do that with routes?

I already add the routes.py in the root directory of web2py to simplify my 
url and use the language facilities.

routers = dict(
  BASE  = dict(default_application='my_app_name'),
  my_app_name = dict(languages=['en', 'fr'], default_language='fr'),
)

Thanks for your 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] Re: show multiple buttons in SQLFORM

2014-09-17 Thread olivier hubert
I finish to add my second button via jQuery

jQuery( document ).ready(function() {
jQuery("#submit_record__row .w2p_fw").append('{{=A("Markmin 
syntax",_class='btn 
btn-info',_href="http://www.web2py.com/init/static/markmin.html";, 
_target="_blank")}}')
}

Le dimanche 14 septembre 2014 14:18:13 UTC+2, olivier hubert a écrit :
>
> I have a simple FORM with a submit button and I want to add a second 
> button to open a new window with Markmin info.
>
> I declare my form like that
>
> form = SQLFORM(db.comm, buttons=['submit', A("Markmin 
> syntax",_class='btn',_href="http://www.web2py.com/init/static/markmin.html";, 
> _target="_blank")]).process()
>
> But I see only the submit button and not the new one.
> If I remove the submit button from the form, the Markmin syntax button is 
> showed and open a new window.
>

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


[web2py] Re: Web2py ajax call and Angularjs

2014-09-17 Thread olivier hubert
Hi, I don't know angular to, but I found this documentation with a ajax 
sample at the end.
http://slides.com/amberdoctor/angularjs_and_web2py

Le mardi 16 septembre 2014 20:39:02 UTC+2, piero crisci a écrit :
>
> I am testing angularjs with web2py.
> In my web2py i have some ajax call that store the html code into a dialog 
> box.
> Now i would like to insert in html code from the callback some angularjs 
> code.
> But because ajax call is not into angular module , the code is not running.
> The angular MVC work instead properly into main pages.
> Anyone is trying the same thing  or got some hints for me?.
> I cannot find any examples of how use web2py ajax (or jquer ajax) with 
> angularjs
>

-- 
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] pending registration alert for a new user

2014-09-20 Thread olivier hubert
how I can detect in a controllers, if a new user pending registration 
before to use my app?

-- 
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] git push error

2014-09-30 Thread olivier hubert
If I use the function git push from the admin console I get an error

Traceback

1.
2.
3.
4.
5.
6.

Traceback (most recent call last):
  File "/home/olituks/web2py/gluon/restricted.py", line 224, in restricted
exec ccode in environment
  File "/home/olituks/web2py/applications/admin/views/default/git_push.html", 
line 53, in 
TypeError: 'NoneType' object does not support item assignment

Error snapshot [image: help] 


('NoneType' object does not support item 
assignment)

-- 
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] web2py https and Codeanywhere

2014-10-06 Thread olivier hubert
Ave you already start web2py in https mode in Codeanywhere devbox ?

I apply this method to generate certificate and apply the adequate command 
lines to activate https but my server don't send any pages.
http://stackoverflow.com/questions/12834550/simplest-way-to-setup-remote-admin-access-to-a-web2py-process
 
(last post) 


-- 
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: PythonAnywhere linking with domain at Godaddy

2014-10-06 Thread olivier hubert

Or you can use Cloudflare and take advantage of DDOS protection and other 
cool stuff freely.


Le lundi 6 octobre 2014 12:27:41 UTC+2, Harry Percival a écrit :
>
> You need to use a CNAME, not a redirect. There's more info here: 
> https://www.pythonanywhere.com/wiki/OwnDomains
>
> On Friday, 3 October 2014 03:42:14 UTC+1, Satya Kishore wrote:
>>
>> I created a web2py app.
>> I brought a domain at godaddy.
>> I even brought a hosting plan at pythonanywhere
>> How can I get the domain redirect(relink) to pythonanywhere
>> Thank You
>>
>

-- 
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] get the iteration number from a scheduled task

2014-12-27 Thread olivier hubert
Could you tell me the way to get the iteration number inside a scheduled 
task?
I want to perform a different treatment if it's the first run of my tasks.

ex:
iteration 1 : treatment A
iteration 2 : treatment B
iteration 3 : treatment B
iteration 4 : treatment B
...

-- 
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: get the iteration number from a scheduled task

2014-12-28 Thread olivier hubert
Thanks for the help, the solution is perfect for me.

Le samedi 27 décembre 2014 18:16:16 UTC+1, Niphlod a écrit :
>
> uhm... there's not a stable API to do it, but you can access the 
> relative scheduler_task record via W2P_TASK. 
> From web2py 2.4.1, any task processed by the scheduler can access a global 
> variable named W2P_TASK that is a Storage() holding the id and the uuid of 
> the running task.
>
> this means you can do, within the queued task, something like
>
> def mytask():
> print W2P_TASK.id, W2P_TASK.uuid
>
> Back to your problem: to know if it's the first iteration you have two 
> methods: checking how many "results" the task has (assuming you're 
> returning something at the end of "mytask" and you didn't istantiate the 
> Scheduler with discard_results=True) or checking the actual times a task 
> has been executed.
> Assuming "dbsched" is the DAL istance used by the scheduler, the first 
> info can be retrieved by 
>
> howmany = dbsched(dbsched.scheduler_run.task_id == W2P_TASK.id).count()
>
> the second info instead is on the scheduler_task table directly:
>
> thetask = dbsched.scheduler_task(W2P_TASK.id)
> howmany = thetask.times_run 
>
> I'd go with the former method if I had a gun pointed to my head.
>
> However, because I don't like guns, I'd tackle the problem from an 
> entirely different perspective: I'd queue a one-time-only task for 
> "treatment A" that at the end queues a repeating task for "treatment B". 
> It would be simpler, with more separation between the components, easier 
> to debug and would work even if you use some other task processors.. also, 
> you'll be protecting your app if in the future the schema of the scheduler 
> tables changes in the future (unlikely but entirely possible).
>
>
>

-- 
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] where to find syntax smart_query

2015-01-18 Thread olivier hubert

I use smart_query in my project but I can't found a complete supported 
syntax in the documentation.
Have you more info about that or a reference of the syntax analyser in the 
web2py code ?

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


[web2py] Multi language site

2015-03-18 Thread olivier hubert
I try to made a simple multi language site with routes, but I can't.
The routing are correct because I can use the url like 
this http://127.0.0.1:8000/*testme*/en/ and *translate* application are 
serve.
But translate application is always in french!

translate application is a copy of welcome application with the 
modifications below.

Web2Py version : 2.9.12-stable+timestamp.2015.01.17.06.11.03 (Running on 
Rocket 1.2.6, Python 2.7.8)

/web2py/routes.py
--

routes_in = (
  
('/testme/$language/(?P.*)','/translate/default/$any?_language=$language'),
 
)

/translate/models/0.py
-

print request.vars
if request.vars._language: 
T.force(request.vars._language)

Terminal window return:
--


-- 
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: Multi language site

2015-03-21 Thread olivier hubert
Thanks for the help Gael (merci) :)

Finally I try another method as routers.
Massimo and other talk about that in another post and a sample can be found 
in the admin page.

I add in my view a select with all language supported by my application. 
My application need to be compatible with ie9 so I suppress the expiration 
date otherwise IE9 doesn't create the cookie.

{{if hasattr(T,'get_possible_languages_info'):}}

{{for langinfo in sorted([(code,info[1]) for code,info in T.
get_possible_languages_info().iteritems() if code != 'default']):}}
{{=langinfo[1]}}
{{pass}}

{pass}}

in a new file 0.py in my models folder

# set the language
if 'userlanguage' in request.cookies and not (request.cookies['userlanguage'] 
is None):
T.force(request.cookies['userlanguage'].value)

I have now a language selector compatible with all browser and especially 
IE9...

Et encore merci pour ton aide :)

Olivier


Le vendredi 20 mars 2015 20:30:21 UTC+1, Gael Princivalle a écrit :
>
> And if you add at the end of the db.py file:
> if request.uri_language: T.force(request.uri_language)
>
> it will set the good language.
>
> Il giorno venerdì 20 marzo 2015 20:04:24 UTC+1, Gael Princivalle ha 
> scritto:
>>
>> Salut Olivier.
>>
>> I use that router and for me it works fine:
>> routers = dict(
>> BASE = dict(
>> domains = {
>> "www.mydomain.com" : "my_app", 
>> }
>> ),
>> my_app = dict(languages=['en', 'fr'], default_language='fr'),
>> )
>>
>> The original website (words in the .html files) have to be in english.
>>
>> After you must edit fr language file for applying translations.
>> For example:
>> T('A beautiful journey')
>> Load one time the .html page.
>> Search for 'A beautiful journey' in the fr language file.
>> Translate and save.
>>
>> For bigger contents make double fields in tables:
>> product_description_en
>> product_description_fr
>>
>> And in the .html file test which is the request.uri_language for 
>> displaying one or the other field.
>>
>> Hopes it could help, bye. 
>>
>> Il giorno mercoledì 18 marzo 2015 17:50:22 UTC+1, olivier hubert ha 
>> scritto:
>>>
>>> I try to made a simple multi language site with routes, but I can't.
>>> The routing are correct because I can use the url like this 
>>> http://127.0.0.1:8000/*testme*/en/ and *translate* application are 
>>> serve.
>>> But translate application is always in french!
>>>
>>> translate application is a copy of welcome application with the 
>>> modifications below.
>>>
>>> Web2Py version : 2.9.12-stable+timestamp.2015.01.17.06.11.03 (Running on 
>>> Rocket 1.2.6, Python 2.7.8)
>>>
>>> /web2py/routes.py
>>> --
>>>
>>> routes_in = (
>>>   
>>> ('/testme/$language/(?P.*)','/translate/default/$any?_language=$language'),
>>>  
>>> )
>>>
>>> /translate/models/0.py
>>> -
>>>
>>> print request.vars
>>> if request.vars._language: 
>>> T.force(request.vars._language)
>>>
>>> Terminal window return:
>>> --
>>> 
>>>
>>>

-- 
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] API changed ?

2017-02-24 Thread Olivier Choquet
Hi everyone.

My question might look a little bit weird but in the (very good) tutorial 
videos of web2py a link to the API is shown. It goes to quite detailled API 
pages with the regular look of API pages...
If I follow the link now provided within the Web2Py site it goes to the 
chapter 4 of the book which looks less detailled. Is this an expected 
update of the API ? Didi I miss something ?
Thanks for your feedbacks.

-- 
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: API changed ?

2017-03-12 Thread Olivier Choquet
Hi 
I believe I do.
Thanks


Le samedi 25 février 2017 05:19:00 UTC+1, Anthony a écrit :
>
> Are you referring to this: http://web2py.readthedocs.io/en/latest/
>
> On Friday, February 24, 2017 at 11:50:56 AM UTC-5, Olivier Choquet wrote:
>>
>> Hi everyone.
>>
>> My question might look a little bit weird but in the (very good) tutorial 
>> videos of web2py a link to the API is shown. It goes to quite detailled API 
>> pages with the regular look of API pages...
>> If I follow the link now provided within the Web2Py site it goes to the 
>> chapter 4 of the book which looks less detailled. Is this an expected 
>> update of the API ? Didi I miss something ?
>> Thanks for your feedbacks.
>>
>>

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