Giter VIP home page Giter VIP logo

web2py's Introduction

Readme

web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications.

It is written and programmable in Python. LGPLv3 License

Learn more at http://web2py.com

Google App Engine deployment

cp examples/app.yaml ./
cp handlers/gaehandler.py ./

Then edit ./app.yaml and replace "yourappname" with yourappname.

Important reminder about this GIT repo

An important part of web2py is the Database Abstraction Layer (DAL). In early 2015 this was decoupled into a separate code-base (PyDAL). In terms of git, it is a sub-module of the main repository.

The use of a sub-module requires a one-time use of the --recursive flag for git clone if you are cloning web2py from scratch.

git clone --recursive https://github.com/web2py/web2py.git

If you have an existing repository, the commands below need to be executed at least once:

git submodule update --init --recursive

PyDAL uses a separate stable release cycle to the rest of web2py. PyDAL releases will use a date-naming scheme similar to Ubuntu. Issues related to PyDAL should be reported to its separate repository.

Documentation (readthedocs.org)

Docs Status

Tests

Build Status MS Build Status Coverage Status

Installation Instructions

To start web2py there is NO NEED to install it. Just unzip and do:

python web2py.py

That's it!!!

web2py directory structure

project/
    README
    LICENSE
    VERSION                    > this web2py version
    web2py.py                  > the startup script
    anyserver.py               > to run with third party servers
    ...                        > other handlers and example files
    gluon/                     > the core libraries
        packages/              > web2py submodules
          dal/
        contrib/               > third party libraries
        tests/                 > unittests
    applications/              > are the apps
        admin/                 > web based IDE
            ...
        examples/              > examples, docs, links
            ...
        welcome/               > the scaffolding app (they all copy it)
            ABOUT
            LICENSE
            models/
            views/
            controllers/
            sessions/
            errors/
            cache/
            static/
            uploads/
            modules/
            cron/
            tests/
        ...                    > your own apps
    examples/                  > example config files, mv .. and customize
    extras/                    > other files which are required for building web2py
    scripts/                   > utility and installation scripts
    handlers/
        wsgihandler.py         > handler to connect to WSGI
        ...                    > handlers for Fast-CGI, SCGI, Gevent, etc
    site-packages/             > additional optional modules
    logs/                      > log files will go in there
    deposit/                   > a place where web2py stores apps temporarily

Issues?

Report issues at https://github.com/web2py/web2py/issues

web2py's People

Contributors

abastardi avatar amerikan avatar buhtigithub avatar carpaidea avatar cassiobotaro avatar cs09g avatar cwinebrinner avatar dlage avatar dokime7 avatar flavour avatar gi0baro avatar jvanbraekel avatar leonelcamara avatar mdipierro avatar misl6 avatar nicozanf avatar niphlod avatar omartrinidad avatar queengooborg avatar reingart avatar richboss avatar robertop23 avatar rpedroso avatar shysec avatar spametki avatar timnyborg avatar timrichardson avatar viniciusban avatar willimoa avatar zvolsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

web2py's Issues

Bug when using external folders with option -f

From [email protected] on May 11, 2012 12:35:19

When using web2py with the "-f" option, it doesn't import correctly the files in the modules directory of the applications.
I.E.
python web2py.py -f /myprojects/web2py -a hello

starts web2py correctly, but trying to use

import test as a shortcut for from applications.appname.modules import test.

as explained at http://www.web2py.com/books/default/chapter/29/4?search=applications.appname.modules is not possible.

Actually, I think this has never worked

Original issue: http://code.google.com/p/web2py/issues/detail?id=791

Link to Chrome extension that auto-opens error tickets

From [email protected] on March 24, 2012 22:57:49

Massimo asked me to make this ticket for him.

I wrote a Chrome extension that watches connections to localhost for web2py error pages. When it finds such a page, it creates an iframe and loads the ticket in the iframe. Saves me time and trouble during development. Massimo is going to add a link to the docs.

Source code is on github at https://github.com/agarden/web2py-devmode-chrome . A packed extension is on the download page: https://github.com/agarden/web2py-devmode-chrome/downloads .

Original issue: http://code.google.com/p/web2py/issues/detail?id=732

Admin application-creating wizard's style for creating auth_user...

From [email protected] on June 06, 2012 17:55:23

I ran into a problem of my own creation when playing with an application that I generated using the admin application-creating wizard, which is how I stumbled onto this.

The appwizard creates a db.py for defining the auth_user table based on the web interaction, but it does so using a full-specified auth_user table definition instead of using the extra_fields capability.

It's probably just a matter of keeping all the moving parts in sync, but I wanted to create this issue so it doesn't get forgotten about.

Original issue: http://code.google.com/p/web2py/issues/detail?id=842

response.files with no file suffix

From [email protected] on September 22, 2012 17:44:59

What steps will reproduce the problem? 1. add response.files.append(' http://maps.google.com/maps/api/js?sensor=false' )
2. render a view that includes web2py_ajax.html What is the expected output? What do you see instead? i expect the file to e output, but since it does not end in a matching suffix it is ignored. What version of the product are you using? On what operating system? 2.0.9 Please provide any additional information below.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1025

table format is not used if it is defined later than the reference

From [email protected] on March 09, 2012 05:31:33

What steps will reproduce the problem? 1. t1 = db.define_table('t1', Field('a', 'reference t2'))
2. t2 = db.define_table('t2', Field('a', 'string'), format='t2:%(a)s') What is the expected output? What do you see instead? I expect t1.a.represent to use the t2 format, but it doesn't. If I reverse the order of the definitions, it works as expected.

If the tables have circular or mutual references, there is no order in which everything will work. What version of the product are you using? On what operating system? all Please provide any additional information below. The problem is that sqlhtml_validators() is applied at t1 definition time, when t2 does not exist yet (and therefore the format cannot be made to represent). My temporary solution: after all tables are defined, I fix representations with the following function:

from gluon.dal import sqlhtml_validators
def dalfix(tables, fields):
    for t in tables:
        for f in fields:
            t[f].requires = sqlhtml_validators(t[f])

And in this case, the fixing call would be:

dalfix([db.t1], ['a'])

(I use lists because in the real app I have multiple tables and multiple repeating fields to fix)

Note this this is related to issue #648 , which was marked as a duplicate (of #649) but is not a duplicate and is still unsolved (but I cannot find a way to reopen). The discussion there offers a possible way to a solution.

Original issue: http://code.google.com/p/web2py/issues/detail?id=700

login expires when doing periodic jsonrpc requests

From [email protected] on January 17, 2013 10:05:30

What steps will reproduce the problem? 1. Set a low expiration value: auth.settings.expiration=60
2. Login to a web2py application
3. With the obtained cookie, start doing only @service.jsonrpc requests, perioducally, every 5 s. What is the expected output? What do you see instead? auth.last_visit will be updated as expected, but the login will expire.
The login should not expire, since we are doing periodic requests and it should stay active forever. What version of the product are you using? On what operating system? Version 2.4.1-alpha.2+timestamp.2013.01.13.13.14.47
CrunchBang Linux statler (Debian GNU/Linux 6.0.6 (squeeze)) Please provide any additional information below. The same test but doing normal requests will keep the login active forever, as expected.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1287

Fulltext search support in web2py

From [email protected] on February 18, 2011 11:03:54

sqlite supports full text search http://www.sqlite.org/fts3.html "FTS4 is an enhancement to FTS3. FTS3 has been available since SQLite version 3.5.0 in 2007-09-04. The enhancements for FTS4 were added with SQLite version 3.7.4 on 2010-12-08."

full text search is also supported in

mysql: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html sql server: http://msdn.microsoft.com/en-us/library/ms142571.aspx oracle: http://download.oracle.com/docs/cd/B28359_01/text.111/b28304/cqrypkg.htm postgresql: http://www.postgresql.org/docs/8.3/static/textsearch.html and so on, but I think this list is enough to add full text search capabilities in DAL

Original issue: http://code.google.com/p/web2py/issues/detail?id=197

Update legacy table using primarykey failed which type is not string failed

From [email protected] on February 10, 2012 16:29:16

It will failed with the follwing error. It works fine if the field type is string in web2py and varchar in MSSQL.

From the syntax error, it's ignore the
'integer' from define_table and always tried with string...

TRACEBACK

SyntaxError: user is tampering with form's record_id: {'mykey':
'111'} != {'mykey': 111}

What steps will reproduce the problem? (Tested with MSSQL Server)

  1. Create table
    CREATE TABLE [dbo].[Test]([mykey] [int] NOT NULL,
    [myvalue] [varchar]%2850%29 NULL,
    CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
    %28
    [mykey] ASC
    %29WITH %28PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY
    = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON%29 ON [PRIMARY]) ON [PRIMARY]
  2. Add record
    mykey = 111
    myvalue = 'AAA'
  3. Model - define table
    db.define_table('Test',
    Field('mykey','integer'),
    Field('myvalue'),
    primarykey=['mykey'])
  4. Contoller
    def index():
    form=crud.update(db.Test,db.Test(db.Test.mykey==111))
    return dict(form=form)
  5. View (default/index)
    {{extend 'layout.html'}}
    {{=form}} What is the expected output? What do you see instead? No error What version of the product are you using? On what operating system? Version 1.99.4 (2011-12-14 14:46:14) stable Please provide any additional information below. Forum link https://groups.google.com/group/web2py/browse_thread/thread/9df8d6b842594735/30bb082a5d5443e6#30bb082a5d5443e6

Original issue: http://code.google.com/p/web2py/issues/detail?id=656

SQLFORM.factory and upload field - uploadfolder

From [email protected] on January 03, 2012 22:36:32

What steps will reproduce the problem? 1. See the first example here: http://web2py.com/books/default/chapter/29/7#SQLFORM.factory 2. it doesn't mention that the uploadfolder argument is required
3. If you pass garbage or a string that doesn't point to a folder, the file is not uploaded and saved.

What is the expected output? What do you see instead? I feel that uploadfolder should NOT be required, as the example would imply. But, if it is determined that uploadfolder is necessary then it should validate the folder that is passed and raise an exception if for some reason it cannot save the file there.

Instead, I'm seeing that I can pass gibberish to the argument and the file is then not saved. What version of the product are you using? On what operating system? Trunk, updated around 8:30 central on 1/3/2012. Please provide any additional information below. In my opinion the uploadfolder arg should be optional. In my situation, I'm processing the uploaded file (reading through a csv) and do not want it stored on the server, my code handles the processing and saving.

Also, there should be some way to define an application-wide default.

If the uploadfolder arg is passed, then it needs to be validated to ensure that we can store a file there. If the file is not successfully stored to the specified server location, and exception should be raised.

There are situations where one wants to specify an upload file, but does not want it to be automatically stored on the server. Therefore, maybe another parm should be available to tell web2py not to save it after it is processed.

You can reference this discussion for more info: http://groups.google.com/group/web2py/browse_thread/thread/1444da35d5e12592/3c21747e67c1eb9f#3c21747e67c1eb9f

Original issue: http://code.google.com/p/web2py/issues/detail?id=597

Unique fields break table inclusion (inheritance)

From [email protected] on February 06, 2012 12:51:19

What steps will reproduce the problem? 1. a = DAL.Table('a', 'u', 'string', unique=True)
2. b = DAL.define_table('b', a)
3. use x in form (or appadmin) What is the expected output? What do you see instead? Being able to use table 'b' with sqlform; but the IS_IN_DB() is put into the requires with respect to the (nonexistent) table 'a', which of course fails. What version of the product are you using? On what operating system? Any Please provide any additional information below. Simple sidestep: make the inherited field have "requires=[]" to disable automatic requires computation (and it can be added manually if it is needed)

In the database, uniqueness is enforced with respect to 'b', but in web2py in respect to 'a'; web2py should either not try to enforce this, or try to enforce this with respect to 'b'.

This is easy to do for non-db tables -- just keep the requires at DEFAULT until the real table is instantiated (and let that compute requires).

With non-db tables, it's not as simple; not sure how to solve it.

Original issue: http://code.google.com/p/web2py/issues/detail?id=648

Suggestion: Add "expecting version" field for app, to allow changing defaults.

From [email protected] on March 09, 2012 07:30:09

web2py has maintained excellent backwards compatibility so far. However, sometimes, behavior SHOULD be changed. e.g., the response.generic_patterns default was changed because of a security problem, and this caused applications to break.

Suggested solution: add a call

web2py_configuration(version, ...) to the application's init.py file which states the assumptions of this version, e.g.

web2py_configuration(version=(1,99,4))

or alternatively a to a new CONFIG file int he web2py/applications/appname directory.

If there has been a breaking change, web2py could revert to old behavior and give a warning, or abort if there is no possible way to do that (or undesirable to do that).

e.g.

if global.web2py_configuration.version \< (1,94.1):
    warn("Generic responses introduce a vulnerability. Please upgrade your app, notes at: http://web2py.com/upgrade-through-1-94-1" )
    if global.web2py_configuration.if_vulnerable == 'Do not abort, I know what I am doing and take full responsibility':  response.generic_patterns = ['*']
    else: raise Exception('Need changes, see warnings')

(an example that would let the user ignore vulnerabilities by an elaborate setting; might not be a good idea).

Now, make the wizard insert the current version number in the init.py or CONFIG file; Refuse running if there is no version information (or alternatively, warn about it and assume 1.99.7). Make the user edit the file manually (or through the app admin) when they have done the upgrade.

Breaking changes I would like to see:

  • default sqlite setting to "pragma foreign_keys=1;" to enforce foreign key constraints. (I set it in my apps, but I think it should be default)
  • default ondelete_action changed to 'RESTRICT' (or at least selectable). I personally set it to restrict always, because on a cross-linked database model, it is easy to accidentally cascade-delete millions of records when you are only trying to delete one.
  • default for migration is off. migration can be enabled like today by changing the migrate=... flag, or through the admin app (in which case it turns off automatically after a transaction with a successful migration has occured)
  • experimental features need to be turned on explicitly (e.g. a "require_experimental=['feature1', 'feature2', ...] in web2py_configuration)
  • optionally switching db query result set from list() to generator/iterator.

You might not agree with about these changes, but putting infrastructure for future-proofing is a good idea regardless of the specific breaking changes.

Original issue: http://code.google.com/p/web2py/issues/detail?id=702

Consider integrating web2admin

From rochacbruno on October 19, 2012 05:37:17

web2admin is a good start to a better data admin for web2py, It puts web2py closer to Django in terms of admin interface, filters, etc.

With the power of grid customization it would be a nice addition.

I am asking to consider the inclusion of web2admin (experimental for a while) as replacement for appadmin or as a supported option, but fully reviewed and integrated, maybe modified and with total support of web2py project.

The project page. https://github.com/rif/web2admin

Original issue: http://code.google.com/p/web2py/issues/detail?id=1103

common_filter not working

From [email protected] on November 25, 2012 23:07:58

What steps will reproduce the problem? 1. execute the attached py file What is the expected output? What do you see instead? Expect to see
1 ['Bob']
2 ['Bob']
3 ['Alice', 'Bob']
4 ['Bob']

instead, see
1 ['Alice', 'Bob']
2 ['Alice', 'Bob']
3 ['Alice', 'Bob']
4 ['Bob'] What version of the product are you using? On what operating system? git main 1b0e08 Please provide any additional information below.

Attachment: test_common_filter.py

Original issue: http://code.google.com/p/web2py/issues/detail?id=1184

Deliver pyodbc binaries with Windows distribution

It's a common case, IMO, that Windows users of web2py downloading the Windows Installer against sources are trying both Python and web2py, maybe for the first time.

For Windows users, the market share of MS SQL Server database is high, but new users of web2py are unable to connect with your existing environment with the web2py default Windows installer, because pyodbc.pyd is missing.

This was my case, except that I already had a Python27 setup, making a bit harder to get a python25 pyodbc, because windows installer of pyodbc detects python from registry and blocks if the version is incompatible.

Following the principle of include in the distro all necessary software, I'm asking if is this possible.

If helps, I have the python 2.5 pyodbc.pyd binary file, its just drop it into web2py install folder.

Best regards,

datetime precision is silently truncated by web2py

From [email protected] on December 01, 2011 00:40:38

What steps will reproduce the problem? 1. create a table with a datetime column
2. insert a datetime value that has fractional seconds, e.g. value=datetime.datetime(2011,11,30,10,20,30,345678) or most likely value=datetime.datetime.now(), using table.insert(datetimecol=value)
3. check database directly, and you'll see that the fractions are missing.
4. insert using string notation table.insert(datetimecol=value.isoformat())
5. check database directly, and you'll see that the values are in database
6. load the database row back 'print table[1].datetimecol' and see that the fractions are gone
7. export datetime value as csv and json, and observe that the fractions are silently truncated as well. What is the expected output? What do you see instead? Expected output is: when using a datetime value with fractional seconds, either the insert fails or the fractional seconds get to the database. When selecting, if the database has fractional seconds, I expect them to be retrieved and not silently truncated.
Similarly, I expect csv export followed by truncate followed by import to return a table to its existing state, without silently truncating values. What version of the product are you using? On what operating system? 1.99.2 (but it's been this way since at least 1.95), on Ubuntu 10.04 and on Win7 Please provide any additional information below. Not all databases support fractional seconds in datetime: sqlite, postgres do; oracle, mysql, db2 don't.

Specifically on sqlite, if you force sqlite to do the string->datetime translation (by passing driver_args={'detect_types': sqlite3.PARSE_DECLTYPES}), and you always insert the values as string, then you actually get fractional seconds. But you're still getting truncated in csv and json exports, perhaps also xml.

Suggested solution:

  1. refactor datetime<->text and text<->datetime conversions; these are currently repeated in
    serializers.py once (json serialization), tools.py once (csv output), dal.py (base represent(), oracle/informix/db2 represent_exceptions(), Rows as_dict(), Rows export_to_csv_file none_exception; parsing repeated in parse() and GoogleSQL code); and make them hookable so that an app can request higher precision handling if needed; also mark in adapter that this resolution is NOT AVAILABLE on Oracle, MySQL, etc. and trigger error if time has second fractions.
  2. Just add a warning/error in all the places where second fractions are silently dropped

I would much prefer option (1), but (2) is the lesser of two evils.

If I submit a patch that does (1), will it be accepted? if not, will you accept a patch that does (2)?

See also discussion in < https://groups.google.com/d/topic/web2py/ddBzw0VgDnA/discussion >

Original issue: http://code.google.com/p/web2py/issues/detail?id=542

Clarify the implications of reloading routes and/or using symlinks in the applications folder.

From [email protected] on June 11, 2012 05:57:55

I've spent far too much time trying to figure out if it is safe to use symlinks in the application folder.
What I've learned is that they are OK so long as they don't change while the server is running.
Similarly, reloading routes may cause problems on an active server.

Propose the following changes to The Book:

In http://web2py.com/books/default/chapter/29/4 In the section that talks about 'track changes', it seems to imply that all modules would be reloaded if changed. I assume from the language there that would include routes.py - I think that should be mentioned there as a concern to turning on track_changes on a production server if routes.py might be modified.

In the section that talks about Application init:
'Make a symbolic link from "applications/init" to your application's folder.'
Add: (Note: changing where the symbolic links points while web2py is running is not supported and could cause hard to find errors.)
or words to that effect

In the section on URL rewrite, where it says:
Notice that if you edit routes.py, you must reload it. This can be done in two ways: by restarting the web server or by clicking on the routes reload button in admin. If there is a bug in routes, they will not reload.
Add: (Note: reloading routes while web2py is running is not supported and could cause hard to find errors. Note also that setting track_changes can result in routes being reloaded whenever the routes file is changed, and this is also not supported)

Original issue: http://code.google.com/p/web2py/issues/detail?id=847

with_alias not transcribed adequatly at field level

From [email protected] on November 05, 2012 15:23:16

What steps will reproduce the problem? 1. define a table with define_table('test',Field('name'),Field('firstname'))
2. in the controller, have:
count = db.test.id.count()
data = db().select(db.test.ALL,
count.with_alias('newName'),
groupby=db.test.id,
orderby=db.test.name)

  1. in the view displaying data, you get as headers:
    test.name test.firstname COUNT(test.id) AS newName What is the expected output? What do you see instead? test.name test.firstname newName What version of the product are you using? On what operating system? trunk, Windows 7

Original issue: http://code.google.com/p/web2py/issues/detail?id=1141

Using Translations in non-web based api's

From [email protected] on March 20, 2012 16:41:53

What steps will reproduce the problem? 1. Create a standalone python file, that uses DAL
2. Create a console application which tests the api in step 1
3. Need to translate the output What is the expected output? What do you see instead? Ideally would like to be able to use Translations with or without an output. Instead I found out you require an request to use API in a self contained script. What version of the product are you using? On what operating system? 1.99.7 Please provide any additional information below. Attached is an example application. The Console output and menu I would like to be able to translate.

Required: gluon must be in your python path.

Attachment: api.py

Original issue: http://code.google.com/p/web2py/issues/detail?id=725

AddGeometryColumn fails with a field name having capital letters

From [email protected] on January 08, 2013 18:38:55

What steps will reproduce the problem? 1. Define a table as follows:
db.define_table('test_geo1_name',
Field('name_P', 'string'),
Field('location_P','geometry()'),
)
2. in the db you will get the field name_p and location_P respectively What is the expected output? What do you see instead? to have the field name_p and location_p respectively What version of the product are you using? On what operating system? trunk Please provide any additional information below. See the discussion on the web2py group: https://groups.google.com/d/msg/web2py/6DDLVv4jt0w/E3NIhFEUrgsJ

Original issue: http://code.google.com/p/web2py/issues/detail?id=1259

Enhancement: Autocomplete widget customized label name and capital letter

From [email protected] on September 20, 2012 16:44:19

Two enhancement requests related to Autocomplete widget

  1. Use two fields value for the label name
    db.TDMUSJ00.TRTRKN works fine but I want to do like db.TDMUSJ00.TRTRKN + "(" + db.TDMUSJ00.TRTRCD + ")" as label name.
  2. Look up the data whether it's small or capital letter
    Value in the database (db.TDMUSJ00.TRTRKN) is all capital and autocomplete doesn't look up the data when user type by small letters. Please provide any additional information below. https://groups.google.com/forum/?fromgroups=#!topic/web2py/udfbnKcfDBM

Original issue: http://code.google.com/p/web2py/issues/detail?id=1022

db.import_from_csv_file() doesn't maintain foreign keys when UUID field is present

From [email protected] on October 16, 2012 15:35:24

What steps will reproduce the problem? stable = db.define_table("source", Field("uuid"))
dtable = db.define_table("data", Field("source_id", db.source))
stable.insert(uuid="First")
stable.insert(uuid="Second")
stable.insert(uuid="Third")
db(stable.id==2).delete()
dtable.insert(source_id=3)
db.commit()
file = open("test.csv", "w")
db.export_to_csv_file(file)
file.close()
stable.truncate()
dtable.truncate()
file = open("test.csv", "r")
db.import_from_csv_file(file)
db(stable.id>0).select().json()
db(dtable.id>0).select().json() What is the expected output? What do you see instead? I would expect db(dtable.id==1).select().first().source_id to point to db(stable.uuid=="Third").select().first().id
I see:
In [16]: db(dtable.id>0).select().json()
Out[16]: '[{"source_id": 3, "id": 1}]'
In [17]: db(stable.id>0).select().json()
Out[17]: '[{"id": 1, "uuid": "First"}, {"id": 2, "uuid": "Third"}]' What version of the product are you using? On what operating system? Current Trunk ( 3a1ba53 , Mon Oct 15 21:49:43).
Have tried multiple OS (Win32, Linux) & multiple DBs (SQLite, Postgres)

Original issue: http://code.google.com/p/web2py/issues/detail?id=1095

Querying on 1:M Relationships in Grid and Smartgrid

From [email protected] on September 05, 2012 22:07:38

Hello,

We're building a web2py application that leverages SQLFORM.smartgrid heavily. Out of the box, this does not support filtering on 1:M relationships, or reference fields on the model. We understand the concerns about this: It could potentially be a huge performance hit, especially if the related table has a large number of rows.

On the other hand, this functionality is very valuable. Being able to filter on related tables is a very common need in applications. Often, users need to filter on "lookup" tables that have a relatively small number of rows, and the performance hit is negligible. This is a very common feature in Django, and in Rails admin interfaces like ActiveScaffold and RailsAdmin.

Example:

Given a model like this:

db.define_table('book',
Field('user_id', 'reference auth_user'),
Field('title'),
Field('genre'))

And a controller like this:

def index():
grid = SQLFORM.smartgrid(db.book)
return dict(grid=grid)

The query interface will look like this by default: http://i49.tinypic.com/2ugjt02.jpg Note how this includes title and genre, but not the auth_user reference.

We patched web2py to allow to for 1:M reference fields in the query interface. The resulting interface and generated query look something like this: http://i46.tinypic.com/28taq74.png Here is our simple patch to allow searching on reference fields like this (web2py version 1.99.7): https://gist.github.com/ff543a5c6d3bc14b9079 This is obviously NOT ready for production; it's a simple proof of concept. Note the potentially very expensive "ALL" query. Because of the performance risks, something like this only makes sense if developers can opt in, i.e. explicitly say so if they want to include a given reference field in the query interface.

  1. Would the web2py maintiners be interested in a feature like this if it is opt-in? I'm willing to devote some time to submit a more robust patch if I could get some guidance.
  2. I also have a simple implementation for querying on list:reference fields that I can share as well.

Finally, I just want to thank the web2py team. I've really enjoyed using the framework and hope to help out as much as I can.

Thanks,
Mike Leone
Principal, Engineering
Panoptic Development, Inc.


On Friday, August 31, 2012 5:48:17 PM UTC-4, Massimo Di Pierro wrote:
Hello Mike,

thanks for your patch? Would you please attach it to a google code issue so we do not forget. We cannot add new feaures until all 2.0.x issues have been resolved.

Original issue: http://code.google.com/p/web2py/issues/detail?id=979

SQLFORM.factory + Multiple Tables + Upload Field + GAE Blob Problem

From KJungHyun on August 21, 2012 07:12:47

What steps will reproduce the problem? 1. Make two table, one should have file upload field
2. Make a form with the two tables with SQLFORM.factory
3. Upload file through the form on GAE
4. file_blob of a table is None What is the expected output? What do you see instead? file_blob should have binary data.
But the blob is None.
It occurs only with GAE server + SQLFORM.factory + Multiple Tables What version of the product are you using? On what operating system? 1.99.7 stable, I tested on Windows 7 and OS X. Please provide any additional information below. This issue was asked here. https://groups.google.com/forum/?fromgroups=#!topic/web2py/yUtVm40eGwk

Original issue: http://code.google.com/p/web2py/issues/detail?id=948

Adapter to OrientDB

From [email protected] on September 03, 2011 20:23:02

What steps will reproduce the problem? 1. 2. 3. What is the expected output? What do you see instead? What version of the product are you using? On what operating system? Please provide any additional information below. I wish to collaborate on/test one as I am not a super Python pro yet. This Document-Graph database has a SQL syntax, RESTful interface, and the Gremlin graph traversal language bundled into it.

That brings untold power to web2py to store/retrieve schema-less, schema-mixed and schema-full data which can be traversed orders of magnitude faster than traditional RDBMS.

ACID, transactions, network pooling, more that I haven't discovered yet.

Thank you all for your work. web2py is the best and adding OrientDB communication to it would make heads explode across the globe.

Original issue: http://code.google.com/p/web2py/issues/detail?id=407

Add native edit support in SQLFORM.factory

From [email protected] on September 04, 2012 09:27:23

What steps will reproduce the problem? 1. SQLFORM.factory works great to create form with fields belonging to several tables. The form generated allow user to just insert data, you are not able to edit preexisting
2. A quite dirty and verbose way to do so is to change the default values of the fields before creating the form. https://groups.google.com/d/topic/web2py/wZHn9oiL1ZQ/discussion 3. What is the expected output? What do you see instead? The expected output is a form with inside the data that can be modified What version of the product are you using? On what operating system? Trunk, ubuntu 12.04 Please provide any additional information below.

Original issue: http://code.google.com/p/web2py/issues/detail?id=975

Profile update does not update auth.user object for computed field

From [email protected] on November 14, 2012 21:46:56

What steps will reproduce the problem? 1. Have both 'upload' field and computed field for auth_user table
2. Update the 'upload' field through auth.profile() form
3. Click on 'save profile' What is the expected output? What do you see instead? Expect that the auth.user object will be updated for all fields. Only the 'upload' field is updated; the computed field does not change in the auth.user object. What version of the product are you using? On what operating system? Web2py 2.2.1
Ubuntu 12.04 Please provide any additional information below.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1164

setup-web2py-nginx-uwsgi-ubuntu.sh doesn't work for Ubuntu Server version 11.10 (Oneiric Ocelot)

I run web2py on Amazon AWS on their recommended Ubuntu distribution.

There is a problem with this script in the way it sets up the uwsgi packages, primarily uwsgi-python has been replaced with uwsgi and uwsgi-plugin-python.

It's an easy fix and I'm happy to do it, but seeing as this script was written for 10.4 I wonder if it should be a new script for 11.10?

Thoughts?

Cheers,
Robin

Executing a select query on a latin-1 table with utf-8 character creates internal error

From [email protected] on March 30, 2012 13:57:43

What steps will reproduce the problem? 1. Set up a mysql database with a table using latin-1
2. Create a page with a form that executes a select on this table
3. Input some character in the form that isn't in latin-1, such as ŋ (alt-gr + u on linux, u'\u014b' in unicode) What is the expected output? What do you see instead? The request should not generate an internal error. The resulting ticket says:
InternalError: (1267, u"Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") What version of the product are you using? On what operating system? 1.99.4 on debian linux Please provide any additional information below. I tried setting the optional argument db_coded = 'latin1' when creating the DAL object, but this does not improve the situation

I'm not sure what the desired result would be if you do this in a form though

Original issue: http://code.google.com/p/web2py/issues/detail?id=744

How to add extra options to drop-drown menu in query section of SQLFORM.grid?

From [email protected] on November 29, 2012 05:18:45

  1. I have two tables in my application:
    status_tbl:
    Fields:
    serial_no,
    event,
    updated_on,
    interval_time

device_config:
device_name,
owner_email_id,
serial_no

  1. I have to display the grid view of status_tbl so when I display the grid of this table and checked the drop-down options of query field, it displays id,serial_no,event,updated_on and interval_time.

I want to display device_name and owner_email_id as well in option drop-down, so drop-down menu should display id,serial_no,event,updated_on,interval_time,device_name and owner_email_id.

Issues:

  1. How to make it possible to display fields of other table in grid view of another table and upon selecting of extra fields , user should be able to execute the query(search, clear etc...)?
  2. Please provide me the solution of displaying and hiding these extra fields on the grid means I may display some of these extra fields to the grid and some of not but query should work even those extra fields not displayed on the grid.

I am using web2py2.1.1 version on windows XP machine, but fix should work on other OS also.

I am flexible to move to latest version of web2py version so please provide me the solution of it and the version of web2py on which it will be fixed so i will migrate to that version.

Regards,
Amit

Original issue: http://code.google.com/p/web2py/issues/detail?id=1195

MENU helper issue

I think that there is small issue in the serialize function provided by the MENU helper. At line 2110 (html.py) the variable link should be replaced by the variable name. The code should be:

[...]
(name, active, link) = item[:3]
    if isinstance(name,DIV):
        li = LI(name)
[...]

instead of :

[...]
(name, active, link) = item[:3]
    if isinstance(link,DIV):
        li = LI(link)
[...]

Polymodel class not working properly

From [email protected] on December 05, 2012 11:19:20

What steps will reproduce the problem? 1. Model
define_table('location',
Field('name', 'string'),
Field('active', 'boolean'),
polymodel = True)

define_table('location_outdoor',
db.location,
Field('country', 'string'),
Field('city', 'string'),
Field('postcode', 'string'),
Field('street', 'string'),
Field('building', 'string'),
polymodel = db.location)

define_table('location_indoor',
db.location
Field('location_outdoor', db.location_outdoor),
Field('floor', 'string'),
Field('room', 'string'),
polymodel = db.location)

  1. Controller
    @auth.requires_signature()
    def form():

    table = request.args(0)
    if not table in db.tables(): redirect(URL('error'))
    db[table].id.readable = False
    form = SQLFORM.grid(db[table],args=request.args[:1], user_signature=True)
    return dict(form=form)

  2. View
    Default What is the expected output? What do you see instead? I expect to be able to create / read / update / delete from db.location, db.location_outdoor and db.location_indoor.
    While there are no records in _outdoor or _indoor I'm able to read all the tables. Once I enter a record in _outdoor or _indoor I can't access the other one anymore.
    When I do call "http://localhost:8080/init/location/form/location_outdoor?_signature=xxx' I receive: AttributeError: 'location' object has no attribute 'country'
    When I call "http://localhost:8080/init/location/form/location_indoor?_signature=xxx' I receive: AttributeError: 'location_outdoor' object has no attribute 'location_outdoor' What version of the product are you using? On what operating system? web2py: 2.2.1
    Deployed on: Google App Engine (GAE) Please provide any additional information below. I'm trying to store all location information (outdoor / indoor) in one polymodel. I do want to take advantage of having to have only one reference between devices and locations.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1201

Support for HTTP Digest Authentication

From [email protected] on July 03, 2012 17:37:36

Problem:
I'm building mobile apps using PhoneGap, whose frontend cannot be generated server-side using web2py views (templates).

Solution:
Build the frontend using JavaScript with JSONRPC calls to the web2py server. Control authentication using the RFCified Digest Access Authentication.

Example (from http://en.wikipedia.org/wiki/Digest_access_authentication ):

• The client asks for a page that requires authentication but does not provide a username and password. Typically this is because the user simply entered the address or followed a link to the page.
• The server responds with the 401 "client-error" response code, providing the authentication realm and a randomly-generated, single-use value called a nonce.
• At this point, the browser will present the authentication realm (typically a description of the computer or system being accessed) to the user and prompt for a username and password. The user may decide to cancel at this point.
• Once a username and password have been supplied, the client re-sends the same request but adds an authentication header that includes the response code.
• In this example, the server accepts the authentication and the page is returned. If the username is invalid and/or the password is incorrect, the server might return the "401" response code and the client would prompt the user again.

Original issue: http://code.google.com/p/web2py/issues/detail?id=872

SQLFORM.grid/SQLTABLE does not work without "id" field

From [email protected] on December 01, 2011 16:31:53

What steps will reproduce the problem? 1. Create table without id field but another primary key field
2. Define table using primarykey
3. Create SQLFORM.grid or SQLTABLE just like you normally do What is the expected output? What do you see instead? They are great features and I want them to support primarykey. Otherwise, you can not really use the existing tables for it. In my case, no tables has "id" field. What version of the product are you using? On what operating system? Version 1.99.2
Tested with DB2 and SQL Server 2008 Please provide any additional information below. https://groups.google.com/group/web2py/browse_thread/thread/f069cefe96e0e08a/844522760b98572f?lnk=gst&q=What&#37;27s+the+best+way+to+paginate+without+SQLFORM.gird+&#37;3F+Options+#844522760b98572f

Original issue: http://code.google.com/p/web2py/issues/detail?id=547

.tables files generated by new define_tables doesn't match that of fake_migrate

From [email protected] on October 30, 2012 19:40:56

What steps will reproduce the problem? 1. Create a table in an app - save and execute app to create in db
2. Now in a separate app reference the db and set migrate=False, fake_migrate = True
3. This should create the .table file in the databases directory for that app. What is the expected output? What do you see instead? I feel that the .table files from both apps should be the same

But, the .table file generated in step one has all lowercase field names whereas the .table file in step 2 creates the field names in mixed case

attached files -> testMachine file was generated from db.py
productionMachine file was generated from fake_migrate=True What version of the product are you using? On what operating system? Updated from trunk this morning, Version 2.2.1 (2012-10-29 22:25:15) Please provide any additional information below.

Attachment: testMachine_district.table productionMachine_district.table

Original issue: http://code.google.com/p/web2py/issues/detail?id=1126

Dynamic css injection feature

From [email protected] on February 15, 2012 07:39:02

Purpose of code changes on this branch: There are times that some pages of our app will be loaded inside an iframe (rather than in the main page via LOAD(..., "foo.load", ajax=True)). In this situation we will hope the loaded page displays no header, footer, topbar.

Instead of maintaining two independent copies of full-stuff page and contents-only page, I come up with a trick to let one same page have different appearances, controlled by different url parameters.

The normal, full-stuff page: http://my_site/app/cont/action

The contents-only page: http://my_site/app/cont/action#css_injection_begin .header, .footer, .topbar, #header, #footer, #statusbar {display:none} css_injection_end

This feature is achieved by following code at the end of generic.html (or layout.html if you prefer):

<script> var matched = new RegExp('_css_injection_begin_(.+)_css_injection_end_').exec(location.href); if(matched){ document.write("<style>"+unescape(matched[1])+"</style>");//Python escapes comma and colon, decodeURL() does not unescape them back, but unescape() does.

}
</script>

Original issue: http://code.google.com/p/web2py/issues/detail?id=662

include does not works combined with super in template blocks

From rochacbruno on September 03, 2012 03:34:11

What steps will reproduce the problem? 1. create a side file for the menu

views/sidebar.html

  • Main
1. Create a block on layout.html and inside the block put {{include ''}} {{block sidebar}}

Sidebar

{{include 'sidebar.html'}} {{end}} 2. Now go to any view and try to override the block extending super # views/default/index.html

{{extend 'layout.html'}}
{{block sidebar}}
{{super}}

  • a menu
{{end}}

What is the expected output?

Sidebar

  • Main
  • a menu

What do you see instead?

Sidebar

  • a menu
Please use labels and text to provide additional information. using {{super}} ignores the {{include ''}} that extended block has.

Original issue: http://code.google.com/p/web2py/issues/detail?id=971

dal fail to query on fields other than id on couchdb

From [email protected] on October 05, 2012 22:17:57

What steps will reproduce the problem? db=DAL('couchdb://127.0.0.1:5984')
db.define_table('person',Field('name'))
db.person.insert(name='john')
print db(cdb.person.name == "john").select()
will alway return empty object What is the expected output? What do you see instead? return the correct object What version of the product are you using? On what operating system? web2py 2.0.9 Please provide any additional information below.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1071

Smart query (SmartGrid) errors with REST in GAE and datetime greater than query (when time is not included)

From [email protected] on April 19, 2012 23:15:54

What steps will reproduce the problem? 1. Create a table with a datetime field, and populate it with correct datetime data using the database administration console. I have called my table call below.
2. Create a smartquery REST interface. Something like:

@request.restful()
#@auth.requires_login()
def calldatasmart():
response.view = 'generic.'+request.extension
def GET(search):
try:
rows = db.smart_query([db.call],search).select()
return dict(result=rows)
except RuntimeError:
raise HTTP(400,"Invalid search string")
return locals()

  1. In web2py on SQLlite you can call the REST interface with just a date query and it will work:
    If I put in:

http://localhost:8000/api/calldatasmart.json?search=call.start is greater than "2010-03-14"
I get a valid response.

In web2py on GAE, (and populate data in table call as above) when calling the same REST interface with just a date query, I get an error, however with a datetime query I get an error:

http://localhost:8000/api/calldatasmart.json?search=call.start is greater than "2010-03-14"
Errors with

ValueError: invalid literal for int() with base 10: '' in version 1.99.7 and also in modified Trunk.

http://localhost:8080/api/calldatasmart.json?search=call.start is greater than "2010-03-14 20:58:54"
IT WORKS PERFECTLY, at least in the TRUNK - note have not tried this in 1.99.7 yet (however I hope it works) What is the expected output? What do you see instead? In GAE when I smartquery using a date only, I expect GAE and SQLLite to work the same. i.e. that it either returns a Null set or a valid row from the table. Similarly the query with datetime should work. Note I now know that a datetime request will work it seems so I can go forward as can others. What version of the product are you using? On what operating system? I tested this in 1.99.7 and also in the Trunk from as of at 18th April 2012. Please provide any additional information below. Massimo requested I create this bug, although as I said the workaround is fine for GAE, although it is not consistent that the call works in SQLLite and not in GAE.

Original issue: http://code.google.com/p/web2py/issues/detail?id=769

smartgrid with lazy_tables=True and postgresql fails to show references

From [email protected] on October 15, 2012 14:41:55

This bug report comes in the sequence of a conversation started here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/nLLkD-2NZqE ** What steps will reproduce the problem? **

Starting with a clean database and database folder:

  1. In the model (db.py) have something like this:

db = DAL('postgres://teste:teste@localhost/teste', lazy_tables=True)

from gluon.tools import Auth
auth = Auth(db, hmac_key=Auth.get_or_create_key())

db.define_table('x', Field('name'), format='%(name)s')
db.define_table('y', Field('name'), Field('x', 'reference x'), format='%(name)s')
db.define_table('z', Field('name'), Field('x', 'reference x'), format='%(name)s')

if db(db.x.id > 0).count() == 0:
db.x.insert(name='test')

  1. In the controller have:

def index2():
return dict(grid=SQLFORM.smartgrid(db.x))

  1. In view index2.html have:
    {{extend 'layout.html'}}
    {{=grid}}
  2. Visit index.html in your browser.
  3. Visit index2.html
  4. observe that the y and z references are not in the x grid
  5. Set lazy_tables=False, visit index2.html notice visit index2.html again, see that y and z references are now present in the grid. Setting lazy_tables=True will make them disappear again.

** What is the expected output? What do you see instead? **

The y and z references should always appear in the smartgrid.

** What version of the product are you using? On what operating system? **

web2py 2.0.9, Windows 7, postgresql 9.2

** Please provide any additional information below. **

This was tested using the included rocket server.

Original issue: http://code.google.com/p/web2py/issues/detail?id=1091

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.