Commit graph

63 commits

Author SHA1 Message Date
smurail
dd8bf4fa2f add a way to instantiate an object from a dict of its fields values 2015-05-07 14:32:57 +02:00
Bezleputh
a3d351eb88 [base] create enum in base and use it in calendar and housing 2015-03-13 00:05:35 +01:00
Pierre Mazière
178c7cd406 add the possibility to define Field type argument as a string
instead of:
class A:
    x = Field("This must be an instance of class B",B)

we could write:
class A:
    x = Field("This must be an instance of class B","B")

The use case is when B is a child of A and thus cannot be used
before its definition

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2015-01-31 15:34:38 +01:00
smurail
d9065796e9 add Emirati Dirham AEB currency 2014-10-13 22:48:55 +02:00
Laurent Bachelier
21e8f82fd7 pep8: Use "X not in Y" instead of "not X in Y"
flake8 --select E713, semi-manual fixing
2014-10-11 01:27:24 +02:00
Laurent Bachelier
448c06d125 pep8 blank lines fixes
flake8 --select W391,E302,E301,E304

autopep8 can't fix W391 even though it claims it can.
Fixed using a simple custom script.
2014-10-10 23:41:44 +02:00
Florent
44dffce7b2 Rename CapBase to Capability 2014-09-26 10:18:12 +02:00
Florent
5a1d83b567 Rename BaseModule to Module and Module to LoadedModule 2014-09-26 10:18:12 +02:00
Florent
8559af3d6a s/BaseBackend/BaseModule 2014-09-26 10:18:11 +02:00
smurail
bb4e91aa2e prevent mess when copying BaseObject instances
Note: to understand this fix, see AbstractElement.__init__ -- it calls
deepcopy on parent.env, it caused copying of objects we do not want to
copy such as thread locks.
2014-09-22 17:33:02 +02:00
smurail
1b3b9a72ff let get_currency guess US$ means USD 2014-09-11 19:46:00 +02:00
Romain Bignon
52899a7ca9 add __repr__ on NotAvailable, NotLoaded and _NO_DEFAULT constants to be more readable on doc 2014-09-03 07:21:23 +02:00
smurail
a6972d3958 add LBP to currencies 2014-07-09 19:02:23 +02:00
Florent
e5f11a15eb s/IBaseCap/CapBase/ (refs #1424) 2014-07-09 12:59:31 +02:00
Florent
537b49e6bd DateField/TimeField/Delta are not really a base object 2014-07-09 11:46:46 +02:00
Romain Bignon
51958135cb rename CapBaseObject to BaseObject (refs #1424) 2014-07-05 17:26:05 +02:00
Romain Bignon
6fcac89dd5 first step in python3 support 2014-05-17 14:27:55 +02:00
Florent
f6ee441d08 Fix documentation of get_currency 2014-04-02 10:55:45 +02:00
Florent
74b99c4a8d Filters on kwargs for find_object 2014-04-02 10:46:31 +02:00
Florent
6591785a10 s/find_id_list/find_object/ 2014-04-02 10:31:00 +02:00
Florent
080c4aff81 Introduce find_id_list
And code simplification in backends/browsers
2014-04-01 17:40:38 +02:00
Romain Bignon
03ce941ccf Revert "Rewrite the empty function according to the new NotLoaded"
This reverts commit 22606d961f.
2014-03-19 09:16:05 +01:00
Romain Bignon
892b3634a3 copy of NotLoaded and NotAvailable returns the same object 2014-03-19 09:15:38 +01:00
Florent
22606d961f Rewrite the empty function according to the new NotLoaded
and the new NotAvailableType...
2014-03-18 12:02:26 +01:00
Florent
fc6f7d8c21 NotAvailable and NotLoaded should not be callable 2014-03-18 11:51:02 +01:00
Romain Bignon
8d7f613f59 do not require an id, because of ItemElement which constructs objects without arguments 2014-03-10 13:11:07 +01:00
Romain Bignon
6099560b8c change currencies integer constants to ISO code strings 2014-02-16 19:48:17 +01:00
Florent
4d5b84a2a8 Move Currency from ICapBank to ICapBase 2013-07-30 10:35:25 +02:00
Romain Bignon
59dea09c8a fix problem with strftime on date.year<1900 2013-03-30 12:30:33 +01:00
Laurent Bachelier
75b428af07 Code style fixes
autopep8 -ir -j2 --select=W601,W602 .
Diff checked manually.
2013-03-16 00:52:43 +01:00
Julien Veyssier
3492dbb9d6 imdb and cineoob in progress 2013-03-13 01:16:35 +01:00
Julien Veyssier
af8a3e5bd5 new cap cinema 2013-03-13 01:16:34 +01:00
Laurent Bachelier
a6fbcbaec7 Reconcile the two previous commits (json/to_dict)
Also fix some to_dict move things that were incomplete.
And some PEP8 fixes.

closes #1060
closes #1061
2013-03-09 15:14:17 +01:00
Julien Hebert
1b47455225 refs #1060 : move to_dict to base.py 2013-03-09 14:57:09 +01:00
Romain Bignon
8550c17cf7 do not cry if an object in not support to be filled by a backend 2013-01-30 11:34:28 +01:00
Romain Bignon
6f46c41743 do not fail during fullobj() if the object is not supported by backend 2012-04-28 16:38:55 +02:00
Romain Bignon
798c51daf9 do not include 'id' in fields if it was removed (-s) 2012-04-26 12:12:55 +02:00
Romain Bignon
aea269e9f6 create UserError exception
Modules can raise this exception when they want to print errors to user
2012-04-25 13:43:52 +02:00
Romain Bignon
5098b3f458 print a warning when a module adds an attribute to a CapBaseObject not prefixed with a _ 2012-04-21 22:38:48 +02:00
Romain Bignon
efb18d9dce add a method copy() 2012-04-03 22:40:02 +02:00
Romain Bignon
b157e92d5b use decimal.Decimal instead of float to store amounts of money 2012-03-29 16:31:18 +02:00
Laurent Bachelier
3b2bafdf12 Centralize "empty" comparisons
And always use "is" instead of "==".
2012-03-27 12:14:37 +02:00
Romain Bignon
7201d81d98 do not implicitly convert strings to dates in DateField 2012-03-27 11:54:54 +02:00
Laurent Bachelier
331b580fb8 Warn when implicit conversions happen
To display them, you can use the python -W argument
or the PYTHONWARNINGS environment variable.
Maybe debug mode should display them.
2012-03-26 23:34:23 +02:00
Romain Bignon
4ea7872ba4 fix setting None, NotLoaded and NotAvailable values on fields 2012-03-26 22:56:10 +02:00
Romain Bignon
9f86437ea1 do not check anymore if all CapBaseObject have docstrings 2012-03-26 14:41:24 +02:00
Romain Bignon
c6a141595c change way to describe fields of CapBaseObject, and lot of documentation 2012-03-26 14:35:54 +02:00
Laurent Bachelier
006e97a8be PEP8 style fixes and other small style fixes
I used autopep8 on some files and did carefully check the changes.
I ignored E501,E302,E231,E225,E222,E221,E241,E203 in my search, and at
least E501 on any autopep8 run.

Other style fixes not related to PEP8:
* Only use new-style classes. I don't think the usage of old-style
  classes was voluntary. Old-style classes are removed in Python 3.
* Convert an if/else to a one-liner in mediawiki, change docstring style
  change to a comment something that wasn't really appropriate for a
  docstring.
* Unneeded first if condition in meteofrance
2012-03-14 04:51:46 +01:00
Romain Bignon
4afac2a0d0 add method CapBaseObject.set_empty_fields()
This method can be used to fill all empty fields with the same value.

A field is empty when is value is None, NotLoaded or NotAvailable.

Example:

     # It will be impossible to get all empty fields, except
     # of 'url' (with a call to fillobj())
     video.set_empty_fields(NotAvailable, ('url',))
2012-03-12 13:42:00 +01:00
Romain Bignon
f6c2edc64f add a 'fullid' property to get 'ID@backend' 2012-02-18 12:27:18 +01:00