Pawan Gupta | 20 Apr 20:52 2014
Picon

"Admin is disabled because insecure channel" error Hosting web2py app on Amazon EC2 Linux server

Hi Everyone

We are having serious problem with our website 911india.com. We have hosted it on Amazon EC2 server and there is a ticket that is issued which redirects us to the admin interface that shows "Admin is disabled because insecure channel" 

I tried searching on the website but nothing seems to make sense probably because we are somewhat beginners. 

Can someone please help us with what could be done to resolve this.


Cheers

Pawan

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
weheh | 21 Apr 03:44 2014
Picon
Picon

ImportError: No module named myapp.modules

I'm in the process of installing a new version of my app and getting this error message right off the bat. My modules folder does contain an __init__.py file, so it should be OK. But I'm getting this traceback. This has got me dead in the water, so any quick help would be much appreciated. Should be obvious, but I don't see it.

Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 212, in restricted
exec ccode in environment
File "C:/web2py/applications/myapp/models/0_db_1_user.py", line 18, in <module>
import yak_globs
File "C:\web2py\gluon\custom_import.py", line 73, in custom_importer
modules_prefix, globals, locals, [itemname], level)
File "C:\web2py\gluon\custom_import.py", line 124, in __call__
result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named myapp.modules

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
LoveWeb2py | 21 Apr 00:02 2014
Picon

appointment application doesn't work out of box

Hello,

I'm trying to create a website for my Mom that she can use to book appointments. She has a day spa and really could use something like the appointment manager.

I have a fresh copy of web2py installed (latest version) and a fresh install of the appointment manager app.
I installed the app through the app manager and when I try to create an appointment I get this error:

<type 'exceptions.ValueError'> too many values to unpack


here is the traceback:

Traceback

1.
2.
3.
4.
5.
6.
Traceback (most recent call last):
File "/home/web2py/spa/gluon/restricted.py", line 220, in restricted
exec ccode in environment
File "/home/web2py/spa/applications/appointments/views/default/appointment_read.html", line 103, in <module>
ValueError: too many values to unpack
and here is the highlighted line of code in appointment_read.html
for t,f in db.t_appointment._referenced_by:

any thoughts why I might be getting this error?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
David | 20 Apr 22:58 2014
Picon

Unique Field Name AND Case

So I been looking for a couple hours on a solution to this but it evades me.

When I create a unique field such as:

db.define_table('list',
    Field('name, unique=True))


I can add "David", "david" and "dAvid" and they are all rightfully unique and added accordingly.

How do I add a field so it doesn't matter the case or capitalization?  I only want "David" or any variation in the table only 1 time.  The reason is I want to keep the case as a specific name like "ForEx" or "NASDAQ" but not "forex" or "nasdaq".

Thanks,
David


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
lucas | 20 Apr 16:25 2014
Picon

500 Internal Server Error under CentOS Apache and Web2py 2.9.5

hello everyone,

i just upgraded from web2py 2.4.6 to 2.9.5.  i am running centos 6.5 with apache httpd server 2.2.15 and mod_wsgi is 3.2.3.

i have no applications installed yet, just trying to get the default welcome, examples, and admin interfaces working.  apache returns, "500 Internal Server Error".  not sure where to start to fix the error.

here is my /etc/httpd/conf.d/wsgi.conf file:
BOF...
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess web2py user=apache group=apache
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup web2py
WSGISocketPrefix run/wsgi
WSGIScriptAlias / /opt/web-apps/web2py_2.9.5/handlers/wsgihandler.py
...EOF

here is my /etc/httpd/conf.d/default.conf file:
BOF...
NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  <Directory /opt/web-apps/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

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

  <Directory /opt/web-apps/web2py/applications/*/static>
    Options -Indexes
    ExpiresActive On
    ExpiresDefault "access plus 1 hour"
    Order Allow,Deny
    Allow from all
  </Directory>

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log
</VirtualHost>
...EOF

here is my /etc/httpd/conf.d/welcome.conf file:
BOF...
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>
...EOF

thanx for your help in advance, lucas

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Greg Vaughan | 20 Apr 04:48 2014
Picon

alternate date and time picker

Is there any way that I can use a different date and time picker. The default one is horrible but it seems to be "baked in" to web2py?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Maurice Waka | 19 Apr 11:57 2014
Picon

How to output data from sqlite3 table to html


I am trying to use web2py to build an app. I have a simple print function that a user submits a key word . The string or int key word is directed to an sqlite db to retrieve a row and output the data. I need to know 1. how to use the print on html. 2. How to split the string...so far i did the list:string

Here is my code:

def first(): form = SQLFORM.factory(Field('visitor_name', label = 'Please Type Your keyword here!', requires= [IS_NOT_EMPTY(), IS_LOWER(),'list:string'])) form.element('input[type=submit]')['_onclick'] = "return \ confirm('Are you sure you want to submit:');" if form.process().accepted: session.visitor_name = form.vars.visitor_name redirect(URL('main')) return dict(form=form) def main(): while True: name = request.vars.visitor_name or redirect(URL('first')) name2 = name[:] for item in name2:break name3 = ' '.join(name2) import sqlite3 id = 0 location = "" conn = sqlite3.connect("keywords.db") c = conn.cursor() c.execute('select * from kmedicals') records = c.fetchall() for record in records: id = record[0] location = record[15] if id == name3: print name3.capitalize(),':' '\n',location break sys.exit() return dict(name=name)

my view...default/main.html:

{{extend 'layout.html'}} {{=name}}

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
scruffyexaminer | 19 Apr 16:48 2014
Picon

synchronizing a sharing a variable between instances of an application

My app uses a data service that requires periodically requesting an access_token using my apps credentials given by the data service provider.  I send this token in the header of every request my app sends to the data service, and I only know the token has expired when a request comes back with a certain 403 response. At this point my app needs to request a new access_token and the cycle continues.

So every instance of my app needs to use the current access_token, and the first instance which receives a 403 response needs to update the access token for all instances. So I have a couple of questions:

1. At first I tried putting the shared access_token variable in a model file, but I found that the view would always see access_token as defined in the model file even if I tried declaring it global and changing it in a controller (I guess model files are reloaded every action?), so instead I defined  db.access_token in the  model and that worked. I can now change db.access_token in a controller and see the change in the view.  But is this the proper way to share a variable across application instances?

2. Is there a way to make a thread-safe function in my application so that every request to the data service requires access to some kind of Lock object in order to be sure that if a 403 comes back a new access_token can be obtained and assigned to db.access_token before another instance gets a 403 response?

Thank you very much in advance. Please note: I am fairly new to databases and web frameworks in general (my Python is 'ok') so if you find yourself confused by my question - think newbie.

Scruffy

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Spencer Underwood | 19 Apr 20:26 2014
Picon

Need to access SQLite3 database file but have no definitions for tables

I'm pretty new to web development as a whole and am planning to make a website for people playing the game EVE Online to use but have encountered some difficulty trying to access the database dump that CCP Games has released. The database dump is available here in a SQLite, MySQL and PostGres. I use Win7 with minimal rights so if I have to use MySQL or PostGres to fix this problem it has to be able to install and run without admin rights.

When accessing the database in the sqlite3 executable everything work perfectly, all that's needed to load the file is a .open sqlite-latest.sqlite and it just works. When opening the database file using the web2py DAL, it appears to load the file properly but doesn't know of any the tables that exist. This appears to be working as intended, but is a problem I can't figure out how to solve. When I try to manually define one of the tables I know exists (list of existing tables found here), I receive the error: sqlite3.OperationError: table invTypes already exists. The code I used to do this is as follows:

from os.path import join, exists
from httplib import HTTPException
from gluon.sql import DAL, Field
from gluon.validators import *

import eveapi
import datetime

api = eveapi.EVEAPIConnection()
db = DAL('sqlite://sqlite-latest.sqlite')
#----------------------------------------------------------------------------
db.define_table('invTypes')

I haven't figured out how to run a python file as part of an application, so I just make a test.py file inside the root web2py director and run it from command line ("py.exe test.py"). 


Does anyone know anything I could use to access this database?

Thanks,
Spencer Underwood

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kurt Jensen | 19 Apr 22:12 2014
Picon

How do I retrieve Row by id from a join query result object

How can I get a row from a DAL object if I know the associated id.

Example:

my_phones=db((db.prof_phone.pid==person_id)&(db.prof_phone.provider>1)).select(db.prof_phone.ALL,db.provider.edomain,
       left=db.provider.on(db.provider.id==db.prof_phone.provider),orderby=db.prof_phone.label)

Which gets me this object:
my_phones :
prof_phone.id prof_phone.label prof_phone.phone prof_phone.provider provider.edomain
2         Cell                 (360) 123-9876         2                vmobl.com
3         Wife Cell        (360) 123-4567         2                vmobl.com

Now I want the data from the second row of the object which I know has the prof_phone.id of 3.

Like: Wife Cell, (360) 123-4567, vmobl.com

How do I get that data out of the object without iterating over eveything?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kurt Jensen | 19 Apr 21:24 2014
Picon

Get data associated with known id from DAL object

I have a left join query:

phones=db((db.prof_phone.pid==person_id)&(db.prof_phone.provider>1)).select(db.prof_phone.ALL,db.provider.edomain,
        left=db.provider.on(db.provider.id==db.prof_phone.provider),orderby=db.prof_phone.label)

which gives me an object:
phones : prof_phone.id     prof_phone.label   prof_phone.phone   prof_phone.provider    prof_phone.pidprof_phone.editedprovider.edomain
2 Cell (360) 123-9876    2 Kurt Jensen (11)       2014-03-26 22:34:40         vmobl.com
3 Wife Cell (360) 123-4567    2 Kurt Jensen (11) 2014-04-17 18:02:18 vmobl.com


Given that I know the value of the id (3) in row 2; How can I retrieve "(360) 123-4567" and "vmobl.com" out of the object?

In PHP I always used a multidimensional array keyed by id to store query results and could just do $phone[3]['phone'] and $phone[3]['edomain'].

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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane