From b0595c791d17d1c7aa3140d9b8a11f064e13ad27 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 25 Dec 2012 23:58:46 +0100 Subject: Work on PyPI packaging --- COPYING | 674 ---------------------------------------------------- LICENSE.txt | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++ MANIFEST.in | 14 ++ README | 3 - README.txt | 33 +++ chimere/__init__.py | 12 +- setup.py | 25 +- 7 files changed, 738 insertions(+), 697 deletions(-) delete mode 100644 COPYING create mode 100644 LICENSE.txt create mode 100644 MANIFEST.in delete mode 100644 README create mode 100644 README.txt diff --git a/COPYING b/COPYING deleted file mode 100644 index 94a9ed0..0000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d7b289e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,14 @@ +include *.txt COPYING +include chimere/tests/* +prune docs/*/build/ +prune example_project/local_settings.py +include example_project/*.sample +include docs/*/*.rst Makefile +include docs/*/Makefile +include docs/*/conf.py +include docs/*/static/*.png +recursive-include apache *.conf *.wsgi +recursive-include chimere/templates *.html *.csv *.kml +recursive-include chimere/static *.css *.js *.png *.gif *.swf +recursive-include chimere/locale *.po +recursive-include chimere/fixtures *.json diff --git a/README b/README deleted file mode 100644 index 6faac19..0000000 --- a/README +++ /dev/null @@ -1,3 +0,0 @@ -To generate the documentation run the generate script in the docs directory. -By default the documentation is generated in english. To generate for a -different language add the appropriate language code as a parameter. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..a989d5f --- /dev/null +++ b/README.txt @@ -0,0 +1,33 @@ +======= +Chimère +======= + +Chimère is a cartographic mashup using OpenStreetMap as a default map layer. +This software aims to create online collaborative and thematic maps. Content +(multimedia, text) are associated to basic geographics items (Point Of Interest, +routes). Add on the map are open to everybody with no authentification but are +moderated by a team in charge of the map. + +Features: + - Display (by default) of the mapnik OpenStreetMap layer. + - Display on the map of POIs (with markers) and routes (with colored + polylines). + - Thematic choices of items to display (POIs and routes). + - Filter themes in regard to currently available items. + - Display of the detail of a POI (name, description, pictures, multimedia + files). + - Add of a cartographic item (POI, route) on the map by an user without + authentication (the item is only available after moderation). + - Admin interface for moderation and configuration. + - Cut a Chimère by "areas". Each "area" can have specific themes, a new default + center, welcome message, bounding box, allow of restriction to a bounding + box, activation of dynamic themes, available themes, themes checked by + default. + - Import and export of data. Available formats are: ShapeFile, KML, GeoRSS + (import only), CSV and OSM. + - Configuration of map layers in administration interface. By default these + cartographic items are available: OSM Mapnik, MapQuest, OSM Transport, + Cyclemap. + + +Full documentation is available on `Read the docs `_. diff --git a/chimere/__init__.py b/chimere/__init__.py index a7083c7..f4026c3 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -1,12 +1,18 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2012 Étienne Loks +import os +os.environ['DJANGO_SETTINGS_MODULE'] = 'example_project.settings' from django.utils.translation import ugettext as _ -# templates/chimere/edit.html, templates/chimere/edit_route.html -_(u"Multimedia files") -_(u"Picture files") +try: + # strings to be considered for translation + # templates/chimere/edit.html, templates/chimere/edit_route.html + _(u"Multimedia files") + _(u"Picture files") +except ImportError: + pass VERSION = (2, 0) diff --git a/setup.py b/setup.py index ca0c460..0e990a4 100644 --- a/setup.py +++ b/setup.py @@ -10,30 +10,21 @@ try: except (IOError, OSError): reqs = '' -def list_folder(path, extensions): - """ - Recursive function to list folders - extensions may be a list like ["css", "js", "html"] - """ - final = [] - for root, subfolders, filenames in os.walk(path): - for subfolder in subfolders: - for ext in extensions: - final.append("%s/%s/*.%s" % (root[len("chimere/"):], subfolder, ext)) - return final - setup( name='chimere', version=chimere.get_version(), description= - """Chimere is a kind of online “mashup” which is designed to aggregate geographic data from several sources. Chimere gets a map from OpenStreetMap and display other data added by users. Datas are freely submitted by visitors and then validated by an administrator.""", - author='Étienne Loks', + "Chimere is a kind of online “mashup” which is designed to aggregate "\ + "geographic data from several sources. Chimere gets a map from "\ + "OpenStreetMap and display other data added by users. Datas are freely "\ + "submitted by visitors and then validated by an administrator.", + long_description=open('README.txt').read(), + author=u'Étienne Loks', author_email='etienne.loks@peacefrogs.net', url='http://blog.peacefrogs.net/nim/chimere/', - packages=find_packages(exclude=["example", "example.*",]), + license='GPL v3 licence, see COPYING', + packages=find_packages(), include_package_data=True, - package_data={ - 'chimere': list_folder(os.path.join('chimere', 'static'), ["css", "js", "png"]) + list_folder(os.path.join('chimere', 'templates'), ["html"])}, install_requires=reqs, classifiers=[ 'Development Status :: 4 - Beta', -- cgit v1.2.3 From e83829d61609744d57ced53bcc4f2f1bd8747f25 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 2 Jan 2013 23:25:35 +0100 Subject: Minor changes for PyPI packaging --- CHANGES.txt | 1 + MANIFEST.in | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES.txt diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..6eccf6c --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1 @@ +2.0, 2012-01-02 -- First release for the second version. diff --git a/MANIFEST.in b/MANIFEST.in index d7b289e..53f651c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt COPYING +include *.txt COPYING MANIFEST.in include chimere/tests/* prune docs/*/build/ prune example_project/local_settings.py -- cgit v1.2.3 From 799048b21b465eb097c03b4936e0077cf9148466 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 2 Jan 2013 23:56:14 +0100 Subject: Small fixes. Precise external libs provided in the package in the readme. --- README.txt | 8 + chimere/external_utils | 1 - chimere/external_utils/OsmApi.py | 747 +++++++++++++++++++++++++++++++++++++ chimere/external_utils/__init__.py | 0 utils/OsmApi.py | 747 ------------------------------------- utils/__init__.py | 0 6 files changed, 755 insertions(+), 748 deletions(-) delete mode 120000 chimere/external_utils create mode 100644 chimere/external_utils/OsmApi.py create mode 100644 chimere/external_utils/__init__.py delete mode 100644 utils/OsmApi.py delete mode 100644 utils/__init__.py diff --git a/README.txt b/README.txt index a989d5f..de55062 100644 --- a/README.txt +++ b/README.txt @@ -31,3 +31,11 @@ Features: Full documentation is available on `Read the docs `_. + +External libs +============= + +To be fully functional, this package is provided with external libs: + - `OsmApi `, GPL v3. + - `prettyPhoto `, GPL v2. + - `jMediaelement `, GPL v2. diff --git a/chimere/external_utils b/chimere/external_utils deleted file mode 120000 index 19985ba..0000000 --- a/chimere/external_utils +++ /dev/null @@ -1 +0,0 @@ -../utils/ \ No newline at end of file diff --git a/chimere/external_utils/OsmApi.py b/chimere/external_utils/OsmApi.py new file mode 100644 index 0000000..3b1b9b1 --- /dev/null +++ b/chimere/external_utils/OsmApi.py @@ -0,0 +1,747 @@ +#-*- coding: utf-8 -*- + +########################################################################### +## ## +## Copyrights Etienne Chové 2009-2010 ## +## ## +## This program is free software: you can redistribute it and/or modify ## +## it under the terms of the GNU General Public License as published by ## +## the Free Software Foundation, either version 3 of the License, or ## +## (at your option) any later version. ## +## ## +## This program is distributed in the hope that it will be useful, ## +## but WITHOUT ANY WARRANTY; without even the implied warranty of ## +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## +## GNU General Public License for more details. ## +## ## +## You should have received a copy of the GNU General Public License ## +## along with this program. If not, see . ## +## ## +########################################################################### + +## HomePage : http://wiki.openstreetmap.org/wiki/PythonOsmApi + +########################################################################### +## History ## +########################################################################### +## 0.2.19 2010-05-24 Add debug message on ApiError ## +## 0.2.18 2010-04-20 Fix ChangesetClose and _http_request ## +## 0.2.17 2010-01-02 Capabilities implementation ## +## 0.2.16 2010-01-02 ChangesetsGet by Alexander Rampp ## +## 0.2.15 2009-12-16 xml encoding error for < and > ## +## 0.2.14 2009-11-20 changesetautomulti parameter ## +## 0.2.13 2009-11-16 modify instead update for osc ## +## 0.2.12 2009-11-14 raise ApiError on 4xx errors -- Xoff ## +## 0.2.11 2009-10-14 unicode error on ChangesetUpload ## +## 0.2.10 2009-10-14 RelationFullRecur definition ## +## 0.2.9 2009-10-13 automatic changeset management ## +## ChangesetUpload implementation ## +## 0.2.8 2009-10-13 *(Create|Update|Delete) use not unique _do method ## +## 0.2.7 2009-10-09 implement all missing fonctions except ## +## ChangesetsGet and GetCapabilities ## +## 0.2.6 2009-10-09 encoding clean-up ## +## 0.2.5 2009-10-09 implements NodesGet, WaysGet, RelationsGet ## +## ParseOsm, ParseOsc ## +## 0.2.4 2009-10-06 clean-up ## +## 0.2.3 2009-09-09 keep http connection alive for multiple request ## +## (Node|Way|Relation)Get return None when object ## +## have been deleted (raising error before) ## +## 0.2.2 2009-07-13 can identify applications built on top of the lib ## +## 0.2.1 2009-05-05 some changes in constructor -- chove@crans.org ## +## 0.2 2009-05-01 initial import ## +########################################################################### + +__version__ = '0.2.19' + +import httplib, base64, xml.dom.minidom, time, sys, urllib + +class ApiError(Exception): + + def __init__(self, status, reason, payload): + self.status = status + self.reason = reason + self.payload = payload + + def __str__(self): + return "Request failed: " + str(self.status) + " - " + self.reason + " - " + self.payload + +########################################################################### +## Main class ## + +class OsmApi: + + def __init__(self, + username = None, + password = None, + passwordfile = None, + appid = "", + created_by = "PythonOsmApi/"+__version__, + api = "www.openstreetmap.org", + changesetauto = False, + changesetautotags = {}, + changesetautosize = 500, + changesetautomulti = 1, + debug = False + ): + + # debug + self._debug = debug + + # Get username + if username: + self._username = username + elif passwordfile: + self._username = open(passwordfile).readline().split(":")[0].strip() + + # Get password + if password: + self._password = password + elif passwordfile: + for l in open(passwordfile).readlines(): + l = l.strip().split(":") + if l[0] == self._username: + self._password = l[1] + + # Changest informations + self._changesetauto = changesetauto # auto create and close changesets + self._changesetautotags = changesetautotags # tags for automatic created changesets + self._changesetautosize = changesetautosize # change count for auto changeset + self._changesetautosize = changesetautosize # change count for auto changeset + self._changesetautomulti = changesetautomulti # close a changeset every # upload + self._changesetautocpt = 0 + self._changesetautodata = [] # data to upload for auto group + + # Get API + self._api = api + + # Get created_by + if not appid: + self._created_by = created_by + else: + self._created_by = appid + " (" + created_by + ")" + + # Initialisation + self._CurrentChangesetId = 0 + + # Http connection + self._conn = httplib.HTTPConnection(self._api, 80) + + def __del__(self): + if self._changesetauto: + self._changesetautoflush(True) + return None + + ####################################################################### + # Capabilities # + ####################################################################### + + def Capabilities(self): + """ Returns ApiCapabilities. """ + uri = "/api/capabilities" + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + print data.getElementsByTagName("osm") + data = data.getElementsByTagName("osm")[0].getElementsByTagName("api")[0] + result = {} + for elem in data.childNodes: + if elem.nodeType <> elem.ELEMENT_NODE: + continue + result[elem.nodeName] = {} + print elem.nodeName + for k, v in elem.attributes.items(): + try: + result[elem.nodeName][k] = float(v) + except: + result[elem.nodeName][k] = v + return result + + ####################################################################### + # Node # + ####################################################################### + + def NodeGet(self, NodeId, NodeVersion = -1): + """ Returns NodeData for node #NodeId. """ + uri = "/api/0.6/node/"+str(NodeId) + if NodeVersion <> -1: uri += "/"+str(NodeVersion) + data = self._get(uri) + if not data: return data + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0].getElementsByTagName("node")[0] + return self._DomParseNode(data) + + def NodeCreate(self, NodeData): + """ Creates a node. Returns updated NodeData (without timestamp). """ + return self._do("create", "node", NodeData) + + def NodeUpdate(self, NodeData): + """ Updates node with NodeData. Returns updated NodeData (without timestamp). """ + return self._do("modify", "node", NodeData) + + def NodeDelete(self, NodeData): + """ Delete node with NodeData. Returns updated NodeData (without timestamp). """ + return self._do("delete", "node", NodeData) + + def NodeHistory(self, NodeId): + """ Returns dict(NodeVerrsion: NodeData). """ + uri = "/api/0.6/node/"+str(NodeId)+"/history" + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("node"): + data = self._DomParseNode(data) + result[data[u"version"]] = data + return result + + def NodeWays(self, NodeId): + """ Returns [WayData, ... ] containing node #NodeId. """ + uri = "/api/0.6/node/%d/ways"%NodeId + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = [] + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): + data = self._DomParseRelation(data) + result.append(data) + return result + + def NodeRelations(self, NodeId): + """ Returns [RelationData, ... ] containing node #NodeId. """ + uri = "/api/0.6/node/%d/relations"%NodeId + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = [] + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): + data = self._DomParseRelation(data) + result.append(data) + return result + + def NodesGet(self, NodeIdList): + """ Returns dict(NodeId: NodeData) for each node in NodeIdList """ + uri = "/api/0.6/nodes?nodes=" + ",".join([str(x) for x in NodeIdList]) + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("node"): + data = self._DomParseNode(data) + result[data[u"id"]] = data + return result + + ####################################################################### + # Way # + ####################################################################### + + def WayGet(self, WayId, WayVersion = -1): + """ Returns WayData for way #WayId. """ + uri = "/api/0.6/way/"+str(WayId) + if WayVersion <> -1: uri += "/"+str(WayVersion) + data = self._get(uri) + if not data: return data + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0].getElementsByTagName("way")[0] + return self._DomParseWay(data) + + def WayCreate(self, WayData): + """ Creates a way. Returns updated WayData (without timestamp). """ + return self._do("create", "way", WayData) + + def WayUpdate(self, WayData): + """ Updates way with WayData. Returns updated WayData (without timestamp). """ + return self._do("modify", "way", WayData) + + def WayDelete(self, WayData): + """ Delete way with WayData. Returns updated WayData (without timestamp). """ + return self._do("delete", "way", WayData) + + def WayHistory(self, WayId): + """ Returns dict(WayVerrsion: WayData). """ + uri = "/api/0.6/way/"+str(WayId)+"/history" + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): + data = self._DomParseWay(data) + result[data[u"version"]] = data + return result + + def WayRelations(self, WayId): + """ Returns [RelationData, ...] containing way #WayId. """ + uri = "/api/0.6/way/%d/relations"%WayId + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = [] + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): + data = self._DomParseRelation(data) + result.append(data) + return result + + def WayFull(self, WayId): + """ Return full data for way WayId as list of {type: node|way|relation, data: {}}. """ + uri = "/api/0.6/way/"+str(WayId)+"/full" + data = self._get(uri) + return self.ParseOsm(data) + + def WaysGet(self, WayIdList): + """ Returns dict(WayId: WayData) for each way in WayIdList """ + uri = "/api/0.6/ways?ways=" + ",".join([str(x) for x in WayIdList]) + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): + data = self._DomParseWay(data) + result[data[u"id"]] = data + return result + + ####################################################################### + # Relation # + ####################################################################### + + def RelationGet(self, RelationId, RelationVersion = -1): + """ Returns RelationData for relation #RelationId. """ + uri = "/api/0.6/relation/"+str(RelationId) + if RelationVersion <> -1: uri += "/"+str(RelationVersion) + data = self._get(uri) + if not data: return data + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0].getElementsByTagName("relation")[0] + return self._DomParseRelation(data) + + def RelationCreate(self, RelationData): + """ Creates a relation. Returns updated RelationData (without timestamp). """ + return self._do("create", "relation", RelationData) + + def RelationUpdate(self, RelationData): + """ Updates relation with RelationData. Returns updated RelationData (without timestamp). """ + return self._do("modify", "relation", RelationData) + + def RelationDelete(self, RelationData): + """ Delete relation with RelationData. Returns updated RelationData (without timestamp). """ + return self._do("delete", "relation", RelationData) + + def RelationHistory(self, RelationId): + """ Returns dict(RelationVerrsion: RelationData). """ + uri = "/api/0.6/relation/"+str(RelationId)+"/history" + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): + data = self._DomParseRelation(data) + result[data[u"version"]] = data + return result + + def RelationRelations(self, RelationId): + """ Returns list of RelationData containing relation #RelationId. """ + uri = "/api/0.6/relation/%d/relations"%RelationId + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = [] + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): + data = self._DomParseRelation(data) + result.append(data) + return result + + def RelationFullRecur(self, RelationId): + """ Return full data for relation RelationId. Recurisve version relation of relations. """ + data = [] + todo = [RelationId] + done = [] + while todo: + rid = todo.pop(0) + done.append(rid) + temp = self.RelationFull(rid) + for item in temp: + if item["type"] <> "relation": + continue + if item["data"]["id"] in done: + continue + todo.append(item["data"]["id"]) + data += temp + return data + + def RelationFull(self, RelationId): + """ Return full data for relation RelationId as list of {type: node|way|relation, data: {}}. """ + uri = "/api/0.6/relation/"+str(RelationId)+"/full" + data = self._get(uri) + return self.ParseOsm(data) + + def RelationsGet(self, RelationIdList): + """ Returns dict(RelationId: RelationData) for each relation in RelationIdList """ + uri = "/api/0.6/relations?relations=" + ",".join([str(x) for x in RelationIdList]) + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + result = {} + for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): + data = self._DomParseRelation(data) + result[data[u"id"]] = data + return result + + ####################################################################### + # Changeset # + ####################################################################### + + def ChangesetGet(self, ChangesetId): + """ Returns ChangesetData for changeset #ChangesetId. """ + data = self._get("/api/0.6/changeset/"+str(ChangesetId)) + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0].getElementsByTagName("changeset")[0] + return self._DomParseChangeset(data) + + def ChangesetUpdate(self, ChangesetTags = {}): + """ Updates current changeset with ChangesetTags. """ + if self._CurrentChangesetId == -1: + raise Exception, "No changeset currently opened" + if u"created_by" not in ChangesetTags: + ChangesetTags[u"created_by"] = self._created_by + result = self._put("/api/0.6/changeset/"+str(self._CurrentChangesetId), self._XmlBuild("changeset", {u"tag": ChangesetTags})) + return self._CurrentChangesetId + + def ChangesetCreate(self, ChangesetTags = {}): + """ Opens a changeset. Returns #ChangesetId. """ + if self._CurrentChangesetId: + raise Exception, "Changeset alreadey opened" + if u"created_by" not in ChangesetTags: + ChangesetTags[u"created_by"] = self._created_by + result = self._put("/api/0.6/changeset/create", self._XmlBuild("changeset", {u"tag": ChangesetTags})) + self._CurrentChangesetId = int(result) + return self._CurrentChangesetId + + def ChangesetClose(self): + """ Closes current changeset. Returns #ChangesetId. """ + if not self._CurrentChangesetId: + raise Exception, "No changeset currently opened" + result = self._put("/api/0.6/changeset/"+str(self._CurrentChangesetId)+"/close", u"") + CurrentChangesetId = self._CurrentChangesetId + self._CurrentChangesetId = 0 + return CurrentChangesetId + + def ChangesetUpload(self, ChangesData): + """ Upload data. ChangesData is a list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. Returns list with updated ids. """ + data = "" + data += u"\n" + data += u"\n" + for change in ChangesData: + data += u"<"+change["action"]+">\n" + change["data"]["changeset"] = self._CurrentChangesetId + data += self._XmlBuild(change["type"], change["data"], False).decode("utf-8") + data += u"\n" + data += u"" + data = self._http("POST", "/api/0.6/changeset/"+str(self._CurrentChangesetId)+"/upload", True, data.encode("utf-8")) + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("diffResult")[0] + data = [x for x in data.childNodes if x.nodeType == x.ELEMENT_NODE] + for i in range(len(ChangesData)): + if ChangesData[i]["action"] == "delete": + ChangesData[i]["data"].pop("version") + else: + ChangesData[i]["data"]["version"] = int(data[i].getAttribute("new_id")) + return ChangesData + + def ChangesetDownload(self, ChangesetId): + """ Download data from a changeset. Returns list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. """ + uri = "/api/0.6/changeset/"+str(ChangesetId)+"/download" + data = self._get(uri) + return self.ParseOsc(data) + + def ChangesetsGet(self, min_lon=None, min_lat=None, max_lon=None, max_lat=None, + userid=None, username=None, + closed_after=None, created_before=None, + only_open=False, only_closed=False): + """ Returns dict(ChangsetId: ChangesetData) matching all criteria. """ + + uri = "/api/0.6/changesets" + params = {} + if min_lon or min_lat or max_lon or max_lat: + params["bbox"] = ",".join([str(min_lon),str(min_lat),str(max_lon),str(max_lat)]) + if userid: + params["user"] = userid + if username: + params["display_name"] = username + if closed_after and not created_before: + params["time"] = closed_after + if created_before: + if not closed_after: + closed_after = "1970-01-01T00:00:00Z" + params["time"] = closed_after + "," + created_before + if only_open: + params["open"] = 1 + if only_closed: + params["closed"] = 1 + + if params: + uri += "?" + urllib.urlencode(params) + + data = self._get(uri) + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0].getElementsByTagName("changeset") + result = {} + for curChangeset in data: + tmpCS = self._DomParseChangeset(curChangeset) + result[tmpCS["id"]] = tmpCS + return result + + ####################################################################### + # Other # + ####################################################################### + + def Map(self, min_lon, min_lat, max_lon, max_lat): + """ Download data in bounding box. Returns list of dict {type: node|way|relation, data: {}}. """ + uri = "/api/0.6/map?bbox=%f,%f,%f,%f"%(min_lon, min_lat, max_lon, max_lat) + data = self._get(uri) + return self.ParseOsm(data) + + ####################################################################### + # Data parser # + ####################################################################### + + def ParseOsm(self, data): + """ Parse osm data. Returns list of dict {type: node|way|relation, data: {}}. """ + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osm")[0] + result = [] + for elem in data.childNodes: + if elem.nodeName == u"node": + result.append({u"type": elem.nodeName, u"data": self._DomParseNode(elem)}) + elif elem.nodeName == u"way": + result.append({u"type": elem.nodeName, u"data": self._DomParseWay(elem)}) + elif elem.nodeName == u"relation": + result.append({u"type": elem.nodeName, u"data": self._DomParseRelation(elem)}) + return result + + def ParseOsc(self, data): + """ Parse osc data. Returns list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. """ + data = xml.dom.minidom.parseString(data) + data = data.getElementsByTagName("osmChange")[0] + result = [] + for action in data.childNodes: + if action.nodeName == u"#text": continue + for elem in action.childNodes: + if elem.nodeName == u"node": + result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseNode(elem)}) + elif elem.nodeName == u"way": + result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseWay(elem)}) + elif elem.nodeName == u"relation": + result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseRelation(elem)}) + return result + + ####################################################################### + # Internal http function # + ####################################################################### + + def _do(self, action, OsmType, OsmData): + if self._changesetauto: + self._changesetautodata.append({"action":action, "type":OsmType, "data":OsmData}) + self._changesetautoflush() + return None + else: + return self._do_manu(action, OsmType, OsmData) + + def _do_manu(self, action, OsmType, OsmData): + if not self._CurrentChangesetId: + raise Exception, "You need to open a changeset before uploading data" + if u"timestamp" in OsmData: + OsmData.pop(u"timestamp") + OsmData[u"changeset"] = self._CurrentChangesetId + if action == "create": + if OsmData.get(u"id", -1) > 0: + raise Exception, "This "+OsmType+" already exists" + result = self._put("/api/0.6/"+OsmType+"/create", self._XmlBuild(OsmType, OsmData)) + OsmData[u"id"] = int(result.strip()) + OsmData[u"version"] = 1 + return OsmData + elif action == "modify": + result = self._put("/api/0.6/"+OsmType+"/"+str(OsmData[u"id"]), self._XmlBuild(OsmType, OsmData)) + OsmData[u"version"] = int(result.strip()) + return OsmData + elif action =="delete": + result = self._delete("/api/0.6/"+OsmType+"/"+str(OsmData[u"id"]), self._XmlBuild(OsmType, OsmData)) + OsmData[u"version"] = int(result.strip()) + OsmData[u"visible"] = False + return OsmData + + def flush(self): + return self._changesetautoflush(True) + + def _changesetautoflush(self, force = False): + while (len(self._changesetautodata) >= self._changesetautosize) or (force and self._changesetautodata): + if self._changesetautocpt == 0: + self.ChangesetCreate(self._changesetautotags) + self.ChangesetUpload(self._changesetautodata[:self._changesetautosize]) + self._changesetautodata = self._changesetautodata[self._changesetautosize:] + self._changesetautocpt += 1 + if self._changesetautocpt == self._changesetautomulti: + self.ChangesetClose() + self._changesetautocpt = 0 + if self._changesetautocpt and force: + self.ChangesetClose() + self._changesetautocpt = 0 + return None + + def _http_request(self, cmd, path, auth, send): + if self._debug: + path2 = path + if len(path2) > 50: + path2 = path2[:50]+"[...]" + print >>sys.stderr, "%s %s %s"%(time.strftime("%Y-%m-%d %H:%M:%S"),cmd,path2) + self._conn.putrequest(cmd, path) + self._conn.putheader('User-Agent', self._created_by) + if auth: + self._conn.putheader('Authorization', 'Basic ' + base64.encodestring(self._username + ':' + self._password).strip()) + if send <> None: + self._conn.putheader('Content-Length', len(send)) + self._conn.endheaders() + if send: + self._conn.send(send) + response = self._conn.getresponse() + if response.status <> 200: + payload = response.read().strip() + if response.status == 410: + return None + raise ApiError(response.status, response.reason, payload) + if self._debug: + print >>sys.stderr, "%s %s %s done"%(time.strftime("%Y-%m-%d %H:%M:%S"),cmd,path2) + return response.read() + + def _http(self, cmd, path, auth, send): + i = 0 + while True: + i += 1 + try: + return self._http_request(cmd, path, auth, send) + except ApiError, e: + if e.status >= 500: + if i == 5: raise + if i <> 1: time.sleep(5) + self._conn = httplib.HTTPConnection(self._api, 80) + else: raise + except Exception: + if i == 5: raise + if i <> 1: time.sleep(5) + self._conn = httplib.HTTPConnection(self._api, 80) + + def _get(self, path): + return self._http('GET', path, False, None) + + def _put(self, path, data): + return self._http('PUT', path, True, data) + + def _delete(self, path, data): + return self._http('DELETE', path, True, data) + + ####################################################################### + # Internal dom function # + ####################################################################### + + def _DomGetAttributes(self, DomElement): + """ Returns a formated dictionnary of attributes of a DomElement. """ + result = {} + for k, v in DomElement.attributes.items(): + if k == u"uid" : v = int(v) + elif k == u"changeset" : v = int(v) + elif k == u"version" : v = int(v) + elif k == u"id" : v = int(v) + elif k == u"lat" : v = float(v) + elif k == u"lon" : v = float(v) + elif k == u"open" : v = v=="true" + elif k == u"visible" : v = v=="true" + elif k == u"ref" : v = int(v) + result[k] = v + return result + + def _DomGetTag(self, DomElement): + """ Returns the dictionnary of tags of a DomElement. """ + result = {} + for t in DomElement.getElementsByTagName("tag"): + k = t.attributes["k"].value + v = t.attributes["v"].value + result[k] = v + return result + + def _DomGetNd(self, DomElement): + """ Returns the list of nodes of a DomElement. """ + result = [] + for t in DomElement.getElementsByTagName("nd"): + result.append(int(int(t.attributes["ref"].value))) + return result + + def _DomGetMember(self, DomElement): + """ Returns a list of relation members. """ + result = [] + for m in DomElement.getElementsByTagName("member"): + result.append(self._DomGetAttributes(m)) + return result + + def _DomParseNode(self, DomElement): + """ Returns NodeData for the node. """ + result = self._DomGetAttributes(DomElement) + result[u"tag"] = self._DomGetTag(DomElement) + return result + + def _DomParseWay(self, DomElement): + """ Returns WayData for the way. """ + result = self._DomGetAttributes(DomElement) + result[u"tag"] = self._DomGetTag(DomElement) + result[u"nd"] = self._DomGetNd(DomElement) + return result + + def _DomParseRelation(self, DomElement): + """ Returns RelationData for the relation. """ + result = self._DomGetAttributes(DomElement) + result[u"tag"] = self._DomGetTag(DomElement) + result[u"member"] = self._DomGetMember(DomElement) + return result + + def _DomParseChangeset(self, DomElement): + """ Returns ChangesetData for the changeset. """ + result = self._DomGetAttributes(DomElement) + result[u"tag"] = self._DomGetTag(DomElement) + return result + + ####################################################################### + # Internal xml builder # + ####################################################################### + + def _XmlBuild(self, ElementType, ElementData, WithHeaders = True): + + xml = u"" + if WithHeaders: + xml += u"\n" + xml += u"\n" + + # + xml += u" <" + ElementType + if u"id" in ElementData: + xml += u" id=\"" + str(ElementData[u"id"]) + u"\"" + if u"lat" in ElementData: + xml += u" lat=\"" + str(ElementData[u"lat"]) + u"\"" + if u"lon" in ElementData: + xml += u" lon=\"" + str(ElementData[u"lon"]) + u"\"" + if u"version" in ElementData: + xml += u" version=\"" + str(ElementData[u"version"]) + u"\"" + xml += u" visible=\"" + str(ElementData.get(u"visible", True)).lower() + u"\"" + if ElementType in [u"node", u"way", u"relation"]: + xml += u" changeset=\"" + str(self._CurrentChangesetId) + u"\"" + xml += u">\n" + + # + for k, v in ElementData.get(u"tag", {}).items(): + xml += u" \n" + + # + for member in ElementData.get(u"member", []): + xml += u" \n" + + # + for ref in ElementData.get(u"nd", []): + xml += u" \n" + + # + xml += u" \n" + + if WithHeaders: + xml += u"\n" + + return xml.encode("utf8") + + def _XmlEncode(self, text): + return text.replace("&", "&").replace("\"", """).replace("<","<").replace(">",">") + +## End of main class ## +########################################################################### diff --git a/chimere/external_utils/__init__.py b/chimere/external_utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/utils/OsmApi.py b/utils/OsmApi.py deleted file mode 100644 index 3b1b9b1..0000000 --- a/utils/OsmApi.py +++ /dev/null @@ -1,747 +0,0 @@ -#-*- coding: utf-8 -*- - -########################################################################### -## ## -## Copyrights Etienne Chové 2009-2010 ## -## ## -## This program is free software: you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation, either version 3 of the License, or ## -## (at your option) any later version. ## -## ## -## This program is distributed in the hope that it will be useful, ## -## but WITHOUT ANY WARRANTY; without even the implied warranty of ## -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program. If not, see . ## -## ## -########################################################################### - -## HomePage : http://wiki.openstreetmap.org/wiki/PythonOsmApi - -########################################################################### -## History ## -########################################################################### -## 0.2.19 2010-05-24 Add debug message on ApiError ## -## 0.2.18 2010-04-20 Fix ChangesetClose and _http_request ## -## 0.2.17 2010-01-02 Capabilities implementation ## -## 0.2.16 2010-01-02 ChangesetsGet by Alexander Rampp ## -## 0.2.15 2009-12-16 xml encoding error for < and > ## -## 0.2.14 2009-11-20 changesetautomulti parameter ## -## 0.2.13 2009-11-16 modify instead update for osc ## -## 0.2.12 2009-11-14 raise ApiError on 4xx errors -- Xoff ## -## 0.2.11 2009-10-14 unicode error on ChangesetUpload ## -## 0.2.10 2009-10-14 RelationFullRecur definition ## -## 0.2.9 2009-10-13 automatic changeset management ## -## ChangesetUpload implementation ## -## 0.2.8 2009-10-13 *(Create|Update|Delete) use not unique _do method ## -## 0.2.7 2009-10-09 implement all missing fonctions except ## -## ChangesetsGet and GetCapabilities ## -## 0.2.6 2009-10-09 encoding clean-up ## -## 0.2.5 2009-10-09 implements NodesGet, WaysGet, RelationsGet ## -## ParseOsm, ParseOsc ## -## 0.2.4 2009-10-06 clean-up ## -## 0.2.3 2009-09-09 keep http connection alive for multiple request ## -## (Node|Way|Relation)Get return None when object ## -## have been deleted (raising error before) ## -## 0.2.2 2009-07-13 can identify applications built on top of the lib ## -## 0.2.1 2009-05-05 some changes in constructor -- chove@crans.org ## -## 0.2 2009-05-01 initial import ## -########################################################################### - -__version__ = '0.2.19' - -import httplib, base64, xml.dom.minidom, time, sys, urllib - -class ApiError(Exception): - - def __init__(self, status, reason, payload): - self.status = status - self.reason = reason - self.payload = payload - - def __str__(self): - return "Request failed: " + str(self.status) + " - " + self.reason + " - " + self.payload - -########################################################################### -## Main class ## - -class OsmApi: - - def __init__(self, - username = None, - password = None, - passwordfile = None, - appid = "", - created_by = "PythonOsmApi/"+__version__, - api = "www.openstreetmap.org", - changesetauto = False, - changesetautotags = {}, - changesetautosize = 500, - changesetautomulti = 1, - debug = False - ): - - # debug - self._debug = debug - - # Get username - if username: - self._username = username - elif passwordfile: - self._username = open(passwordfile).readline().split(":")[0].strip() - - # Get password - if password: - self._password = password - elif passwordfile: - for l in open(passwordfile).readlines(): - l = l.strip().split(":") - if l[0] == self._username: - self._password = l[1] - - # Changest informations - self._changesetauto = changesetauto # auto create and close changesets - self._changesetautotags = changesetautotags # tags for automatic created changesets - self._changesetautosize = changesetautosize # change count for auto changeset - self._changesetautosize = changesetautosize # change count for auto changeset - self._changesetautomulti = changesetautomulti # close a changeset every # upload - self._changesetautocpt = 0 - self._changesetautodata = [] # data to upload for auto group - - # Get API - self._api = api - - # Get created_by - if not appid: - self._created_by = created_by - else: - self._created_by = appid + " (" + created_by + ")" - - # Initialisation - self._CurrentChangesetId = 0 - - # Http connection - self._conn = httplib.HTTPConnection(self._api, 80) - - def __del__(self): - if self._changesetauto: - self._changesetautoflush(True) - return None - - ####################################################################### - # Capabilities # - ####################################################################### - - def Capabilities(self): - """ Returns ApiCapabilities. """ - uri = "/api/capabilities" - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - print data.getElementsByTagName("osm") - data = data.getElementsByTagName("osm")[0].getElementsByTagName("api")[0] - result = {} - for elem in data.childNodes: - if elem.nodeType <> elem.ELEMENT_NODE: - continue - result[elem.nodeName] = {} - print elem.nodeName - for k, v in elem.attributes.items(): - try: - result[elem.nodeName][k] = float(v) - except: - result[elem.nodeName][k] = v - return result - - ####################################################################### - # Node # - ####################################################################### - - def NodeGet(self, NodeId, NodeVersion = -1): - """ Returns NodeData for node #NodeId. """ - uri = "/api/0.6/node/"+str(NodeId) - if NodeVersion <> -1: uri += "/"+str(NodeVersion) - data = self._get(uri) - if not data: return data - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0].getElementsByTagName("node")[0] - return self._DomParseNode(data) - - def NodeCreate(self, NodeData): - """ Creates a node. Returns updated NodeData (without timestamp). """ - return self._do("create", "node", NodeData) - - def NodeUpdate(self, NodeData): - """ Updates node with NodeData. Returns updated NodeData (without timestamp). """ - return self._do("modify", "node", NodeData) - - def NodeDelete(self, NodeData): - """ Delete node with NodeData. Returns updated NodeData (without timestamp). """ - return self._do("delete", "node", NodeData) - - def NodeHistory(self, NodeId): - """ Returns dict(NodeVerrsion: NodeData). """ - uri = "/api/0.6/node/"+str(NodeId)+"/history" - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("node"): - data = self._DomParseNode(data) - result[data[u"version"]] = data - return result - - def NodeWays(self, NodeId): - """ Returns [WayData, ... ] containing node #NodeId. """ - uri = "/api/0.6/node/%d/ways"%NodeId - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = [] - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): - data = self._DomParseRelation(data) - result.append(data) - return result - - def NodeRelations(self, NodeId): - """ Returns [RelationData, ... ] containing node #NodeId. """ - uri = "/api/0.6/node/%d/relations"%NodeId - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = [] - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): - data = self._DomParseRelation(data) - result.append(data) - return result - - def NodesGet(self, NodeIdList): - """ Returns dict(NodeId: NodeData) for each node in NodeIdList """ - uri = "/api/0.6/nodes?nodes=" + ",".join([str(x) for x in NodeIdList]) - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("node"): - data = self._DomParseNode(data) - result[data[u"id"]] = data - return result - - ####################################################################### - # Way # - ####################################################################### - - def WayGet(self, WayId, WayVersion = -1): - """ Returns WayData for way #WayId. """ - uri = "/api/0.6/way/"+str(WayId) - if WayVersion <> -1: uri += "/"+str(WayVersion) - data = self._get(uri) - if not data: return data - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0].getElementsByTagName("way")[0] - return self._DomParseWay(data) - - def WayCreate(self, WayData): - """ Creates a way. Returns updated WayData (without timestamp). """ - return self._do("create", "way", WayData) - - def WayUpdate(self, WayData): - """ Updates way with WayData. Returns updated WayData (without timestamp). """ - return self._do("modify", "way", WayData) - - def WayDelete(self, WayData): - """ Delete way with WayData. Returns updated WayData (without timestamp). """ - return self._do("delete", "way", WayData) - - def WayHistory(self, WayId): - """ Returns dict(WayVerrsion: WayData). """ - uri = "/api/0.6/way/"+str(WayId)+"/history" - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): - data = self._DomParseWay(data) - result[data[u"version"]] = data - return result - - def WayRelations(self, WayId): - """ Returns [RelationData, ...] containing way #WayId. """ - uri = "/api/0.6/way/%d/relations"%WayId - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = [] - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): - data = self._DomParseRelation(data) - result.append(data) - return result - - def WayFull(self, WayId): - """ Return full data for way WayId as list of {type: node|way|relation, data: {}}. """ - uri = "/api/0.6/way/"+str(WayId)+"/full" - data = self._get(uri) - return self.ParseOsm(data) - - def WaysGet(self, WayIdList): - """ Returns dict(WayId: WayData) for each way in WayIdList """ - uri = "/api/0.6/ways?ways=" + ",".join([str(x) for x in WayIdList]) - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("way"): - data = self._DomParseWay(data) - result[data[u"id"]] = data - return result - - ####################################################################### - # Relation # - ####################################################################### - - def RelationGet(self, RelationId, RelationVersion = -1): - """ Returns RelationData for relation #RelationId. """ - uri = "/api/0.6/relation/"+str(RelationId) - if RelationVersion <> -1: uri += "/"+str(RelationVersion) - data = self._get(uri) - if not data: return data - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0].getElementsByTagName("relation")[0] - return self._DomParseRelation(data) - - def RelationCreate(self, RelationData): - """ Creates a relation. Returns updated RelationData (without timestamp). """ - return self._do("create", "relation", RelationData) - - def RelationUpdate(self, RelationData): - """ Updates relation with RelationData. Returns updated RelationData (without timestamp). """ - return self._do("modify", "relation", RelationData) - - def RelationDelete(self, RelationData): - """ Delete relation with RelationData. Returns updated RelationData (without timestamp). """ - return self._do("delete", "relation", RelationData) - - def RelationHistory(self, RelationId): - """ Returns dict(RelationVerrsion: RelationData). """ - uri = "/api/0.6/relation/"+str(RelationId)+"/history" - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): - data = self._DomParseRelation(data) - result[data[u"version"]] = data - return result - - def RelationRelations(self, RelationId): - """ Returns list of RelationData containing relation #RelationId. """ - uri = "/api/0.6/relation/%d/relations"%RelationId - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = [] - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): - data = self._DomParseRelation(data) - result.append(data) - return result - - def RelationFullRecur(self, RelationId): - """ Return full data for relation RelationId. Recurisve version relation of relations. """ - data = [] - todo = [RelationId] - done = [] - while todo: - rid = todo.pop(0) - done.append(rid) - temp = self.RelationFull(rid) - for item in temp: - if item["type"] <> "relation": - continue - if item["data"]["id"] in done: - continue - todo.append(item["data"]["id"]) - data += temp - return data - - def RelationFull(self, RelationId): - """ Return full data for relation RelationId as list of {type: node|way|relation, data: {}}. """ - uri = "/api/0.6/relation/"+str(RelationId)+"/full" - data = self._get(uri) - return self.ParseOsm(data) - - def RelationsGet(self, RelationIdList): - """ Returns dict(RelationId: RelationData) for each relation in RelationIdList """ - uri = "/api/0.6/relations?relations=" + ",".join([str(x) for x in RelationIdList]) - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - result = {} - for data in data.getElementsByTagName("osm")[0].getElementsByTagName("relation"): - data = self._DomParseRelation(data) - result[data[u"id"]] = data - return result - - ####################################################################### - # Changeset # - ####################################################################### - - def ChangesetGet(self, ChangesetId): - """ Returns ChangesetData for changeset #ChangesetId. """ - data = self._get("/api/0.6/changeset/"+str(ChangesetId)) - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0].getElementsByTagName("changeset")[0] - return self._DomParseChangeset(data) - - def ChangesetUpdate(self, ChangesetTags = {}): - """ Updates current changeset with ChangesetTags. """ - if self._CurrentChangesetId == -1: - raise Exception, "No changeset currently opened" - if u"created_by" not in ChangesetTags: - ChangesetTags[u"created_by"] = self._created_by - result = self._put("/api/0.6/changeset/"+str(self._CurrentChangesetId), self._XmlBuild("changeset", {u"tag": ChangesetTags})) - return self._CurrentChangesetId - - def ChangesetCreate(self, ChangesetTags = {}): - """ Opens a changeset. Returns #ChangesetId. """ - if self._CurrentChangesetId: - raise Exception, "Changeset alreadey opened" - if u"created_by" not in ChangesetTags: - ChangesetTags[u"created_by"] = self._created_by - result = self._put("/api/0.6/changeset/create", self._XmlBuild("changeset", {u"tag": ChangesetTags})) - self._CurrentChangesetId = int(result) - return self._CurrentChangesetId - - def ChangesetClose(self): - """ Closes current changeset. Returns #ChangesetId. """ - if not self._CurrentChangesetId: - raise Exception, "No changeset currently opened" - result = self._put("/api/0.6/changeset/"+str(self._CurrentChangesetId)+"/close", u"") - CurrentChangesetId = self._CurrentChangesetId - self._CurrentChangesetId = 0 - return CurrentChangesetId - - def ChangesetUpload(self, ChangesData): - """ Upload data. ChangesData is a list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. Returns list with updated ids. """ - data = "" - data += u"\n" - data += u"\n" - for change in ChangesData: - data += u"<"+change["action"]+">\n" - change["data"]["changeset"] = self._CurrentChangesetId - data += self._XmlBuild(change["type"], change["data"], False).decode("utf-8") - data += u"\n" - data += u"" - data = self._http("POST", "/api/0.6/changeset/"+str(self._CurrentChangesetId)+"/upload", True, data.encode("utf-8")) - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("diffResult")[0] - data = [x for x in data.childNodes if x.nodeType == x.ELEMENT_NODE] - for i in range(len(ChangesData)): - if ChangesData[i]["action"] == "delete": - ChangesData[i]["data"].pop("version") - else: - ChangesData[i]["data"]["version"] = int(data[i].getAttribute("new_id")) - return ChangesData - - def ChangesetDownload(self, ChangesetId): - """ Download data from a changeset. Returns list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. """ - uri = "/api/0.6/changeset/"+str(ChangesetId)+"/download" - data = self._get(uri) - return self.ParseOsc(data) - - def ChangesetsGet(self, min_lon=None, min_lat=None, max_lon=None, max_lat=None, - userid=None, username=None, - closed_after=None, created_before=None, - only_open=False, only_closed=False): - """ Returns dict(ChangsetId: ChangesetData) matching all criteria. """ - - uri = "/api/0.6/changesets" - params = {} - if min_lon or min_lat or max_lon or max_lat: - params["bbox"] = ",".join([str(min_lon),str(min_lat),str(max_lon),str(max_lat)]) - if userid: - params["user"] = userid - if username: - params["display_name"] = username - if closed_after and not created_before: - params["time"] = closed_after - if created_before: - if not closed_after: - closed_after = "1970-01-01T00:00:00Z" - params["time"] = closed_after + "," + created_before - if only_open: - params["open"] = 1 - if only_closed: - params["closed"] = 1 - - if params: - uri += "?" + urllib.urlencode(params) - - data = self._get(uri) - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0].getElementsByTagName("changeset") - result = {} - for curChangeset in data: - tmpCS = self._DomParseChangeset(curChangeset) - result[tmpCS["id"]] = tmpCS - return result - - ####################################################################### - # Other # - ####################################################################### - - def Map(self, min_lon, min_lat, max_lon, max_lat): - """ Download data in bounding box. Returns list of dict {type: node|way|relation, data: {}}. """ - uri = "/api/0.6/map?bbox=%f,%f,%f,%f"%(min_lon, min_lat, max_lon, max_lat) - data = self._get(uri) - return self.ParseOsm(data) - - ####################################################################### - # Data parser # - ####################################################################### - - def ParseOsm(self, data): - """ Parse osm data. Returns list of dict {type: node|way|relation, data: {}}. """ - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osm")[0] - result = [] - for elem in data.childNodes: - if elem.nodeName == u"node": - result.append({u"type": elem.nodeName, u"data": self._DomParseNode(elem)}) - elif elem.nodeName == u"way": - result.append({u"type": elem.nodeName, u"data": self._DomParseWay(elem)}) - elif elem.nodeName == u"relation": - result.append({u"type": elem.nodeName, u"data": self._DomParseRelation(elem)}) - return result - - def ParseOsc(self, data): - """ Parse osc data. Returns list of dict {type: node|way|relation, action: create|delete|modify, data: {}}. """ - data = xml.dom.minidom.parseString(data) - data = data.getElementsByTagName("osmChange")[0] - result = [] - for action in data.childNodes: - if action.nodeName == u"#text": continue - for elem in action.childNodes: - if elem.nodeName == u"node": - result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseNode(elem)}) - elif elem.nodeName == u"way": - result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseWay(elem)}) - elif elem.nodeName == u"relation": - result.append({u"action":action.nodeName, u"type": elem.nodeName, u"data": self._DomParseRelation(elem)}) - return result - - ####################################################################### - # Internal http function # - ####################################################################### - - def _do(self, action, OsmType, OsmData): - if self._changesetauto: - self._changesetautodata.append({"action":action, "type":OsmType, "data":OsmData}) - self._changesetautoflush() - return None - else: - return self._do_manu(action, OsmType, OsmData) - - def _do_manu(self, action, OsmType, OsmData): - if not self._CurrentChangesetId: - raise Exception, "You need to open a changeset before uploading data" - if u"timestamp" in OsmData: - OsmData.pop(u"timestamp") - OsmData[u"changeset"] = self._CurrentChangesetId - if action == "create": - if OsmData.get(u"id", -1) > 0: - raise Exception, "This "+OsmType+" already exists" - result = self._put("/api/0.6/"+OsmType+"/create", self._XmlBuild(OsmType, OsmData)) - OsmData[u"id"] = int(result.strip()) - OsmData[u"version"] = 1 - return OsmData - elif action == "modify": - result = self._put("/api/0.6/"+OsmType+"/"+str(OsmData[u"id"]), self._XmlBuild(OsmType, OsmData)) - OsmData[u"version"] = int(result.strip()) - return OsmData - elif action =="delete": - result = self._delete("/api/0.6/"+OsmType+"/"+str(OsmData[u"id"]), self._XmlBuild(OsmType, OsmData)) - OsmData[u"version"] = int(result.strip()) - OsmData[u"visible"] = False - return OsmData - - def flush(self): - return self._changesetautoflush(True) - - def _changesetautoflush(self, force = False): - while (len(self._changesetautodata) >= self._changesetautosize) or (force and self._changesetautodata): - if self._changesetautocpt == 0: - self.ChangesetCreate(self._changesetautotags) - self.ChangesetUpload(self._changesetautodata[:self._changesetautosize]) - self._changesetautodata = self._changesetautodata[self._changesetautosize:] - self._changesetautocpt += 1 - if self._changesetautocpt == self._changesetautomulti: - self.ChangesetClose() - self._changesetautocpt = 0 - if self._changesetautocpt and force: - self.ChangesetClose() - self._changesetautocpt = 0 - return None - - def _http_request(self, cmd, path, auth, send): - if self._debug: - path2 = path - if len(path2) > 50: - path2 = path2[:50]+"[...]" - print >>sys.stderr, "%s %s %s"%(time.strftime("%Y-%m-%d %H:%M:%S"),cmd,path2) - self._conn.putrequest(cmd, path) - self._conn.putheader('User-Agent', self._created_by) - if auth: - self._conn.putheader('Authorization', 'Basic ' + base64.encodestring(self._username + ':' + self._password).strip()) - if send <> None: - self._conn.putheader('Content-Length', len(send)) - self._conn.endheaders() - if send: - self._conn.send(send) - response = self._conn.getresponse() - if response.status <> 200: - payload = response.read().strip() - if response.status == 410: - return None - raise ApiError(response.status, response.reason, payload) - if self._debug: - print >>sys.stderr, "%s %s %s done"%(time.strftime("%Y-%m-%d %H:%M:%S"),cmd,path2) - return response.read() - - def _http(self, cmd, path, auth, send): - i = 0 - while True: - i += 1 - try: - return self._http_request(cmd, path, auth, send) - except ApiError, e: - if e.status >= 500: - if i == 5: raise - if i <> 1: time.sleep(5) - self._conn = httplib.HTTPConnection(self._api, 80) - else: raise - except Exception: - if i == 5: raise - if i <> 1: time.sleep(5) - self._conn = httplib.HTTPConnection(self._api, 80) - - def _get(self, path): - return self._http('GET', path, False, None) - - def _put(self, path, data): - return self._http('PUT', path, True, data) - - def _delete(self, path, data): - return self._http('DELETE', path, True, data) - - ####################################################################### - # Internal dom function # - ####################################################################### - - def _DomGetAttributes(self, DomElement): - """ Returns a formated dictionnary of attributes of a DomElement. """ - result = {} - for k, v in DomElement.attributes.items(): - if k == u"uid" : v = int(v) - elif k == u"changeset" : v = int(v) - elif k == u"version" : v = int(v) - elif k == u"id" : v = int(v) - elif k == u"lat" : v = float(v) - elif k == u"lon" : v = float(v) - elif k == u"open" : v = v=="true" - elif k == u"visible" : v = v=="true" - elif k == u"ref" : v = int(v) - result[k] = v - return result - - def _DomGetTag(self, DomElement): - """ Returns the dictionnary of tags of a DomElement. """ - result = {} - for t in DomElement.getElementsByTagName("tag"): - k = t.attributes["k"].value - v = t.attributes["v"].value - result[k] = v - return result - - def _DomGetNd(self, DomElement): - """ Returns the list of nodes of a DomElement. """ - result = [] - for t in DomElement.getElementsByTagName("nd"): - result.append(int(int(t.attributes["ref"].value))) - return result - - def _DomGetMember(self, DomElement): - """ Returns a list of relation members. """ - result = [] - for m in DomElement.getElementsByTagName("member"): - result.append(self._DomGetAttributes(m)) - return result - - def _DomParseNode(self, DomElement): - """ Returns NodeData for the node. """ - result = self._DomGetAttributes(DomElement) - result[u"tag"] = self._DomGetTag(DomElement) - return result - - def _DomParseWay(self, DomElement): - """ Returns WayData for the way. """ - result = self._DomGetAttributes(DomElement) - result[u"tag"] = self._DomGetTag(DomElement) - result[u"nd"] = self._DomGetNd(DomElement) - return result - - def _DomParseRelation(self, DomElement): - """ Returns RelationData for the relation. """ - result = self._DomGetAttributes(DomElement) - result[u"tag"] = self._DomGetTag(DomElement) - result[u"member"] = self._DomGetMember(DomElement) - return result - - def _DomParseChangeset(self, DomElement): - """ Returns ChangesetData for the changeset. """ - result = self._DomGetAttributes(DomElement) - result[u"tag"] = self._DomGetTag(DomElement) - return result - - ####################################################################### - # Internal xml builder # - ####################################################################### - - def _XmlBuild(self, ElementType, ElementData, WithHeaders = True): - - xml = u"" - if WithHeaders: - xml += u"\n" - xml += u"\n" - - # - xml += u" <" + ElementType - if u"id" in ElementData: - xml += u" id=\"" + str(ElementData[u"id"]) + u"\"" - if u"lat" in ElementData: - xml += u" lat=\"" + str(ElementData[u"lat"]) + u"\"" - if u"lon" in ElementData: - xml += u" lon=\"" + str(ElementData[u"lon"]) + u"\"" - if u"version" in ElementData: - xml += u" version=\"" + str(ElementData[u"version"]) + u"\"" - xml += u" visible=\"" + str(ElementData.get(u"visible", True)).lower() + u"\"" - if ElementType in [u"node", u"way", u"relation"]: - xml += u" changeset=\"" + str(self._CurrentChangesetId) + u"\"" - xml += u">\n" - - # - for k, v in ElementData.get(u"tag", {}).items(): - xml += u" \n" - - # - for member in ElementData.get(u"member", []): - xml += u" \n" - - # - for ref in ElementData.get(u"nd", []): - xml += u" \n" - - # - xml += u" \n" - - if WithHeaders: - xml += u"\n" - - return xml.encode("utf8") - - def _XmlEncode(self, text): - return text.replace("&", "&").replace("\"", """).replace("<","<").replace(">",">") - -## End of main class ## -########################################################################### diff --git a/utils/__init__.py b/utils/__init__.py deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3 From 80f9f6f67531314f870cb4ad034918f99cd2f1de Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 24 Jan 2013 22:33:54 +0000 Subject: Fix database initialisation for upgrade. --- chimere/fixtures/auth_group.json | 46 ++ chimere/fixtures/initial_data.json | 44 -- chimere/models.py | 5 +- docs/en/install.rst | 4 + docs/fr/install.rst | 5 + example_project/fixtures/first_data.json | 853 +++++++++++++++++++++++++++++ example_project/fixtures/initial_data.json | 853 ----------------------------- 7 files changed, 912 insertions(+), 898 deletions(-) create mode 100644 chimere/fixtures/auth_group.json create mode 100644 example_project/fixtures/first_data.json delete mode 100644 example_project/fixtures/initial_data.json diff --git a/chimere/fixtures/auth_group.json b/chimere/fixtures/auth_group.json new file mode 100644 index 0000000..e04291c --- /dev/null +++ b/chimere/fixtures/auth_group.json @@ -0,0 +1,46 @@ +[ + { + "pk": 1, + "model": "auth.group", + "fields": { + "name": "Application administrator", + "permissions": [ + 67, + 68, + 40, + 41, + 42, + 37, + 38, + 39, + 34, + 35, + 36, + 43, + 44, + 45, + 49, + 50, + 51, + 55, + 56, + 57, + 28, + 29, + 30, + 58, + 59, + 60, + 64, + 65, + 66, + 61, + 62, + 63, + 46, + 47, + 48 + ] + } + } +] diff --git a/chimere/fixtures/initial_data.json b/chimere/fixtures/initial_data.json index 222c81c..c44eb63 100644 --- a/chimere/fixtures/initial_data.json +++ b/chimere/fixtures/initial_data.json @@ -221,49 +221,5 @@ "layer_code": "new OpenLayers.Layer.MapQuestOSM()", "name": "OSM - MapQuest" } - }, - { - "pk": 1, - "model": "auth.group", - "fields": { - "name": "Application administrator", - "permissions": [ - 67, - 68, - 40, - 41, - 42, - 37, - 38, - 39, - 34, - 35, - 36, - 43, - 44, - 45, - 49, - 50, - 51, - 55, - 56, - 57, - 28, - 29, - 30, - 58, - 59, - 60, - 64, - 65, - 66, - 61, - 62, - 63, - 46, - 47, - 48 - ] - } } ] diff --git a/chimere/models.py b/chimere/models.py index 827a0e7..5a4be28 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1283,7 +1283,10 @@ def area_post_save(sender, **kwargs): ('chimere', 'multimediafile'), ('chimere', 'picturefile'), ('chimere', 'routefile')): - ct = ContentType.objects.get(app_label=app_label, model=model) + ct = ContentType.objects.filter(app_label=app_label, model=model) + if not ct.count(): + continue + ct = ct.all()[0] for p in Permission.objects.filter(content_type=ct).all(): group.permissions.add(p) diff --git a/docs/en/install.rst b/docs/en/install.rst index ea27efc..3c2f54b 100644 --- a/docs/en/install.rst +++ b/docs/en/install.rst @@ -244,6 +244,10 @@ to create tables managed with Django-South:: The database is set, congratulations! +You can load the default group permissions (it is at least a good start):: + + ./manage.py loaddata ../chimere/fixtures/auth_group.json + If you want to populate your installation with default data (don't do this on an already populated instance!):: diff --git a/docs/fr/install.rst b/docs/fr/install.rst index 841eae2..de41584 100644 --- a/docs/fr/install.rst +++ b/docs/fr/install.rst @@ -252,6 +252,11 @@ données gérées par Django-South : :: La base de données est en place, félicitations ! +Vous pouvez alors charger les permissions poar défaut pour les groupes +(c'est au minimum un bon départ) : :: + + ./manage.py loaddata ../chimere/fixtures/auth_group.json + Si vous voulez remplir votre installation avec des données par défaut (ne le faites pas sur une instance de Chimère contenant déjà des données !) : :: diff --git a/example_project/fixtures/first_data.json b/example_project/fixtures/first_data.json new file mode 100644 index 0000000..814e8e0 --- /dev/null +++ b/example_project/fixtures/first_data.json @@ -0,0 +1,853 @@ +[ + { + "pk": 20, + "model": "contenttypes.contenttype", + "fields": { + "model": "area", + "name": "Area", + "app_label": "chimere" + } + }, + { + "pk": 14, + "model": "contenttypes.contenttype", + "fields": { + "model": "category", + "name": "Category", + "app_label": "chimere" + } + }, + { + "pk": 13, + "model": "contenttypes.contenttype", + "fields": { + "model": "color", + "name": "Color", + "app_label": "chimere" + } + }, + { + "pk": 12, + "model": "contenttypes.contenttype", + "fields": { + "model": "colortheme", + "name": "Color theme", + "app_label": "chimere" + } + }, + { + "pk": 6, + "model": "contenttypes.contenttype", + "fields": { + "model": "contenttype", + "name": "content type", + "app_label": "contenttypes" + } + }, + { + "pk": 2, + "model": "contenttypes.contenttype", + "fields": { + "model": "group", + "name": "group", + "app_label": "auth" + } + }, + { + "pk": 15, + "model": "contenttypes.contenttype", + "fields": { + "model": "icon", + "name": "Icon", + "app_label": "chimere" + } + }, + { + "pk": 5, + "model": "contenttypes.contenttype", + "fields": { + "model": "logentry", + "name": "log entry", + "app_label": "admin" + } + }, + { + "pk": 4, + "model": "contenttypes.contenttype", + "fields": { + "model": "message", + "name": "message", + "app_label": "auth" + } + }, + { + "pk": 9, + "model": "contenttypes.contenttype", + "fields": { + "model": "migrationhistory", + "name": "migration history", + "app_label": "south" + } + }, + { + "pk": 10, + "model": "contenttypes.contenttype", + "fields": { + "model": "news", + "name": "News", + "app_label": "chimere" + } + }, + { + "pk": 1, + "model": "contenttypes.contenttype", + "fields": { + "model": "permission", + "name": "permission", + "app_label": "auth" + } + }, + { + "pk": 17, + "model": "contenttypes.contenttype", + "fields": { + "model": "marker", + "name": "Point of interest", + "app_label": "chimere" + } + }, + { + "pk": 22, + "model": "contenttypes.contenttype", + "fields": { + "model": "property", + "name": "Property", + "app_label": "chimere" + } + }, + { + "pk": 21, + "model": "contenttypes.contenttype", + "fields": { + "model": "propertymodel", + "name": "Property model", + "app_label": "chimere" + } + }, + { + "pk": 19, + "model": "contenttypes.contenttype", + "fields": { + "model": "route", + "name": "Route", + "app_label": "chimere" + } + }, + { + "pk": 18, + "model": "contenttypes.contenttype", + "fields": { + "model": "routefile", + "name": "Route file", + "app_label": "chimere" + } + }, + { + "pk": 7, + "model": "contenttypes.contenttype", + "fields": { + "model": "session", + "name": "session", + "app_label": "sessions" + } + }, + { + "pk": 8, + "model": "contenttypes.contenttype", + "fields": { + "model": "site", + "name": "site", + "app_label": "sites" + } + }, + { + "pk": 16, + "model": "contenttypes.contenttype", + "fields": { + "model": "subcategory", + "name": "Subcategory", + "app_label": "chimere" + } + }, + { + "pk": 11, + "model": "contenttypes.contenttype", + "fields": { + "model": "tinyurl", + "name": "TinyUrl", + "app_label": "chimere" + } + }, + { + "pk": 3, + "model": "contenttypes.contenttype", + "fields": { + "model": "user", + "name": "user", + "app_label": "auth" + } + }, + { + "pk": 1, + "model": "sites.site", + "fields": { + "domain": "example.com", + "name": "example.com" + } + }, + { + "pk": 13, + "model": "auth.permission", + "fields": { + "codename": "add_logentry", + "name": "Can add log entry", + "content_type": 5 + } + }, + { + "pk": 14, + "model": "auth.permission", + "fields": { + "codename": "change_logentry", + "name": "Can change log entry", + "content_type": 5 + } + }, + { + "pk": 15, + "model": "auth.permission", + "fields": { + "codename": "delete_logentry", + "name": "Can delete log entry", + "content_type": 5 + } + }, + { + "pk": 4, + "model": "auth.permission", + "fields": { + "codename": "add_group", + "name": "Can add group", + "content_type": 2 + } + }, + { + "pk": 5, + "model": "auth.permission", + "fields": { + "codename": "change_group", + "name": "Can change group", + "content_type": 2 + } + }, + { + "pk": 6, + "model": "auth.permission", + "fields": { + "codename": "delete_group", + "name": "Can delete group", + "content_type": 2 + } + }, + { + "pk": 10, + "model": "auth.permission", + "fields": { + "codename": "add_message", + "name": "Can add message", + "content_type": 4 + } + }, + { + "pk": 11, + "model": "auth.permission", + "fields": { + "codename": "change_message", + "name": "Can change message", + "content_type": 4 + } + }, + { + "pk": 12, + "model": "auth.permission", + "fields": { + "codename": "delete_message", + "name": "Can delete message", + "content_type": 4 + } + }, + { + "pk": 1, + "model": "auth.permission", + "fields": { + "codename": "add_permission", + "name": "Can add permission", + "content_type": 1 + } + }, + { + "pk": 2, + "model": "auth.permission", + "fields": { + "codename": "change_permission", + "name": "Can change permission", + "content_type": 1 + } + }, + { + "pk": 3, + "model": "auth.permission", + "fields": { + "codename": "delete_permission", + "name": "Can delete permission", + "content_type": 1 + } + }, + { + "pk": 7, + "model": "auth.permission", + "fields": { + "codename": "add_user", + "name": "Can add user", + "content_type": 3 + } + }, + { + "pk": 8, + "model": "auth.permission", + "fields": { + "codename": "change_user", + "name": "Can change user", + "content_type": 3 + } + }, + { + "pk": 9, + "model": "auth.permission", + "fields": { + "codename": "delete_user", + "name": "Can delete user", + "content_type": 3 + } + }, + { + "pk": 58, + "model": "auth.permission", + "fields": { + "codename": "add_area", + "name": "Can add Area", + "content_type": 20 + } + }, + { + "pk": 59, + "model": "auth.permission", + "fields": { + "codename": "change_area", + "name": "Can change Area", + "content_type": 20 + } + }, + { + "pk": 60, + "model": "auth.permission", + "fields": { + "codename": "delete_area", + "name": "Can delete Area", + "content_type": 20 + } + }, + { + "pk": 40, + "model": "auth.permission", + "fields": { + "codename": "add_route", + "name": "Can add Route", + "content_type": 14 + } + }, + { + "pk": 41, + "model": "auth.permission", + "fields": { + "codename": "change_route", + "name": "Can change Route", + "content_type": 14 + } + }, + { + "pk": 42, + "model": "auth.permission", + "fields": { + "codename": "delete_route", + "name": "Can delete Route", + "content_type": 14 + } + }, + { + "pk": 37, + "model": "auth.permission", + "fields": { + "codename": "add_marker", + "name": "Can add Point of interest", + "content_type": 13 + } + }, + { + "pk": 38, + "model": "auth.permission", + "fields": { + "codename": "change_marker", + "name": "Can change Point of interest", + "content_type": 13 + } + }, + { + "pk": 39, + "model": "auth.permission", + "fields": { + "codename": "delete_marker", + "name": "Can delete Point of interest", + "content_type": 13 + } + }, + { + "pk": 34, + "model": "auth.permission", + "fields": { + "codename": "add_subcategory", + "name": "Can add Subcategory", + "content_type": 12 + } + }, + { + "pk": 35, + "model": "auth.permission", + "fields": { + "codename": "change_subcategory", + "name": "Can change Subcategory", + "content_type": 12 + } + }, + { + "pk": 36, + "model": "auth.permission", + "fields": { + "codename": "delete_subcategory", + "name": "Can delete Subcategory", + "content_type": 12 + } + }, + { + "pk": 43, + "model": "auth.permission", + "fields": { + "codename": "add_area", + "name": "Can add Area", + "content_type": 15 + } + }, + { + "pk": 44, + "model": "auth.permission", + "fields": { + "codename": "change_area", + "name": "Can change Area", + "content_type": 15 + } + }, + { + "pk": 45, + "model": "auth.permission", + "fields": { + "codename": "delete_area", + "name": "Can delete Area", + "content_type": 15 + } + }, + { + "pk": 49, + "model": "auth.permission", + "fields": { + "codename": "add_property", + "name": "Can add Property", + "content_type": 17 + } + }, + { + "pk": 50, + "model": "auth.permission", + "fields": { + "codename": "change_property", + "name": "Can change Property", + "content_type": 17 + } + }, + { + "pk": 51, + "model": "auth.permission", + "fields": { + "codename": "delete_property", + "name": "Can delete Property", + "content_type": 17 + } + }, + { + "pk": 28, + "model": "auth.permission", + "fields": { + "codename": "add_category", + "name": "Can add Category", + "content_type": 10 + } + }, + { + "pk": 29, + "model": "auth.permission", + "fields": { + "codename": "change_category", + "name": "Can change Category", + "content_type": 10 + } + }, + { + "pk": 30, + "model": "auth.permission", + "fields": { + "codename": "delete_category", + "name": "Can delete Category", + "content_type": 10 + } + }, + { + "pk": 64, + "model": "auth.permission", + "fields": { + "codename": "add_property", + "name": "Can add Property", + "content_type": 22 + } + }, + { + "pk": 65, + "model": "auth.permission", + "fields": { + "codename": "change_property", + "name": "Can change Property", + "content_type": 22 + } + }, + { + "pk": 66, + "model": "auth.permission", + "fields": { + "codename": "delete_property", + "name": "Can delete Property", + "content_type": 22 + } + }, + { + "pk": 61, + "model": "auth.permission", + "fields": { + "codename": "add_propertymodel", + "name": "Can add Property model", + "content_type": 21 + } + }, + { + "pk": 62, + "model": "auth.permission", + "fields": { + "codename": "change_propertymodel", + "name": "Can change Property model", + "content_type": 21 + } + }, + { + "pk": 63, + "model": "auth.permission", + "fields": { + "codename": "delete_propertymodel", + "name": "Can delete Property model", + "content_type": 21 + } + }, + { + "pk": 55, + "model": "auth.permission", + "fields": { + "codename": "add_route", + "name": "Can add Route", + "content_type": 19 + } + }, + { + "pk": 56, + "model": "auth.permission", + "fields": { + "codename": "change_route", + "name": "Can change Route", + "content_type": 19 + } + }, + { + "pk": 57, + "model": "auth.permission", + "fields": { + "codename": "delete_route", + "name": "Can delete Route", + "content_type": 19 + } + }, + { + "pk": 52, + "model": "auth.permission", + "fields": { + "codename": "add_routefile", + "name": "Can add Route file", + "content_type": 18 + } + }, + { + "pk": 53, + "model": "auth.permission", + "fields": { + "codename": "change_routefile", + "name": "Can change Route file", + "content_type": 18 + } + }, + { + "pk": 54, + "model": "auth.permission", + "fields": { + "codename": "delete_routefile", + "name": "Can delete Route file", + "content_type": 18 + } + }, + { + "pk": 46, + "model": "auth.permission", + "fields": { + "codename": "add_propertymodel", + "name": "Can add Property model", + "content_type": 16 + } + }, + { + "pk": 47, + "model": "auth.permission", + "fields": { + "codename": "change_propertymodel", + "name": "Can change Property model", + "content_type": 16 + } + }, + { + "pk": 48, + "model": "auth.permission", + "fields": { + "codename": "delete_propertymodel", + "name": "Can delete Property model", + "content_type": 16 + } + }, + { + "pk": 31, + "model": "auth.permission", + "fields": { + "codename": "add_icon", + "name": "Can add Icon", + "content_type": 11 + } + }, + { + "pk": 32, + "model": "auth.permission", + "fields": { + "codename": "change_icon", + "name": "Can change Icon", + "content_type": 11 + } + }, + { + "pk": 33, + "model": "auth.permission", + "fields": { + "codename": "delete_icon", + "name": "Can delete Icon", + "content_type": 11 + } + }, + { + "pk": 16, + "model": "auth.permission", + "fields": { + "codename": "add_contenttype", + "name": "Can add content type", + "content_type": 6 + } + }, + { + "pk": 17, + "model": "auth.permission", + "fields": { + "codename": "change_contenttype", + "name": "Can change content type", + "content_type": 6 + } + }, + { + "pk": 18, + "model": "auth.permission", + "fields": { + "codename": "delete_contenttype", + "name": "Can delete content type", + "content_type": 6 + } + }, + { + "pk": 19, + "model": "auth.permission", + "fields": { + "codename": "add_session", + "name": "Can add session", + "content_type": 7 + } + }, + { + "pk": 20, + "model": "auth.permission", + "fields": { + "codename": "change_session", + "name": "Can change session", + "content_type": 7 + } + }, + { + "pk": 21, + "model": "auth.permission", + "fields": { + "codename": "delete_session", + "name": "Can delete session", + "content_type": 7 + } + }, + { + "pk": 22, + "model": "auth.permission", + "fields": { + "codename": "add_site", + "name": "Can add site", + "content_type": 8 + } + }, + { + "pk": 23, + "model": "auth.permission", + "fields": { + "codename": "change_site", + "name": "Can change site", + "content_type": 8 + } + }, + { + "pk": 24, + "model": "auth.permission", + "fields": { + "codename": "delete_site", + "name": "Can delete site", + "content_type": 8 + } + }, + { + "pk": 25, + "model": "auth.permission", + "fields": { + "codename": "add_news", + "name": "Can add News", + "content_type": 9 + } + }, + { + "pk": 26, + "model": "auth.permission", + "fields": { + "codename": "change_news", + "name": "Can change News", + "content_type": 9 + } + }, + { + "pk": 27, + "model": "auth.permission", + "fields": { + "codename": "delete_news", + "name": "Can delete News", + "content_type": 9 + } + }, + { + "pk": 1, + "model": "auth.group", + "fields": { + "name": "Moderator", + "permissions": [ + 40, + 41, + 42, + 37, + 38, + 39, + 49, + 50, + 51 + ] + } + }, + { + "pk": 2, + "model": "auth.group", + "fields": { + "name": "Application administrator", + "permissions": [ + 40, + 41, + 42, + 37, + 38, + 39, + 34, + 35, + 36, + 43, + 44, + 45, + 49, + 50, + 51, + 28, + 29, + 30, + 31, + 32, + 33, + 25, + 26, + 27 + ] + } + } +] diff --git a/example_project/fixtures/initial_data.json b/example_project/fixtures/initial_data.json deleted file mode 100644 index 814e8e0..0000000 --- a/example_project/fixtures/initial_data.json +++ /dev/null @@ -1,853 +0,0 @@ -[ - { - "pk": 20, - "model": "contenttypes.contenttype", - "fields": { - "model": "area", - "name": "Area", - "app_label": "chimere" - } - }, - { - "pk": 14, - "model": "contenttypes.contenttype", - "fields": { - "model": "category", - "name": "Category", - "app_label": "chimere" - } - }, - { - "pk": 13, - "model": "contenttypes.contenttype", - "fields": { - "model": "color", - "name": "Color", - "app_label": "chimere" - } - }, - { - "pk": 12, - "model": "contenttypes.contenttype", - "fields": { - "model": "colortheme", - "name": "Color theme", - "app_label": "chimere" - } - }, - { - "pk": 6, - "model": "contenttypes.contenttype", - "fields": { - "model": "contenttype", - "name": "content type", - "app_label": "contenttypes" - } - }, - { - "pk": 2, - "model": "contenttypes.contenttype", - "fields": { - "model": "group", - "name": "group", - "app_label": "auth" - } - }, - { - "pk": 15, - "model": "contenttypes.contenttype", - "fields": { - "model": "icon", - "name": "Icon", - "app_label": "chimere" - } - }, - { - "pk": 5, - "model": "contenttypes.contenttype", - "fields": { - "model": "logentry", - "name": "log entry", - "app_label": "admin" - } - }, - { - "pk": 4, - "model": "contenttypes.contenttype", - "fields": { - "model": "message", - "name": "message", - "app_label": "auth" - } - }, - { - "pk": 9, - "model": "contenttypes.contenttype", - "fields": { - "model": "migrationhistory", - "name": "migration history", - "app_label": "south" - } - }, - { - "pk": 10, - "model": "contenttypes.contenttype", - "fields": { - "model": "news", - "name": "News", - "app_label": "chimere" - } - }, - { - "pk": 1, - "model": "contenttypes.contenttype", - "fields": { - "model": "permission", - "name": "permission", - "app_label": "auth" - } - }, - { - "pk": 17, - "model": "contenttypes.contenttype", - "fields": { - "model": "marker", - "name": "Point of interest", - "app_label": "chimere" - } - }, - { - "pk": 22, - "model": "contenttypes.contenttype", - "fields": { - "model": "property", - "name": "Property", - "app_label": "chimere" - } - }, - { - "pk": 21, - "model": "contenttypes.contenttype", - "fields": { - "model": "propertymodel", - "name": "Property model", - "app_label": "chimere" - } - }, - { - "pk": 19, - "model": "contenttypes.contenttype", - "fields": { - "model": "route", - "name": "Route", - "app_label": "chimere" - } - }, - { - "pk": 18, - "model": "contenttypes.contenttype", - "fields": { - "model": "routefile", - "name": "Route file", - "app_label": "chimere" - } - }, - { - "pk": 7, - "model": "contenttypes.contenttype", - "fields": { - "model": "session", - "name": "session", - "app_label": "sessions" - } - }, - { - "pk": 8, - "model": "contenttypes.contenttype", - "fields": { - "model": "site", - "name": "site", - "app_label": "sites" - } - }, - { - "pk": 16, - "model": "contenttypes.contenttype", - "fields": { - "model": "subcategory", - "name": "Subcategory", - "app_label": "chimere" - } - }, - { - "pk": 11, - "model": "contenttypes.contenttype", - "fields": { - "model": "tinyurl", - "name": "TinyUrl", - "app_label": "chimere" - } - }, - { - "pk": 3, - "model": "contenttypes.contenttype", - "fields": { - "model": "user", - "name": "user", - "app_label": "auth" - } - }, - { - "pk": 1, - "model": "sites.site", - "fields": { - "domain": "example.com", - "name": "example.com" - } - }, - { - "pk": 13, - "model": "auth.permission", - "fields": { - "codename": "add_logentry", - "name": "Can add log entry", - "content_type": 5 - } - }, - { - "pk": 14, - "model": "auth.permission", - "fields": { - "codename": "change_logentry", - "name": "Can change log entry", - "content_type": 5 - } - }, - { - "pk": 15, - "model": "auth.permission", - "fields": { - "codename": "delete_logentry", - "name": "Can delete log entry", - "content_type": 5 - } - }, - { - "pk": 4, - "model": "auth.permission", - "fields": { - "codename": "add_group", - "name": "Can add group", - "content_type": 2 - } - }, - { - "pk": 5, - "model": "auth.permission", - "fields": { - "codename": "change_group", - "name": "Can change group", - "content_type": 2 - } - }, - { - "pk": 6, - "model": "auth.permission", - "fields": { - "codename": "delete_group", - "name": "Can delete group", - "content_type": 2 - } - }, - { - "pk": 10, - "model": "auth.permission", - "fields": { - "codename": "add_message", - "name": "Can add message", - "content_type": 4 - } - }, - { - "pk": 11, - "model": "auth.permission", - "fields": { - "codename": "change_message", - "name": "Can change message", - "content_type": 4 - } - }, - { - "pk": 12, - "model": "auth.permission", - "fields": { - "codename": "delete_message", - "name": "Can delete message", - "content_type": 4 - } - }, - { - "pk": 1, - "model": "auth.permission", - "fields": { - "codename": "add_permission", - "name": "Can add permission", - "content_type": 1 - } - }, - { - "pk": 2, - "model": "auth.permission", - "fields": { - "codename": "change_permission", - "name": "Can change permission", - "content_type": 1 - } - }, - { - "pk": 3, - "model": "auth.permission", - "fields": { - "codename": "delete_permission", - "name": "Can delete permission", - "content_type": 1 - } - }, - { - "pk": 7, - "model": "auth.permission", - "fields": { - "codename": "add_user", - "name": "Can add user", - "content_type": 3 - } - }, - { - "pk": 8, - "model": "auth.permission", - "fields": { - "codename": "change_user", - "name": "Can change user", - "content_type": 3 - } - }, - { - "pk": 9, - "model": "auth.permission", - "fields": { - "codename": "delete_user", - "name": "Can delete user", - "content_type": 3 - } - }, - { - "pk": 58, - "model": "auth.permission", - "fields": { - "codename": "add_area", - "name": "Can add Area", - "content_type": 20 - } - }, - { - "pk": 59, - "model": "auth.permission", - "fields": { - "codename": "change_area", - "name": "Can change Area", - "content_type": 20 - } - }, - { - "pk": 60, - "model": "auth.permission", - "fields": { - "codename": "delete_area", - "name": "Can delete Area", - "content_type": 20 - } - }, - { - "pk": 40, - "model": "auth.permission", - "fields": { - "codename": "add_route", - "name": "Can add Route", - "content_type": 14 - } - }, - { - "pk": 41, - "model": "auth.permission", - "fields": { - "codename": "change_route", - "name": "Can change Route", - "content_type": 14 - } - }, - { - "pk": 42, - "model": "auth.permission", - "fields": { - "codename": "delete_route", - "name": "Can delete Route", - "content_type": 14 - } - }, - { - "pk": 37, - "model": "auth.permission", - "fields": { - "codename": "add_marker", - "name": "Can add Point of interest", - "content_type": 13 - } - }, - { - "pk": 38, - "model": "auth.permission", - "fields": { - "codename": "change_marker", - "name": "Can change Point of interest", - "content_type": 13 - } - }, - { - "pk": 39, - "model": "auth.permission", - "fields": { - "codename": "delete_marker", - "name": "Can delete Point of interest", - "content_type": 13 - } - }, - { - "pk": 34, - "model": "auth.permission", - "fields": { - "codename": "add_subcategory", - "name": "Can add Subcategory", - "content_type": 12 - } - }, - { - "pk": 35, - "model": "auth.permission", - "fields": { - "codename": "change_subcategory", - "name": "Can change Subcategory", - "content_type": 12 - } - }, - { - "pk": 36, - "model": "auth.permission", - "fields": { - "codename": "delete_subcategory", - "name": "Can delete Subcategory", - "content_type": 12 - } - }, - { - "pk": 43, - "model": "auth.permission", - "fields": { - "codename": "add_area", - "name": "Can add Area", - "content_type": 15 - } - }, - { - "pk": 44, - "model": "auth.permission", - "fields": { - "codename": "change_area", - "name": "Can change Area", - "content_type": 15 - } - }, - { - "pk": 45, - "model": "auth.permission", - "fields": { - "codename": "delete_area", - "name": "Can delete Area", - "content_type": 15 - } - }, - { - "pk": 49, - "model": "auth.permission", - "fields": { - "codename": "add_property", - "name": "Can add Property", - "content_type": 17 - } - }, - { - "pk": 50, - "model": "auth.permission", - "fields": { - "codename": "change_property", - "name": "Can change Property", - "content_type": 17 - } - }, - { - "pk": 51, - "model": "auth.permission", - "fields": { - "codename": "delete_property", - "name": "Can delete Property", - "content_type": 17 - } - }, - { - "pk": 28, - "model": "auth.permission", - "fields": { - "codename": "add_category", - "name": "Can add Category", - "content_type": 10 - } - }, - { - "pk": 29, - "model": "auth.permission", - "fields": { - "codename": "change_category", - "name": "Can change Category", - "content_type": 10 - } - }, - { - "pk": 30, - "model": "auth.permission", - "fields": { - "codename": "delete_category", - "name": "Can delete Category", - "content_type": 10 - } - }, - { - "pk": 64, - "model": "auth.permission", - "fields": { - "codename": "add_property", - "name": "Can add Property", - "content_type": 22 - } - }, - { - "pk": 65, - "model": "auth.permission", - "fields": { - "codename": "change_property", - "name": "Can change Property", - "content_type": 22 - } - }, - { - "pk": 66, - "model": "auth.permission", - "fields": { - "codename": "delete_property", - "name": "Can delete Property", - "content_type": 22 - } - }, - { - "pk": 61, - "model": "auth.permission", - "fields": { - "codename": "add_propertymodel", - "name": "Can add Property model", - "content_type": 21 - } - }, - { - "pk": 62, - "model": "auth.permission", - "fields": { - "codename": "change_propertymodel", - "name": "Can change Property model", - "content_type": 21 - } - }, - { - "pk": 63, - "model": "auth.permission", - "fields": { - "codename": "delete_propertymodel", - "name": "Can delete Property model", - "content_type": 21 - } - }, - { - "pk": 55, - "model": "auth.permission", - "fields": { - "codename": "add_route", - "name": "Can add Route", - "content_type": 19 - } - }, - { - "pk": 56, - "model": "auth.permission", - "fields": { - "codename": "change_route", - "name": "Can change Route", - "content_type": 19 - } - }, - { - "pk": 57, - "model": "auth.permission", - "fields": { - "codename": "delete_route", - "name": "Can delete Route", - "content_type": 19 - } - }, - { - "pk": 52, - "model": "auth.permission", - "fields": { - "codename": "add_routefile", - "name": "Can add Route file", - "content_type": 18 - } - }, - { - "pk": 53, - "model": "auth.permission", - "fields": { - "codename": "change_routefile", - "name": "Can change Route file", - "content_type": 18 - } - }, - { - "pk": 54, - "model": "auth.permission", - "fields": { - "codename": "delete_routefile", - "name": "Can delete Route file", - "content_type": 18 - } - }, - { - "pk": 46, - "model": "auth.permission", - "fields": { - "codename": "add_propertymodel", - "name": "Can add Property model", - "content_type": 16 - } - }, - { - "pk": 47, - "model": "auth.permission", - "fields": { - "codename": "change_propertymodel", - "name": "Can change Property model", - "content_type": 16 - } - }, - { - "pk": 48, - "model": "auth.permission", - "fields": { - "codename": "delete_propertymodel", - "name": "Can delete Property model", - "content_type": 16 - } - }, - { - "pk": 31, - "model": "auth.permission", - "fields": { - "codename": "add_icon", - "name": "Can add Icon", - "content_type": 11 - } - }, - { - "pk": 32, - "model": "auth.permission", - "fields": { - "codename": "change_icon", - "name": "Can change Icon", - "content_type": 11 - } - }, - { - "pk": 33, - "model": "auth.permission", - "fields": { - "codename": "delete_icon", - "name": "Can delete Icon", - "content_type": 11 - } - }, - { - "pk": 16, - "model": "auth.permission", - "fields": { - "codename": "add_contenttype", - "name": "Can add content type", - "content_type": 6 - } - }, - { - "pk": 17, - "model": "auth.permission", - "fields": { - "codename": "change_contenttype", - "name": "Can change content type", - "content_type": 6 - } - }, - { - "pk": 18, - "model": "auth.permission", - "fields": { - "codename": "delete_contenttype", - "name": "Can delete content type", - "content_type": 6 - } - }, - { - "pk": 19, - "model": "auth.permission", - "fields": { - "codename": "add_session", - "name": "Can add session", - "content_type": 7 - } - }, - { - "pk": 20, - "model": "auth.permission", - "fields": { - "codename": "change_session", - "name": "Can change session", - "content_type": 7 - } - }, - { - "pk": 21, - "model": "auth.permission", - "fields": { - "codename": "delete_session", - "name": "Can delete session", - "content_type": 7 - } - }, - { - "pk": 22, - "model": "auth.permission", - "fields": { - "codename": "add_site", - "name": "Can add site", - "content_type": 8 - } - }, - { - "pk": 23, - "model": "auth.permission", - "fields": { - "codename": "change_site", - "name": "Can change site", - "content_type": 8 - } - }, - { - "pk": 24, - "model": "auth.permission", - "fields": { - "codename": "delete_site", - "name": "Can delete site", - "content_type": 8 - } - }, - { - "pk": 25, - "model": "auth.permission", - "fields": { - "codename": "add_news", - "name": "Can add News", - "content_type": 9 - } - }, - { - "pk": 26, - "model": "auth.permission", - "fields": { - "codename": "change_news", - "name": "Can change News", - "content_type": 9 - } - }, - { - "pk": 27, - "model": "auth.permission", - "fields": { - "codename": "delete_news", - "name": "Can delete News", - "content_type": 9 - } - }, - { - "pk": 1, - "model": "auth.group", - "fields": { - "name": "Moderator", - "permissions": [ - 40, - 41, - 42, - 37, - 38, - 39, - 49, - 50, - 51 - ] - } - }, - { - "pk": 2, - "model": "auth.group", - "fields": { - "name": "Application administrator", - "permissions": [ - 40, - 41, - 42, - 37, - 38, - 39, - 34, - 35, - 36, - 43, - 44, - 45, - 49, - 50, - 51, - 28, - 29, - 30, - 31, - 32, - 33, - 25, - 26, - 27 - ] - } - } -] -- cgit v1.2.3 From bf6fe63db02d2aa6c9c7cee31dff270b62a641f6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 24 Jan 2013 23:27:32 +0000 Subject: Disable translation code potentially problematic. --- chimere/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chimere/__init__.py b/chimere/__init__.py index f4026c3..e8e07a3 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2012 Étienne Loks +""" import os os.environ['DJANGO_SETTINGS_MODULE'] = 'example_project.settings' @@ -13,6 +14,7 @@ try: _(u"Picture files") except ImportError: pass +""" VERSION = (2, 0) -- cgit v1.2.3 From 717ee6e71d780d11c0d4bcaf445f966c0cfd0098 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 25 Jan 2013 11:24:35 +0000 Subject: Remove opacity in default style --- chimere/static/chimere/css/styles.css | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 3b835af..88f1b5e 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -73,16 +73,6 @@ div.warning, border:1px solid #ff3f3f; } -/* opacity */ - -#welcome{ - opacity:0.9; -} - -#panel, #areas, #detail, #category_detail{ - opacity:0.8; -} - /* rounded */ /* entête */ -- cgit v1.2.3 From 1d1d49c4c8e01650d09f174fee923243361f20f7 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Jan 2013 19:09:33 +0100 Subject: Update migration errors --- MANIFEST.in | 2 +- README.txt | 6 +++--- apache/django.wsgi | 5 +++-- chimere/models.py | 11 +++++++---- docs/en/upgrade.rst | 3 +++ docs/fr/upgrade.rst | 3 +++ 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 53f651c..565fbbc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt COPYING MANIFEST.in +include *.txt MANIFEST.in include chimere/tests/* prune docs/*/build/ prune example_project/local_settings.py diff --git a/README.txt b/README.txt index de55062..603837a 100644 --- a/README.txt +++ b/README.txt @@ -36,6 +36,6 @@ External libs ============= To be fully functional, this package is provided with external libs: - - `OsmApi `, GPL v3. - - `prettyPhoto `, GPL v2. - - `jMediaelement `, GPL v2. + - `OsmApi `_ - GPL v3. + - `prettyPhoto `_ - GPL v2. + - `jMediaelement `_ - GPL v2. diff --git a/apache/django.wsgi b/apache/django.wsgi index 6227ee2..16758e6 100644 --- a/apache/django.wsgi +++ b/apache/django.wsgi @@ -1,5 +1,6 @@ import os, sys -sys.path.append('/var/local/django/chimere/') -os.environ['DJANGO_SETTINGS_MODULE'] = 'mychimere_project.settings' +MAIN_PATH = os.path.realpath(os.path.dirname(__file__)) + "/.." +sys.path.append(MAIN_PATH) +os.environ['DJANGO_SETTINGS_MODULE'] = 'mychimere_project.settings' # change with your project name import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() diff --git a/chimere/models.py b/chimere/models.py index 5a4be28..6b0d4b3 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1255,11 +1255,14 @@ def area_post_save(sender, **kwargs): perm = Permission.objects.filter(codename=mnemo) lbl = "Can change " + area.name if not perm.count(): - content_type = ContentType.objects.get(app_label="chimere", + try: + content_type = ContentType.objects.get(app_label="chimere", model="area") - perm = Permission(name=lbl, content_type_id=content_type.id, - codename=mnemo) - perm.save() + perm = Permission(name=lbl, content_type_id=content_type.id, + codename=mnemo) + perm.save() + except ObjectDoesNotExist: + pass else: perm = perm.all()[0] if old_name != area.name: diff --git a/docs/en/upgrade.rst b/docs/en/upgrade.rst index d44ae02..fc8dc0f 100644 --- a/docs/en/upgrade.rst +++ b/docs/en/upgrade.rst @@ -195,6 +195,9 @@ Move old static files to the new static directory: cp -ra $CHIMERE_PATH/chimere/static/* $CHIMERE_APP_PATH/static/ cp -ra $CHIMERE_PATH/chimere/static/icons/* $CHIMERE_APP_PATH/media/icons/ cp -ra $CHIMERE_PATH/chimere/static/upload $CHIMERE_APP_PATH/media/ + rm -rf $CHIMERE_PATH/chimere/static/icons + rm -rf $CHIMERE_PATH/chimere/static/upload + Webserver configuration ....................... diff --git a/docs/fr/upgrade.rst b/docs/fr/upgrade.rst index a092b4b..aab4fb6 100644 --- a/docs/fr/upgrade.rst +++ b/docs/fr/upgrade.rst @@ -207,6 +207,9 @@ Déplacez vos anciens fichiers statiques vers le nouveau répertoire : cp -ra $CHIMERE_PATH/chimere/static/* $CHIMERE_APP_PATH/static/ cp -ra $CHIMERE_PATH/chimere/static/icons/* $CHIMERE_APP_PATH/media/icons/ cp -ra $CHIMERE_PATH/chimere/static/upload $CHIMERE_APP_PATH/media/ + rm -rf $CHIMERE_PATH/chimere/static/icons + rm -rf $CHIMERE_PATH/chimere/static/upload + Configuration du serveur Web ............................ -- cgit v1.2.3 From 6dfdd497b131db114c6fc26dd0bbfb657e44d8c5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Jan 2013 19:16:29 +0100 Subject: Better management of missing content type (upgrade issue) --- chimere/models.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index 6b0d4b3..445221b 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1255,14 +1255,11 @@ def area_post_save(sender, **kwargs): perm = Permission.objects.filter(codename=mnemo) lbl = "Can change " + area.name if not perm.count(): - try: - content_type = ContentType.objects.get(app_label="chimere", - model="area") - perm = Permission(name=lbl, content_type_id=content_type.id, - codename=mnemo) - perm.save() - except ObjectDoesNotExist: - pass + content_type, created = ContentType.objects.get_or_create( + app_label="chimere", model="area") + perm = Permission(name=lbl, content_type_id=content_type.id, + codename=mnemo) + perm.save() else: perm = perm.all()[0] if old_name != area.name: @@ -1286,10 +1283,8 @@ def area_post_save(sender, **kwargs): ('chimere', 'multimediafile'), ('chimere', 'picturefile'), ('chimere', 'routefile')): - ct = ContentType.objects.filter(app_label=app_label, model=model) - if not ct.count(): - continue - ct = ct.all()[0] + ct, created = ContentType.objects.get_or_create(app_label=app_label, + model=model) for p in Permission.objects.filter(content_type=ct).all(): group.permissions.add(p) -- cgit v1.2.3 From 280be78a03391ae134bd4b009c648f8217d01bcb Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 29 Jan 2013 20:14:49 +0100 Subject: Minor update on documentation --- docs/en/install.rst | 4 ++-- docs/en/upgrade.rst | 2 +- docs/fr/install.rst | 6 +++--- docs/fr/upgrade.rst | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/en/install.rst b/docs/en/install.rst index 3c2f54b..7ba376b 100644 --- a/docs/en/install.rst +++ b/docs/en/install.rst @@ -276,8 +276,8 @@ Create and edit a configuration for Chimère:: mkdir /var/log/apache2/chimere/ chown www-data /var/log/apache2/chimere/ -Adapt the files *mydjango.wsgi* (with the correct sys path and the correct -module) and Apache *chimere* (with the correct servername and correct paths). +Adapt the files *mydjango.wsgi* (with the correct module) and Apache +*chimere* (with the correct servername and correct paths). To activate the website, reload apache:: diff --git a/docs/en/upgrade.rst b/docs/en/upgrade.rst index fc8dc0f..ef9d0d1 100644 --- a/docs/en/upgrade.rst +++ b/docs/en/upgrade.rst @@ -254,7 +254,7 @@ Django South is now used to manage database migrations. .. code-block:: bash cd $CHIMERE_APP_PATH - ./manage.py syncdb + ./manage.py syncdb --noinput ./manage.py migrate chimere 0001 --fake # fake the database initialisation ./manage.py migrate chimere diff --git a/docs/fr/install.rst b/docs/fr/install.rst index de41584..da6dd05 100644 --- a/docs/fr/install.rst +++ b/docs/fr/install.rst @@ -285,9 +285,9 @@ Créez et éditez la configuration de Chimère en fonction de votre installation mkdir /var/log/apache2/chimere/ chown www-data /var/log/apache2/chimere/ -Adaptez les fichiers *mydjango.wsgi* (avec le chemin correct *sys* des -bibliothèques Python de Chimère et le nom correct pour le module) et le fichier -*chimere* de Apache (avec le nom de serveur correct et les chemins corrects). +Adaptez les fichiers *mydjango.wsgi* (avec le nom correct pour le module) et le +fichier *chimere* de Apache (avec le nom de serveur correct et les chemins +corrects). Pour activer le site web, rechargez Apache : :: diff --git a/docs/fr/upgrade.rst b/docs/fr/upgrade.rst index aab4fb6..b43ccd3 100644 --- a/docs/fr/upgrade.rst +++ b/docs/fr/upgrade.rst @@ -271,7 +271,7 @@ Django South est maintenant utilisé pour les migrations de base de données. .. code-block:: bash cd $CHIMERE_APP_PATH - ./manage.py syncdb + ./manage.py syncdb --noinput ./manage.py migrate chimere 0001 --fake # simule l'initialisation de la base # de données ./manage.py migrate chimere -- cgit v1.2.3 From 7d2b053eb79b5ffa81d8b2664b5bb3e510fcc6d8 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 01:35:54 +0100 Subject: Fix bad detextion of modification in admin --- chimere/templates/admin/chimere/marker/change_form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimere/templates/admin/chimere/marker/change_form.html b/chimere/templates/admin/chimere/marker/change_form.html index 64c48f9..5e8cfaf 100644 --- a/chimere/templates/admin/chimere/marker/change_form.html +++ b/chimere/templates/admin/chimere/marker/change_form.html @@ -1,7 +1,7 @@ {% extends "admin/change_form.html" %} {% load i18n %} {% block field_sets %} -{% if original.ref_item and original.ref_item != orginal %} +{% if original.ref_item and original.ref_item != original %}

{% url admin:admin-modification object_id as rapprochement_form %} {% blocktrans %} -- cgit v1.2.3 From 3e3270cba7fc238eef7c18f935bc2a0dfa6d3063 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 12:49:37 +0100 Subject: Fix rights migration --- chimere/migrations/0042_fix_rights.py | 264 ++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 chimere/migrations/0042_fix_rights.py diff --git a/chimere/migrations/0042_fix_rights.py b/chimere/migrations/0042_fix_rights.py new file mode 100644 index 0000000..50bb5ad --- /dev/null +++ b/chimere/migrations/0042_fix_rights.py @@ -0,0 +1,264 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models +from django.contrib.auth.models import ContentType, Permission, Group, User + +class Migration(DataMigration): + + def forwards(self, orm): + "Fix bad migration of content type." + # chimère migration: we can use auth models directly + for ct in ContentType.objects.filter(app_label='main').all(): + new_ct, n = ContentType.objects.get_or_create(app_label='chimere', + model=ct.model, + defaults={'name':ct.name}) + if not new_ct.name and ct.name: + new_ct.name = ct.name + new_ct.save() + try: + perm = Permission.objects.get(content_type=ct) + except: + ct.delete() + continue + new_perm, n = Permission.objects.get_or_create(content_type=new_ct, + defaults={'name':perm.name, 'codename':perm.codename}) + groups = Group.objects.filter(permissions=perm).distinct() + for group in groups.all(): + group.permissions.remove(perm) + group.permissions.add(new_perm) + users = User.objects.filter(user_permissions=perm).distinct() + for user in users.all(): + user.user_permissions.remove(perm) + user.user_permissions.add(new_perm) + perm.delete() + ct.delete() + + def backwards(self, orm): + pass + + models = { + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] + symmetrical = True -- cgit v1.2.3 From 9dfc96ed50064ecb845daff814fc5294d292b71b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 13:19:21 +0100 Subject: Fix rights migration (2) --- chimere/migrations/0042_fix_rights.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/chimere/migrations/0042_fix_rights.py b/chimere/migrations/0042_fix_rights.py index 50bb5ad..53dd0ab 100644 --- a/chimere/migrations/0042_fix_rights.py +++ b/chimere/migrations/0042_fix_rights.py @@ -17,22 +17,21 @@ class Migration(DataMigration): if not new_ct.name and ct.name: new_ct.name = ct.name new_ct.save() - try: - perm = Permission.objects.get(content_type=ct) - except: - ct.delete() - continue - new_perm, n = Permission.objects.get_or_create(content_type=new_ct, - defaults={'name':perm.name, 'codename':perm.codename}) - groups = Group.objects.filter(permissions=perm).distinct() - for group in groups.all(): - group.permissions.remove(perm) - group.permissions.add(new_perm) - users = User.objects.filter(user_permissions=perm).distinct() - for user in users.all(): - user.user_permissions.remove(perm) - user.user_permissions.add(new_perm) - perm.delete() + for perm in Permission.objects.filter(content_type_id=ct.pk).all(): + new_perm, n = Permission.objects.get_or_create( + content_type=new_ct, codename=perm.codename, + defaults={'name':perm.name}) + groups = Group.objects.filter(permissions=perm).distinct() + for group in groups.all(): + print "youpi" + group.permissions.remove(perm) + group.permissions.add(new_perm) + users = User.objects.filter(user_permissions=perm).distinct() + for user in users.all(): + print "youpiI" + user.user_permissions.remove(perm) + user.user_permissions.add(new_perm) + perm.delete() ct.delete() def backwards(self, orm): -- cgit v1.2.3 From 207f3f59280d23dbee3d7192e992c082b3008ad8 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 13:20:32 +0100 Subject: Minor (remove prints) --- chimere/migrations/0042_fix_rights.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/chimere/migrations/0042_fix_rights.py b/chimere/migrations/0042_fix_rights.py index 53dd0ab..6b64313 100644 --- a/chimere/migrations/0042_fix_rights.py +++ b/chimere/migrations/0042_fix_rights.py @@ -23,12 +23,10 @@ class Migration(DataMigration): defaults={'name':perm.name}) groups = Group.objects.filter(permissions=perm).distinct() for group in groups.all(): - print "youpi" group.permissions.remove(perm) group.permissions.add(new_perm) users = User.objects.filter(user_permissions=perm).distinct() for user in users.all(): - print "youpiI" user.user_permissions.remove(perm) user.user_permissions.add(new_perm) perm.delete() -- cgit v1.2.3 From 78e45b506e70114a98a05157aff9fd33c0b9703a Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 17:10:03 +0100 Subject: Fix modification link in admin --- chimere/admin.py | 8 +++++--- chimere/models.py | 7 +++++++ chimere/templates/admin/chimere/marker/change_form.html | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/chimere/admin.py b/chimere/admin.py index 0f17d30..4b83878 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -97,7 +97,8 @@ export_to_csv.short_description = _(u"Export to CSV") def managed_modified(modeladmin, request, queryset): # not very clean... There is must be a better way to do that redirect_url = request.get_full_path().split('admin_modification')[0] - if queryset.count() != 1: + if queryset.count() != 1 and len(set([i.ref_item or i + for i in queryset.all()])) != 1: messages.error(request, _(u"Only one item can be managed at a " u"time.")) return HttpResponseRedirect(redirect_url) @@ -105,8 +106,9 @@ def managed_modified(modeladmin, request, queryset): item = queryset.all()[0] if not item.ref_item or item.ref_item == item: try: - item = modeladmin.model.objects.get(ref_item=item) - except ObjectDoesNotExist: + item = modeladmin.model.objects.filter(ref_item=item + ).exclude(pk=item.pk).all()[0] + except IndexError: messages.error(request, _(u"No modified item associated " u"to the selected item.")) return HttpResponseRedirect(redirect_url) diff --git a/chimere/models.py b/chimere/models.py index 445221b..79252f6 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -334,6 +334,13 @@ class GeographicItem(models.Model): self.import_key = new_keys self.save() + def has_modified(self): + if (self.ref_item and self.ref_item != self) \ + or self.__class__.objects.filter(ref_item=self + ).exclude(pk=self.pk).count(): + return True + return False + @classmethod def properties(cls): return [pm for pm in PropertyModel.objects.filter(available=True)] diff --git a/chimere/templates/admin/chimere/marker/change_form.html b/chimere/templates/admin/chimere/marker/change_form.html index 5e8cfaf..3b3d238 100644 --- a/chimere/templates/admin/chimere/marker/change_form.html +++ b/chimere/templates/admin/chimere/marker/change_form.html @@ -1,7 +1,7 @@ {% extends "admin/change_form.html" %} {% load i18n %} {% block field_sets %} -{% if original.ref_item and original.ref_item != original %} +{% if original.has_modified %}

{% url admin:admin-modification object_id as rapprochement_form %} {% blocktrans %} -- cgit v1.2.3 From fea958d3e513c8237f509186bccb706cc655f363 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 19:46:43 +0100 Subject: Remove outdated markers from news --- chimere/templatetags/chimere_tags.py | 5 +++-- chimere/tests.py | 6 ++++++ chimere/views.py | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index 2b806ca..0182b66 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -62,8 +62,9 @@ def display_news(context, display=False): # Retrieve active markers today = date.today() after = today + timedelta(settings.CHIMERE_DAYS_BEFORE_EVENT) - q = Marker.objects.filter(status='A', start_date__lte=after - ).filter(Q(end_date__gte=today)|Q(end_date__isnull=True)) + q = Marker.objects.filter(status='A').filter(start_date__lte=after + ).filter(Q(end_date__gte=today)| + (Q(end_date__isnull=True) & Q(start_date__gte=today))) if area: q = q.filter(area.getIncludeMarker()) news += list(q) diff --git a/chimere/tests.py b/chimere/tests.py index d3dc3de..175a6b8 100644 --- a/chimere/tests.py +++ b/chimere/tests.py @@ -385,6 +385,12 @@ class NewsTest(TestCase): def setUp(self): self.areas = areas_setup() self.markers = marker_setup() + current_date = datetime.datetime.now() + marker = Marker.objects.create(name="Marker 4", status='A', + point='SRID=4326;POINT(-4.5 48.45)', + available_date=current_date - datetime.timedelta(days=90), + start_date=current_date - datetime.timedelta(days=90), + end_date=None) self.news = [] self.news.append(News.objects.create(title=u"Test news 1", available=True)) diff --git a/chimere/views.py b/chimere/views.py index db63809..6a51394 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2012 Étienne Loks +# Copyright (C) 2008-2013 Étienne Loks # # RSS : Copyright (C) 2010 Pierre Clarenc , # Samuel Renard , -- cgit v1.2.3 From 600e2114ff29f1d87663bda0b300774ec3f5575b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2013 21:27:32 +0100 Subject: Small improve on KML import --- chimere/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/chimere/utils.py b/chimere/utils.py index 8a9855a..fe1a8a1 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -50,7 +50,7 @@ def unicode_normalize(string): (c for c in unicodedata.normalize('NFD', string) if unicodedata.category(c) != 'Mn')) -class ImportManager: +class ImportManager(object): u""" Generic class for specific importers """ @@ -74,6 +74,8 @@ class ImportManager: key='', pk=None): updated, created, item = False, False, None import_key = unicode(import_key).replace(':', '^') + if not values.get('name'): + values['name'] = self.default_name if not key: key = self.importer_instance.importer_type if import_key or pk: @@ -84,7 +86,10 @@ class ImportManager: if pk: ref_item = cls.objects.get(pk=pk) else: - ref_item = cls.objects.get(**dct_import) + ref_item = cls.objects.filter(**dct_import) + if not ref_item.count(): + raise ObjectDoesNotExist + ref_item = ref_item.all()[0] if version and ref_item.import_version == int(version): # no update since the last import return ref_item, None, None @@ -196,7 +201,7 @@ class KMLManager(ImportManager): XPATH = '//kml:Folder/kml:name[text()="%s"]/../kml:Placemark' DEFAULT_XPATH = '//kml:Placemark' def __init__(self, importer_instance, ns=''): - self.importer_instance = importer_instance + super(KMLManager, self).__init__(importer_instance) self.ns = ns def get(self): @@ -674,8 +679,6 @@ class OSMManager(ImportManager): name = item.attrib.get('v') if item.tag == 'nd': points.append(item.get('ref')) - if not name: - name = self.default_name if not points: continue wkt = 'SRID=4326;LINESTRING(%s)' % ",".join([nodes[point_id] @@ -709,8 +712,6 @@ class OSMManager(ImportManager): k = item.attrib.get('k') if k == 'name': name = item.attrib.get('v') - if not name: - name = self.default_name point = 'SRID=4326;POINT(%s %s)' % (node.get('lon'), node.get('lat')) dct = {'point':point, -- cgit v1.2.3 From fb64637f6579952516d2c4839fdd99df1e707ed4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 31 Jan 2013 15:48:57 +0100 Subject: Imports: make description import optional --- chimere/locale/fr/LC_MESSAGES/django.po | 288 +++++++++++---------- ...043_auto__add_field_importer_get_description.py | 245 ++++++++++++++++++ chimere/models.py | 4 +- chimere/static/chimere/js/importer_interface.js | 8 +- chimere/utils.py | 18 +- 5 files changed, 411 insertions(+), 152 deletions(-) create mode 100644 chimere/migrations/0043_auto__add_field_importer_get_description.py diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po index 64ed511..93810c3 100644 --- a/chimere/locale/fr/LC_MESSAGES/django.po +++ b/chimere/locale/fr/LC_MESSAGES/django.po @@ -7,21 +7,13 @@ msgid "" msgstr "" "Project-Id-Version: 0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-08 00:17+0100\n" +"POT-Creation-Date: 2013-01-31 15:48+0100\n" "PO-Revision-Date: 2010-03-20 20:00+0100\n" "Last-Translator: Étienne Loks \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: __init__.py:8 models.py:649 -msgid "Multimedia files" -msgstr "Fichiers multimedias" - -#: __init__.py:9 models.py:721 -msgid "Picture files" -msgstr "Fichiers d'image" - #: actions.py:31 msgid "View" msgstr "Voir" @@ -67,73 +59,73 @@ msgstr "Exporter en Shapefile" msgid "Export to CSV" msgstr "Exporter en CSV" -#: admin.py:101 +#: admin.py:102 msgid "Only one item can be managed at a time." msgstr "Seul un élément à la fois peut-être géré." -#: admin.py:110 +#: admin.py:112 msgid "No modified item associated to the selected item." msgstr "Pas d'élément modifié associé à l'élément sélectionné." -#: admin.py:156 +#: admin.py:158 msgid "Modified item traited." msgstr "Élément modifié traité." -#: admin.py:161 +#: admin.py:163 msgid "Managed modified items" msgstr "Gérer les éléments modifiés" -#: admin.py:195 admin.py:270 +#: admin.py:197 admin.py:272 msgid "Submitter" msgstr "Demandeur" -#: admin.py:200 admin.py:275 admin.py:326 +#: admin.py:202 admin.py:277 admin.py:328 msgid "Import" msgstr "Import" -#: admin.py:205 admin.py:280 +#: admin.py:207 admin.py:282 msgid "Associated items" msgstr "Éléments associés" -#: admin.py:332 +#: admin.py:334 msgid "Cancel import" msgstr "Annuler l'import" -#: admin.py:338 +#: admin.py:340 msgid "Cancel export" msgstr "Annuler l'export" -#: admin.py:342 +#: admin.py:344 msgid "Can manage only one OSM export at a time." msgstr "Ne peux gérer qu'un seul export OSM à la fois." -#: admin.py:347 +#: admin.py:349 msgid "" "You must treat all item with the status \"imported\" before exporting to OSM." msgstr "" "Vous devez traiter tous les éléments avec le status « importé » avant " "d'exporter vers OSM." -#: admin.py:351 +#: admin.py:353 msgid "Only OSM importer are managed for export." msgstr "Seul les imports de type OSM peuvent être gérés pour les exports." -#: admin.py:358 +#: admin.py:360 msgid "No point of interest are concerned by this export." msgstr "Aucun point d'intérêt n'est concerné par cet export." -#: admin.py:370 +#: admin.py:372 msgid "Export launched." msgstr "Export lancé." -#: admin.py:374 +#: admin.py:376 #, python-format msgid "" "%s point(s) of interest concerned by this export before bounding box filter." msgstr "" "%s point(s) d'intérêt concerné par cet export (avant le filtre sur la zone)" -#: admin.py:379 +#: admin.py:381 msgid "Export to osm" msgstr "Exporter vers osm" @@ -174,7 +166,7 @@ msgstr "Objet" msgid "OSM user" msgstr "Utilisateur OSM" -#: forms.py:98 models.py:1338 +#: forms.py:98 models.py:1349 msgid "Password" msgstr "Mot de passe" @@ -236,15 +228,15 @@ msgid "Bad file format: this must be a GPX or KML file" msgstr "Mauvais format de fichier : KML et GPX sont supportés" #: forms.py:471 models.py:51 models.py:106 models.py:127 models.py:140 -#: models.py:155 models.py:273 models.py:583 models.py:639 models.py:698 -#: models.py:814 models.py:1143 models.py:1155 models.py:1328 utils.py:469 +#: models.py:155 models.py:276 models.py:593 models.py:649 models.py:708 +#: models.py:824 models.py:1153 models.py:1165 models.py:1339 utils.py:476 #: templates/admin/chimere/managed_modified.html:23 #: templates/chimere/edit.html:39 templates/chimere/edit_route.html:36 #: templates/chimere/blocks/alternate_multimedia.html:38 msgid "Name" msgstr "Nom" -#: forms.py:480 models.py:1192 +#: forms.py:480 models.py:1202 msgid "Area" msgstr "Zone" @@ -258,12 +250,12 @@ msgid "The area \"%s\" has the same order, you need to choose another one." msgstr "" "La zone « %s » a le même numéro d'ordre, vous devez un choisir un autre." -#: models.py:52 models.py:128 models.py:156 models.py:284 models.py:587 -#: models.py:1161 models.py:1330 +#: models.py:52 models.py:128 models.py:156 models.py:287 models.py:597 +#: models.py:1171 models.py:1341 msgid "Available" msgstr "Disponible" -#: models.py:53 models.py:1339 +#: models.py:53 models.py:1350 msgid "Date" msgstr "Date" @@ -291,8 +283,8 @@ msgstr "Thème de couleur" msgid "Code" msgstr "Code" -#: models.py:116 models.py:129 models.py:162 models.py:641 models.py:713 -#: models.py:1160 models.py:1317 models.py:1329 +#: models.py:116 models.py:129 models.py:162 models.py:651 models.py:723 +#: models.py:1170 models.py:1328 models.py:1340 msgid "Order" msgstr "Ordre" @@ -304,16 +296,16 @@ msgstr "Couleur" msgid "Category" msgstr "Catégorie" -#: models.py:141 models.py:579 models.py:699 models.py:880 +#: models.py:141 models.py:589 models.py:709 models.py:890 #: templates/chimere/blocks/alternate_multimedia.html:42 msgid "Image" msgstr "Image" -#: models.py:143 models.py:701 models.py:882 +#: models.py:143 models.py:711 models.py:892 msgid "Height" msgstr "Hauteur" -#: models.py:144 models.py:702 models.py:883 +#: models.py:144 models.py:712 models.py:893 msgid "Width" msgstr "Largeur" @@ -329,7 +321,7 @@ msgstr "Disponible pour soumission" msgid "Marker" msgstr "Point d'intérêt" -#: models.py:164 models.py:876 models.py:893 +#: models.py:164 models.py:886 models.py:903 #: templates/chimere/edit_route.html:27 msgid "Route" msgstr "Trajet" @@ -382,287 +374,299 @@ msgstr "Fichier zippé" msgid "Overwrite existing data" msgstr "Écraser les données existantes" -#: models.py:243 models.py:300 +#: models.py:244 +msgid "Get description from source" +msgstr "Obtenir une description depuis la source de données" + +#: models.py:246 models.py:303 msgid "Origin" msgstr "Origine" -#: models.py:245 models.py:302 +#: models.py:248 models.py:305 msgid "License" msgstr "Licence" -#: models.py:248 +#: models.py:251 msgid "Associated subcategories" msgstr "Sous-catégories associées" -#: models.py:249 utils.py:473 +#: models.py:252 utils.py:480 msgid "State" msgstr "État" -#: models.py:251 +#: models.py:254 msgid "Automatically associate a marker to a way" msgstr "Associer automatiquement un marqueur à une route" -#: models.py:255 +#: models.py:258 msgid "Importer" msgstr "Import" -#: models.py:275 +#: models.py:278 msgid "Submitter session key" msgstr "Clé de session du demandeur" -#: models.py:277 +#: models.py:280 msgid "Submitter name or nickname" msgstr "Nom ou pseudo du demandeur" -#: models.py:279 +#: models.py:282 msgid "Submitter email" msgstr "Courriel du demandeur" -#: models.py:281 +#: models.py:284 msgid "Submitter comment" msgstr "Commentaire du demandeur" -#: models.py:283 +#: models.py:286 msgid "Submited" msgstr "Soumis" -#: models.py:285 +#: models.py:288 msgid "Modified" msgstr "Modifié" -#: models.py:286 +#: models.py:289 msgid "Disabled" msgstr "Désactivé" -#: models.py:287 +#: models.py:290 msgid "Imported" msgstr "Importé" -#: models.py:289 +#: models.py:292 msgid "Status" msgstr "État" -#: models.py:290 +#: models.py:293 msgid "Import key" msgstr "Clé d'import" -#: models.py:292 +#: models.py:295 msgid "Import version" msgstr "Version de l'import" -#: models.py:294 +#: models.py:297 msgid "Source" msgstr "Source" -#: models.py:296 +#: models.py:299 msgid "Modified since last import" msgstr "Modifié depuis le dernier import" -#: models.py:298 +#: models.py:301 msgid "Not to be exported to OSM" msgstr "À ne pas exporter vers OSM" -#: models.py:304 templates/chimere/edit.html:56 +#: models.py:307 templates/chimere/edit.html:56 #: templates/chimere/edit_route.html:52 msgid "Start date" msgstr "Date de début" -#: models.py:305 +#: models.py:308 msgid "Not mandatory. Set it for dated item such as event. Format YYYY-MM-DD" msgstr "" "Optionnel. Précisez ce champ pour les éléments datés comme un événement. " "Format du champ : AAAA-MM-JJ" -#: models.py:307 templates/chimere/edit.html:62 +#: models.py:310 templates/chimere/edit.html:62 #: templates/chimere/edit_route.html:58 msgid "End date" msgstr "Date de fin" -#: models.py:308 +#: models.py:311 msgid "" "Not mandatory. Set it only if you have a multi-day event. Format YYYY-MM-DD" msgstr "" "Optionnel. Précisez ce champ seulement pour des événements durant plusieurs " "jours. Format du champ : AAAA-MM-JJ" -#: models.py:354 +#: models.py:364 msgid "Reference marker" msgstr "Point d'intérêt de référence" -#: models.py:355 utils.py:475 +#: models.py:365 utils.py:482 msgid "Localisation" msgstr "Localisation" -#: models.py:357 +#: models.py:367 msgid "Available Date" msgstr "Date de mise en disponibilité" -#: models.py:361 utils.py:474 templates/admin/chimere/managed_modified.html:31 +#: models.py:371 utils.py:481 templates/admin/chimere/managed_modified.html:31 #: templates/chimere/edit.html:49 templates/chimere/edit_route.html:46 msgid "Description" msgstr "Description" -#: models.py:423 models.py:1364 +#: models.py:433 models.py:1375 msgid "Point of interest" msgstr "Point d'intérêt" -#: models.py:577 +#: models.py:587 msgid "Audio" msgstr "Audio" -#: models.py:578 +#: models.py:588 msgid "Video" msgstr "Vidéo" -#: models.py:580 +#: models.py:590 msgid "Other" msgstr "Autre" -#: models.py:581 +#: models.py:591 msgid "Media type" msgstr "Type de media" -#: models.py:584 +#: models.py:594 msgid "Mime type" msgstr "Type mime" -#: models.py:586 +#: models.py:596 msgid "Inside an iframe" msgstr "À l'intérieur d'un iframe" -#: models.py:590 +#: models.py:600 msgid "Multimedia type" msgstr "Type de multimedia" -#: models.py:591 +#: models.py:601 msgid "Multimedia types" msgstr "Types de multimedia" -#: models.py:600 +#: models.py:610 msgid "Automatic recognition" msgstr "Reconnaissance automatique" -#: models.py:626 +#: models.py:636 msgid "Extension name" msgstr "Nom de l'extension" -#: models.py:628 +#: models.py:638 msgid "Associated multimedia type" msgstr "Type de multimedia associé" -#: models.py:632 +#: models.py:642 msgid "Multimedia extension" msgstr "Extension multimedia" -#: models.py:633 +#: models.py:643 msgid "Multimedia extensions" msgstr "Extensions multimedia" -#: models.py:640 +#: models.py:650 msgid "Url" msgstr "Url" -#: models.py:643 models.py:703 +#: models.py:653 models.py:713 msgid "Display inside the description?" msgstr "Apparaît dans la description ?" -#: models.py:648 +#: models.py:658 msgid "Multimedia file" msgstr "Fichier multimedia" -#: models.py:705 +#: models.py:659 +msgid "Multimedia files" +msgstr "Fichiers multimedias" + +#: models.py:715 msgid "Thumbnail" msgstr "Miniature" -#: models.py:709 +#: models.py:719 msgid "Thumbnail height" msgstr "Hauteur de la miniature" -#: models.py:711 +#: models.py:721 msgid "Thumbnail width" msgstr "Largeur de la miniature" -#: models.py:720 +#: models.py:730 msgid "Picture file" msgstr "Fichier d'image" -#: models.py:815 +#: models.py:731 +msgid "Picture files" +msgstr "Fichiers d'image" + +#: models.py:825 msgid "Raw file (gpx or kml)" msgstr "Fichier brut (gpx ou kml)" -#: models.py:817 +#: models.py:827 msgid "Simplified file" msgstr "Fichier simplifié" -#: models.py:819 +#: models.py:829 msgid "KML" msgstr "KML" -#: models.py:819 +#: models.py:829 msgid "GPX" msgstr "GPX" -#: models.py:824 +#: models.py:834 msgid "Route file" msgstr "Fichier de trajet" -#: models.py:825 +#: models.py:835 msgid "Route files" msgstr "Fichiers de trajet" -#: models.py:875 +#: models.py:885 msgid "Reference route" msgstr "Trajet de référence" -#: models.py:879 +#: models.py:889 msgid "Associated file" msgstr "Fichier associé" -#: models.py:884 +#: models.py:894 msgid "Has an associated marker" msgstr "Dispose d'un marqueur associé" -#: models.py:1144 +#: models.py:1154 msgid "Layer code" msgstr "Code pour la couche" -#: models.py:1150 +#: models.py:1160 msgid "Layer" msgstr "Couche" -#: models.py:1156 +#: models.py:1166 msgid "Area urn" msgstr "Urn de la zone" -#: models.py:1158 templates/chimere/blocks/welcome.html:3 +#: models.py:1168 templates/chimere/blocks/welcome.html:3 msgid "Welcome message" msgstr "Message d'accueil" -#: models.py:1162 +#: models.py:1172 msgid "Upper left corner" msgstr "Coin en haut à gauche" -#: models.py:1164 +#: models.py:1174 msgid "Lower right corner" msgstr "Coin en bas à droite" -#: models.py:1166 +#: models.py:1176 msgid "Default area" msgstr "Zone par défaut" -#: models.py:1167 +#: models.py:1177 msgid "Only one area is set by default" msgstr "Seule une zone est définie par défaut" -#: models.py:1171 +#: models.py:1181 msgid "Sub-categories checked by default" msgstr "Sous-catégories cochées par défaut" -#: models.py:1173 +#: models.py:1183 msgid "Sub-categories dynamicaly displayed" msgstr "Sous-categories affichées dynamiquement" -#: models.py:1174 +#: models.py:1184 msgid "" "If checked, categories are only displayed in the menu if they are available " "on the current extent." @@ -670,64 +674,64 @@ msgstr "" "Si coché, les catégories sont disponibles sur le menu seulement si elles " "apparaissent sur la zone affichée." -#: models.py:1178 models.py:1333 +#: models.py:1188 models.py:1344 msgid "Restricted to theses sub-categories" msgstr "Restreindre à ces sous-categories" -#: models.py:1179 +#: models.py:1189 msgid "If no sub-category is set all sub-categories are available" msgstr "" "Si aucune sous-catégorie n'est définie toutes les sous-catégories sont " "disponibles" -#: models.py:1181 +#: models.py:1191 msgid "Link to an external CSS" msgstr "Lien vers une feuille de style externe" -#: models.py:1183 +#: models.py:1193 msgid "Restrict to the area extent" msgstr "Restreindre à l'étendue de la zone" -#: models.py:1318 +#: models.py:1329 msgid "Default layer" msgstr "Couche par défaut" -#: models.py:1322 models.py:1323 +#: models.py:1333 models.py:1334 msgid "Layers" msgstr "Couches" -#: models.py:1331 +#: models.py:1342 msgid "Mandatory" msgstr "Obligatoire" -#: models.py:1334 +#: models.py:1345 msgid "" "If no sub-category is set all the property applies to all sub-categories" msgstr "" "Si aucune sous-catégorie n'est précisée, cette propriété est disponible pour " "toutes les sous-catégories" -#: models.py:1336 +#: models.py:1347 msgid "Text" msgstr "Texte" -#: models.py:1337 +#: models.py:1348 msgid "Long text" msgstr "Texte long" -#: models.py:1344 +#: models.py:1355 msgid "Type" msgstr "Type" -#: models.py:1349 models.py:1366 +#: models.py:1360 models.py:1377 msgid "Property model" msgstr "Modèle de propriété" -#: models.py:1367 +#: models.py:1378 msgid "Value" msgstr "Valeur" -#: models.py:1371 +#: models.py:1382 msgid "Property" msgstr "Propriété" @@ -781,69 +785,69 @@ msgstr "Export échoué" msgid "Export canceled" msgstr "Export annulé" -#: utils.py:134 utils.py:183 +#: utils.py:139 utils.py:188 msgid "Bad zip file" msgstr "Mauvais fichier zip" -#: utils.py:186 +#: utils.py:191 msgid "Missing file(s) inside the zip file" msgstr "Fichier(s) manquant(s) dans l'archive zip" -#: utils.py:227 +#: utils.py:232 msgid "Bad XML file" msgstr "Mauvais fichier XML" -#: utils.py:312 +#: utils.py:319 msgid "Error while reading the data source." msgstr "Erreur lors de la lecture de la source." -#: utils.py:330 +#: utils.py:337 #, python-format msgid "SRID cannot be guessed. The default SRID (%s) has been used." msgstr "Le SRID n'a pu être trouvé. Le SRID par défaut (%s) a été utilisé." -#: utils.py:351 +#: utils.py:358 msgid "Type of geographic item of this shapefile is not managed by Chimère." msgstr "" "Les types des éléments géographiques de ce fichier Shapefile ne sont pas " "gérés par Chimère." -#: utils.py:371 +#: utils.py:378 msgid "Bad Shapefile" msgstr "Mauvais fichier Shapefile" -#: utils.py:413 +#: utils.py:420 msgid "Could not create file!" msgstr "Ne peut pas créer le fichier !" -#: utils.py:424 +#: utils.py:431 msgid "Failed to create field" msgstr "Ne peut pas créer un champ" -#: utils.py:470 templates/admin/chimere/managed_modified.html:25 +#: utils.py:477 templates/admin/chimere/managed_modified.html:25 #: templates/chimere/edit.html:44 templates/chimere/edit_route.html:41 #: templates/chimere/main_map.html:13 #: templates/chimere/main_map_simple.html:10 msgid "Categories" msgstr "Catégories" -#: utils.py:503 +#: utils.py:510 msgid "Invalid CSV format" msgstr "Fichier CSV non valide" -#: utils.py:578 +#: utils.py:588 msgid "RSS feed is not well formed" msgstr "Flux RSS non valide" -#: utils.py:653 +#: utils.py:664 msgid "Nothing to import" msgstr "Rien à importer" -#: utils.py:741 +#: utils.py:748 msgid "New items imported - validate them before exporting" msgstr "Nouveaux éléments importés - valider ceux-ci avant d'exporter" -#: utils.py:743 +#: utils.py:750 msgid "" "There are items from a former import not yet validated - validate them " "before exporting" @@ -851,19 +855,19 @@ msgstr "" "Il y a des éléments d'un import précédent pas encore validé - Validez les " "avant d'exporter" -#: utils.py:755 +#: utils.py:762 msgid "Bad params - programming error" msgstr "Mauvais paramètres - erreur de programmation" -#: utils.py:765 +#: utils.py:772 msgid "Bad param" msgstr "Mauvais paramètre" -#: utils.py:780 +#: utils.py:787 msgid "No non ambigious tag is defined in the XAPI request" msgstr "Pas de tag non ambigü définis dans la requête XAPI" -#: utils.py:782 +#: utils.py:789 msgid "" "No bounding box is defined in the XAPI request.If you are sure to manage the " "entire planet set the bounding box to -180,-90,180,90" @@ -1147,8 +1151,8 @@ msgid "" "rapprochement form.\n" msgstr "" "\n" -"Cet élément a un élément de référence associé. Vous devriez le traiter via le " -"formulaire de rapprochement.\n" +"Cet élément a un élément de référence associé. Vous devriez le traiter via " +"le formulaire de rapprochement.\n" #: templates/admin/chimere/propertymodel/change_form.html:5 msgid "" diff --git a/chimere/migrations/0043_auto__add_field_importer_get_description.py b/chimere/migrations/0043_auto__add_field_importer_get_description.py new file mode 100644 index 0000000..295d3b2 --- /dev/null +++ b/chimere/migrations/0043_auto__add_field_importer_get_description.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Importer.get_description' + db.add_column('chimere_importer', 'get_description', + self.gf('django.db.models.fields.BooleanField')(default=False), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Importer.get_description' + db.delete_column('chimere_importer', 'get_description') + + + models = { + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file diff --git a/chimere/models.py b/chimere/models.py index 79252f6..a9b4a32 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2012 Étienne Loks +# Copyright (C) 2008-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -241,6 +241,8 @@ class Importer(models.Model): zipped = models.BooleanField(_(u"Zipped file"), default=False) overwrite = models.BooleanField(_(u"Overwrite existing data"), default=False) + get_description = models.BooleanField(_(u"Get description from source"), + default=False) origin = models.CharField(_(u"Origin"), max_length=100, blank=True, null=True) license = models.CharField(_(u"License"), max_length=100, diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index aa332d4..0b563b6 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -4,16 +4,18 @@ django.jQuery(function($) { 'field-source', 'field-overwrite'), KML:new Array('field-source', 'field-source_file', 'field-default_name', 'field-filtr', 'field-zipped', 'field-origin', - 'field-license', 'field-categories', 'field-overwrite'), + 'field-license', 'field-categories', 'field-overwrite', + 'field-get_description'), SHP:new Array('field-source', 'field-source_file', 'field-default_name', 'field-zipped', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite'), RSS:new Array('field-source', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', - 'field-overwrite'), + 'field-overwrite', 'field-get_description'), CSV:new Array('field-source', 'field-source_file', 'field-default_name', 'field-origin', 'field-srid', 'field-license', - 'field-categories', 'field-overwrite') + 'field-categories', 'field-overwrite', + 'field-get_description') } var map_initialized; function refresh_importer_form(){ diff --git a/chimere/utils.py b/chimere/utils.py index fe1a8a1..c4e882b 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -241,6 +241,7 @@ class KMLManager(ImportManager): pl_id = placemark.attrib.get('id') pl_key = 'kml-%d' % self.importer_instance.pk ns = '{%s}' % self.ns + description = '' for item in placemark: if item.tag == ns + 'name': name = item.text @@ -248,7 +249,8 @@ class KMLManager(ImportManager): # if no ID is provided assume that name is a key pl_id = name elif item.tag == ns + 'description': - description = item.text + if self.importer_instance.get_description: + description = item.text elif item.tag == ns + 'Point': for coord in item: if coord.tag == ns + 'coordinates': @@ -510,7 +512,10 @@ class CSVManager(ImportManager): if len(row) < len(cols): continue pk, name, cats, state = row[0], row[1], row[2], row[3] - description, geom = row[4], row[5] + geom = row[5] + description = '' + if self.importer_instance.get_description: + description = row[4] COL_INDEX = 6 dct = {'description':description, 'name':name, @@ -599,10 +604,11 @@ class GeoRSSManager(ImportManager): y = item['geo_lat'] x = item['geo_long'] dct['point'] = 'SRID=4326;POINT(%s %s)' % (x, y) - for k in ['description', 'summary', 'value']: - if k in item: - dct['description'] = item[k] - break + if self.importer_instance.get_description: + for k in ['description', 'summary', 'value']: + if k in item: + dct['description'] = item[k] + break else: cls = Route points = item['georss_line'].split(' ') -- cgit v1.2.3 From aac22ae3b072b4b40962b5e776e403431e3886db Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 31 Jan 2013 19:00:46 +0100 Subject: Imports: add a default description for imports. --- chimere/forms.py | 2 + ...auto__add_field_importer_default_description.py | 246 +++++++++++++++++++++ chimere/models.py | 2 + chimere/static/chimere/js/importer_interface.js | 15 ++ chimere/tests.py | 9 +- chimere/utils.py | 5 +- 6 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 chimere/migrations/0044_auto__add_field_importer_default_description.py diff --git a/chimere/forms.py b/chimere/forms.py index 0d4bba6..774f510 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -119,6 +119,8 @@ class ImporterAdminForm(forms.ModelForm): filtr = forms.CharField(widget=ImportFiltrWidget, required=False) importer_type = forms.ChoiceField(widget=ImporterChoicesWidget, choices=[('', '--')]+list(IMPORTER_CHOICES)) + default_description = forms.CharField(widget=TextareaAdminWidget, + required=False) class Meta: model = Importer widgets = { diff --git a/chimere/migrations/0044_auto__add_field_importer_default_description.py b/chimere/migrations/0044_auto__add_field_importer_default_description.py new file mode 100644 index 0000000..ccabcd4 --- /dev/null +++ b/chimere/migrations/0044_auto__add_field_importer_default_description.py @@ -0,0 +1,246 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Importer.default_description' + db.add_column('chimere_importer', 'default_description', + self.gf('django.db.models.fields.TextField')(null=True, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Importer.default_description' + db.delete_column('chimere_importer', 'default_description') + + + models = { + 'chimere.area': { + 'Meta': {'ordering': "('order', 'name')", 'object_name': 'Area'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'default_subcategories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False', 'blank': 'True'}), + 'dynamic_categories': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'external_css': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layers': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'through': "orm['chimere.AreaLayers']", 'to': "orm['chimere.Layer']"}), + 'lower_right_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}), + 'restrict_to_extent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'areas'", 'blank': 'True', 'db_table': "'chimere_subcategory_areas'", 'to': "orm['chimere.SubCategory']"}), + 'upper_left_corner': ('django.contrib.gis.db.models.fields.PointField', [], {'default': "'POINT(0 0)'"}), + 'urn': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'blank': 'True'}), + 'welcome_message': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.arealayers': { + 'Meta': {'ordering': "('order',)", 'object_name': 'AreaLayers'}, + 'area': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Area']"}), + 'default': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Layer']"}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.category': { + 'Meta': {'ordering': "['order']", 'object_name': 'Category'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.color': { + 'Meta': {'ordering': "['order']", 'object_name': 'Color'}, + 'code': ('django.db.models.fields.CharField', [], {'max_length': '6'}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.colortheme': { + 'Meta': {'object_name': 'ColorTheme'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.icon': { + 'Meta': {'object_name': 'Icon'}, + 'height': ('django.db.models.fields.IntegerField', [], {}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'width': ('django.db.models.fields.IntegerField', [], {}) + }, + 'chimere.importer': { + 'Meta': {'object_name': 'Importer'}, + 'associate_marker_to_way': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'default_description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'default_name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'filtr': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'get_description': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'importer_type': ('django.db.models.fields.CharField', [], {'max_length': '4'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'overwrite': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'srid': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'state': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'zipped': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) + }, + 'chimere.layer': { + 'Meta': {'object_name': 'Layer'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'layer_code': ('django.db.models.fields.TextField', [], {'max_length': '300'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.marker': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Marker'}, + 'available_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'point': ('chimere.widgets.PointField', [], {}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_marker'", 'null': 'True', 'to': "orm['chimere.Marker']"}), + 'route': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'associated_marker'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.multimediaextension': { + 'Meta': {'object_name': 'MultimediaExtension'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'extensions'", 'to': "orm['chimere.MultimediaType']"}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '6'}) + }, + 'chimere.multimediafile': { + 'Meta': {'object_name': 'MultimediaFile'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'multimedia_files'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'multimedia_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.MultimediaType']", 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) + }, + 'chimere.multimediatype': { + 'Meta': {'object_name': 'MultimediaType'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'iframe': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'media_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'mime_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.news': { + 'Meta': {'object_name': 'News'}, + 'areas': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'to': "orm['chimere.Area']", 'null': 'True', 'blank': 'True'}), + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '150'}) + }, + 'chimere.picturefile': { + 'Meta': {'object_name': 'PictureFile'}, + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pictures'", 'to': "orm['chimere.Marker']"}), + 'miniature': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + 'thumbnailfile': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnailfile_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnailfile_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.property': { + 'Meta': {'object_name': 'Property'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'marker': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Marker']"}), + 'propertymodel': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.PropertyModel']"}), + 'value': ('django.db.models.fields.TextField', [], {}) + }, + 'chimere.propertymodel': { + 'Meta': {'ordering': "('order',)", 'object_name': 'PropertyModel'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'mandatory': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'subcategories': ('chimere.widgets.SelectMultipleField', [], {'symmetrical': 'False', 'related_name': "'properties'", 'blank': 'True', 'to': "orm['chimere.SubCategory']"}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'}) + }, + 'chimere.route': { + 'Meta': {'ordering': "('status', 'name')", 'object_name': 'Route'}, + 'associated_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.RouteFile']", 'null': 'True', 'blank': 'True'}), + 'categories': ('chimere.widgets.SelectMultipleField', [], {'to': "orm['chimere.SubCategory']", 'symmetrical': 'False'}), + 'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'has_associated_marker': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'import_key': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_source': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'import_version': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'license': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'modified_since_import': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'not_for_osm': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'origin': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'picture': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'ref_item': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submited_route'", 'null': 'True', 'to': "orm['chimere.Route']"}), + 'route': ('chimere.widgets.RouteField', [], {}), + 'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'status': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'submiter_comment': ('django.db.models.fields.TextField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'submiter_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'submiter_session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}) + }, + 'chimere.routefile': { + 'Meta': {'ordering': "('name',)", 'object_name': 'RouteFile'}, + 'file_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'raw_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'simplified_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}) + }, + 'chimere.subcategory': { + 'Meta': {'ordering': "['category', 'order']", 'object_name': 'SubCategory'}, + 'available': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subcategories'", 'to': "orm['chimere.Category']"}), + 'color_theme': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.ColorTheme']", 'null': 'True', 'blank': 'True'}), + 'icon': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['chimere.Icon']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'item_type': ('django.db.models.fields.CharField', [], {'max_length': '1'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '1000'}), + 'submission': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + }, + 'chimere.tinyurl': { + 'Meta': {'object_name': 'TinyUrl'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parameters': ('django.db.models.fields.CharField', [], {'max_length': '500'}) + } + } + + complete_apps = ['chimere'] \ No newline at end of file diff --git a/chimere/models.py b/chimere/models.py index a9b4a32..c3d4733 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -243,6 +243,8 @@ class Importer(models.Model): default=False) get_description = models.BooleanField(_(u"Get description from source"), default=False) + default_description = models.TextField(_(u"Default description"), + blank=True, null=True) origin = models.CharField(_(u"Origin"), max_length=100, blank=True, null=True) license = models.CharField(_(u"License"), max_length=100, diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 0b563b6..b14b986 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -52,9 +52,24 @@ django.jQuery(function($) { $('.input-osm').hide(); if($('#id_source').val() == default_xapi) $('#id_source').val(''); } + refresh_default_desc(); + } + function refresh_default_desc(){ + if (!$('.form-row.field-get_description').is(':visible')){ + $('.form-row.field-default_description').show(); + $('.form-row.field-get_description input').attr('checked', false); + } else { + if (!$('.form-row.field-get_description input').is(':checked')){ + $('.form-row.field-default_description').show(); + } else { + $('.form-row.field-default_description').hide(); + $('.form-row.field-default_description textarea').val(""); + } + } } refresh_importer_form(); $('.field-importer_type select').change(refresh_importer_form); + $('.field-get_description input').change(refresh_default_desc); function refresh_filtr_form(){ if (!$('#upper_left_lat').val() || !parseFloat($('#upper_left_lat').val())){ diff --git a/chimere/tests.py b/chimere/tests.py index 175a6b8..f256508 100644 --- a/chimere/tests.py +++ b/chimere/tests.py @@ -186,12 +186,19 @@ class KMLImporterTest(TestCase, ImporterTest): importer3.categories.add(subcategories[2]) importer4 = Importer.objects.create(importer_type='KML', - source=test_dir_path+'tests/sample.kml.zip', zipped=True) + source=test_dir_path+'tests/sample.kml.zip', zipped=True, + default_description="Ma description") importer4.categories.add(subcategories[3]) self.marker_importers = [(importer1, 1), (importer2, 3), (importer3, 0), (importer4, 4)] + def test_defaultdescription(self): + importer = self.marker_importers[-1][0] + importer.manager.get() + self.assertEqual(Marker.objects.order_by('-pk').all()[0].description, + importer.default_description) + class ShapefileImporterTest(TestCase, ImporterTest): def setUp(self): self.subcategories = subcategory_setup() diff --git a/chimere/utils.py b/chimere/utils.py index c4e882b..c7126f9 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012 Étienne Loks +# Copyright (C) 2012-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -76,6 +76,9 @@ class ImportManager(object): import_key = unicode(import_key).replace(':', '^') if not values.get('name'): values['name'] = self.default_name + if not self.importer_instance.get_description and \ + self.importer_instance.default_description: + values['description'] = self.importer_instance.default_description if not key: key = self.importer_instance.importer_type if import_key or pk: -- cgit v1.2.3 From 3ed4053789908b13829c28e981e026460b285d9c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 1 Feb 2013 11:15:38 +0100 Subject: Imports: prevent overload of descriptions. --- chimere/tests.py | 16 ++++++++++++++-- chimere/utils.py | 11 +++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/chimere/tests.py b/chimere/tests.py index f256508..54c1acd 100644 --- a/chimere/tests.py +++ b/chimere/tests.py @@ -187,17 +187,29 @@ class KMLImporterTest(TestCase, ImporterTest): importer4 = Importer.objects.create(importer_type='KML', source=test_dir_path+'tests/sample.kml.zip', zipped=True, - default_description="Ma description") + default_description="Default description") importer4.categories.add(subcategories[3]) self.marker_importers = [(importer1, 1), (importer2, 3), (importer3, 0), (importer4, 4)] def test_defaultdescription(self): + Marker.objects.all().delete() importer = self.marker_importers[-1][0] + importer.overwrite = True + importer.save() importer.manager.get() - self.assertEqual(Marker.objects.order_by('-pk').all()[0].description, + last_marker = Marker.objects.order_by('-pk').all()[0] + self.assertEqual(last_marker.description, importer.default_description) + # don't overwrite description on update + new_desc = u"Description set by an user" + last_marker.description = new_desc + last_marker.save() + importer.manager.get() + last_marker = Marker.objects.order_by('-pk').all()[0] + self.assertEqual(last_marker.description, + new_desc) class ShapefileImporterTest(TestCase, ImporterTest): def setUp(self): diff --git a/chimere/utils.py b/chimere/utils.py index c7126f9..d1ea851 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -76,11 +76,9 @@ class ImportManager(object): import_key = unicode(import_key).replace(':', '^') if not values.get('name'): values['name'] = self.default_name - if not self.importer_instance.get_description and \ - self.importer_instance.default_description: - values['description'] = self.importer_instance.default_description if not key: key = self.importer_instance.importer_type + item = None if import_key or pk: dct_import = { 'import_key__icontains':'%s:%s;' % (key, import_key), @@ -102,7 +100,8 @@ class ImportManager(object): else: item = ref_item for k in values: - setattr(item, k, values[k]) + if values[k]: + setattr(item, k, values[k]) try: item.save() # force the modified_since_import status @@ -115,6 +114,10 @@ class ImportManager(object): except ObjectDoesNotExist: pass if not item: + if not self.importer_instance.get_description and \ + self.importer_instance.default_description: + values['description'] = \ + self.importer_instance.default_description values.update({ 'import_source':self.importer_instance.source}) values['status'] = 'I' -- cgit v1.2.3 From eeeba57a961bfc8571c5e1df7de88be3b37c9ee3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 1 Feb 2013 12:12:33 +0100 Subject: Upgrade documentation --- docs/en/configuration.rst | 11 +---------- docs/en/import_export.rst | 7 ++++++- docs/en/install.rst | 11 ++++++++++- docs/en/upgrade.rst | 23 +++++++++++++++++++++-- docs/fr/configuration.rst | 13 +------------ docs/fr/import_export.rst | 8 +++++++- docs/fr/install.rst | 14 +++++++++++++- docs/fr/upgrade.rst | 24 ++++++++++++++++++++++-- 8 files changed, 81 insertions(+), 30 deletions(-) diff --git a/docs/en/configuration.rst b/docs/en/configuration.rst index e5870bb..2a7f4d0 100644 --- a/docs/en/configuration.rst +++ b/docs/en/configuration.rst @@ -5,7 +5,7 @@ Configuration ============= :Author: Étienne Loks -:date: 2012-10-08 +:date: 2013-02-01 :Copyright: CC-BY 3.0 This document presents the first steps to configure your Chimère. @@ -32,15 +32,6 @@ To access these pages you have to identify with an account with *staff* and A *superuser* account is created at the initialization of the database. -Configuring the Sites framework -------------------------------- - -*Sites* framework allow you to serve the same content on different domains. -Most of you will probably use only one domain but this unique domain has to -be configured. This is done in the web administration interface in *Sites > Sites*. -You only need to change *example.com* by your domain name. If you forget to -do that, some functionalities such as RSS feeds will not work properly. - .. _managing-areas: Managing areas diff --git a/docs/en/import_export.rst b/docs/en/import_export.rst index 6dd1d7a..9144938 100644 --- a/docs/en/import_export.rst +++ b/docs/en/import_export.rst @@ -5,7 +5,7 @@ Import/export ============= :Author: Étienne Loks -:date: 2012-11-28 +:date: 2013-02-01 :Copyright: CC-BY 3.0 This document presents the import/export functionnalities of Chimère. @@ -49,6 +49,11 @@ Common fields be reconciled with the :ref:`amendment form `. If you don't want to use this form and then overwrite with the data from the external source, check this option. +- **Get description from source**: If this case is checked, the importer will + try to get the description from the source file. This option is only available + for certain file formats. +- **Default description**: A default description to be added to new items. This + field is only available when **Get description from source** is not checked. - **Origin**: if not null this field will be associated to each item imported in order to easily identify where the item came from. For OSM import the source is automatically added. diff --git a/docs/en/install.rst b/docs/en/install.rst index 7ba376b..ff8ac46 100644 --- a/docs/en/install.rst +++ b/docs/en/install.rst @@ -5,7 +5,7 @@ Installation ============ :Author: Étienne Loks -:date: 2012-11-28 +:date: 2013-02-01 :Copyright: CC-BY 3.0 This document presents the installation of Chimère. @@ -292,3 +292,12 @@ line:: . /etc/default/locale +Configuring the Sites framework +******************************* + +*Sites* framework allow you to serve the same content on different domains. +Most of you will probably use only one domain but this unique domain has to +be configured. This is done in the web administration interface in *Sites > Sites*. +You only need to change *example.com* by your domain name. If you forget to +do that, some functionalities such as RSS feeds will not work properly. + diff --git a/docs/en/upgrade.rst b/docs/en/upgrade.rst index ef9d0d1..6dce286 100644 --- a/docs/en/upgrade.rst +++ b/docs/en/upgrade.rst @@ -5,7 +5,7 @@ Upgrade ======= :Author: Étienne Loks -:date: 2012-10-08 +:date: 2013-02-01 :Copyright: CC-BY 3.0 This document presents the upgrade of Chimère. @@ -198,6 +198,12 @@ Move old static files to the new static directory: rm -rf $CHIMERE_PATH/chimere/static/icons rm -rf $CHIMERE_PATH/chimere/static/upload +Update permissions for media directory: + +.. code-block:: bash + + chown www-data -R $CHIMERE_APP_PATH/media/ + Webserver configuration ....................... @@ -295,6 +301,7 @@ Version 1.2 -> 2.0 -> master cd $CHIMERE_PATH/chimere django-admin compilemessages + Forcing the refresh of visitor's web browser cache -------------------------------------------------- @@ -307,8 +314,20 @@ that edit your local_settings.py and change:: to:: - STATIC_URL = '/static/v2.0.0/' + STATIC_URL = '/static-v2.0.0/' Then change the webserver directive to point to your new path. Restart the web server to apply this changes. +Configuring the Sites framework +------------------------------- + +Version 1.2 -> 2.0 +****************** + +*Sites* framework allow you to serve the same content on different domains. +Most of you will probably use only one domain but this unique domain has to +be configured. This is done in the web administration interface in *Sites > Sites*. +You only need to change *example.com* by your domain name. If you forget to +do that, some functionalities such as RSS feeds will not work properly. + diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index f419a0d..1ea8f50 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -5,7 +5,7 @@ Configuration ============= :Auteur: Étienne Loks -:date: 2012-11-29 +:date: 2013-02-01 :Copyright: CC-BY 3.0 Ce document présente l'installation de Chimère. @@ -33,17 +33,6 @@ pour état *équipe* ou *super-utilisateur*. Un compte *super-utilisateur* est créé à l'initialisation de la base de données. -Configurer le framework Sites ------------------------------ - -Le framework *Sites* vous permet de servir le contenu pour différents domaines -Internet. La plupart des installations serviront le contenu pour un seul domaine -mais ce domaine unique doit être configuré. - -Pour cela allez dans les pages web d'administration *Sites > Sites*. -Vous avez juste à changer *example.com* par votre nom de domaine. Si vous -oubliez de faire cela, quelques fonctionnalités comme les flux RSS ne -fonctionneront pas correctement. .. _managing-areas: diff --git a/docs/fr/import_export.rst b/docs/fr/import_export.rst index beca4e7..4da40dd 100644 --- a/docs/fr/import_export.rst +++ b/docs/fr/import_export.rst @@ -5,7 +5,7 @@ Import/export ============= :Author: Étienne Loks -:date: 2012-11-28 +:date: 2013-02-01 :Copyright: CC-BY 3.0 Ce document présente les fonctions d'import et d'export de Chimère. @@ -51,6 +51,12 @@ Champs communs à tous les types de source gestion des modifications `. Si vous ne souhaitez pas avoir à faire ce rapprochement et alors écraser les données existantes avec les données de la source externe, cochez cette option. +- **Obtenir la description depuis la source** : si cette case est cochée, + l'importeur va essayer d'obtenir une description depuis le fichier source. + Cette option n'est valable que pour certains formats. +- **Description par défaut** : Une description par défaut à ajouter aux nouveaux + éléments. Ce champ n'est disponible que lorsque **Obtenir la description + depuis la source** n'est pas coché. - **Origine** : si non nul, ce champ va être associé à chaque élément importé afin d'identifier facilement d'où l'élément provient. Pour les imports OSM la source est ajoutée automatiquement. diff --git a/docs/fr/install.rst b/docs/fr/install.rst index da6dd05..9a33e7c 100644 --- a/docs/fr/install.rst +++ b/docs/fr/install.rst @@ -5,7 +5,7 @@ Installation ============ :Auteur: Étienne Loks -:date: 2012-11-28 +:date: 2013-02-01 :Copyright: CC-BY 3.0 Ce document présente l'installation de Chimère. @@ -302,3 +302,15 @@ décommentez la ligne suivante : :: . /etc/default/locale +Configurer le framework Sites +***************************** + +Le framework *Sites* vous permet de servir le contenu pour différents domaines +Internet. La plupart des installations serviront le contenu pour un seul domaine +mais ce domaine unique doit être configuré. + +Pour cela allez dans les pages web d'administration *Sites > Sites*. +Vous avez juste à changer *example.com* par votre nom de domaine. Si vous +oubliez de faire cela, quelques fonctionnalités comme les flux RSS ne +fonctionneront pas correctement. + diff --git a/docs/fr/upgrade.rst b/docs/fr/upgrade.rst index b43ccd3..32d37b8 100644 --- a/docs/fr/upgrade.rst +++ b/docs/fr/upgrade.rst @@ -5,7 +5,7 @@ Mise à jour =========== :Auteur: Étienne Loks -:date: 2012-11-29 +:date: 2013-02-01 :Copyright: CC-BY 3.0 Ce document présente la mise à jour de Chimère. @@ -210,6 +210,11 @@ Déplacez vos anciens fichiers statiques vers le nouveau répertoire : rm -rf $CHIMERE_PATH/chimere/static/icons rm -rf $CHIMERE_PATH/chimere/static/upload +Mettre à jour les permissions des répertoires media : + +.. code-block:: bash + + chown www-data -R $CHIMERE_APP_PATH/media/ Configuration du serveur Web ............................ @@ -329,9 +334,24 @@ changez : :: en : :: - STATIC_URL = '/static/v2.0.0/' + STATIC_URL = '/static-v2.0.0/' Changez la directive concernant les fichiers statiques sur le fichier de configuration de votre serveur web. Redémarrez alors le serveur web pour appliquer les changements. +Configurer le framework Sites +----------------------------- + +Version 1.2 -> 2.0 +****************** + +Le framework *Sites* vous permet de servir le contenu pour différents domaines +Internet. La plupart des installations serviront le contenu pour un seul domaine +mais ce domaine unique doit être configuré. + +Pour cela allez dans les pages web d'administration *Sites > Sites*. +Vous avez juste à changer *example.com* par votre nom de domaine. Si vous +oubliez de faire cela, quelques fonctionnalités comme les flux RSS ne +fonctionneront pas correctement. + -- cgit v1.2.3 From ae84c6703fa9bf1b937b23dde15df3bd7e63aef4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 1 Feb 2013 12:50:47 +0100 Subject: Improve template when no default area is defined --- chimere/templates/chimere/blocks/areas.html | 1 + chimere/views.py | 1 + 2 files changed, 2 insertions(+) diff --git a/chimere/templates/chimere/blocks/areas.html b/chimere/templates/chimere/blocks/areas.html index 8c4b981..a1ebe76 100644 --- a/chimere/templates/chimere/blocks/areas.html +++ b/chimere/templates/chimere/blocks/areas.html @@ -3,6 +3,7 @@

', { + 'class': o.selectClass, + name: o.selectClass + this.uid, + id: o.selectClass + this.uid, + change: $.proxy(this.selectChangeEvent, this), + click: $.proxy(this.selectClickEvent, this) + }); + + this.$list = $.isFunction(o.listType) + ? o.listType(this.$original) + : $('<' + o.listType + '>', { id: o.listClass + this.uid }); + + this.$list.addClass(o.listClass); + + this.$container = $('
', { 'class': o.containerClass, id: this.uid }); + + this.buildSelect(); + + this.$original.change($.proxy(this.originalChangeEvent, this)).wrap(this.$container).before(this.$select); + + // if the list isn't already in the document, add it (it might be inserted by a custom callback) + if (!this.$list.parent().length) { this.$original.before(this.$list); } + + if (this.$original.attr('id')) { + $('label[for=' + this.$original.attr('id') + ']').attr('for', this.$select.attr('id')); + } + + // set up remove event (may be a link, or the list item itself) + this.$list.delegate('.' + o.removeClass, 'click', function() { + self.dropListItem($(this).closest('li')); + return false; + }); + + $.each(o.plugins, function() { this.init(self); }); + }, + + /** + * Triggered when an item has been selected + * Check to make sure it's not an IE screwup, and add it to the list + */ + selectChangeEvent: function() { + if ($.browser.msie && $.browser.version < 7 && !this.ieClick) { return; } + var bsmOpt = $('option:selected:eq(0)', this.$select); + if (bsmOpt.data('orig-option')) { + this.addListItem(bsmOpt); + this.triggerOriginalChange(bsmOpt.data('orig-option'), 'add'); + } + this.ieClick = false; + }, + + /** + * IE6 lets you scroll around in a select without it being pulled down + * making sure a click preceded the change() event reduces the chance + * if unintended items being added. there may be a better solution? + */ + selectClickEvent: function() { + this.ieClick = true; + }, + + /** + * Rebuild bsmSelect when the 'change' event is triggered on the original select + */ + originalChangeEvent: function() { + if (this.ignoreOriginalChangeEvent) { + // We don't want to rebuild everything when an item is added / droped + this.ignoreOriginalChangeEvent = false; + } else { + this.buildSelect(); + // opera has an issue where it needs a force redraw, otherwise + // the items won't appear until something else forces a redraw + if ($.browser.opera) { this.$list.hide().show(); } + } + }, + + /** + * Build the DOM for the new select + */ + buildSelect: function() { + var self = this; + + this.buildingSelect = true; + + // add a first option to be the home option / default selectLabel + this.$select.empty().prepend($('').text(this.$original.attr('title') || this.options.title)); + this.$list.empty(); + + this.$original.children().each(function() { + if ($(this).is('option')) { + self.addSelectOption(self.$select, $(this)); + } else if ($(this).is('optgroup')) { + self.addSelectOptionGroup(self.$select, $(this)); + } + }); + + if (!this.options.debugMode) { this.$original.hide(); } + this.selectFirstItem(); + this.buildingSelect = false; + }, + + /** + * Append an option to the new select + * + * @param {jQuery} $parent Where to append the option + * @param {jQuery} $origOpt Option from the original select + */ + addSelectOption: function ($parent, $origOpt) { + var $bsmOpt = $('', { label: $group.attr('label')} ).appendTo($parent); + if ($group.is(':disabled')) { $G.attr('disabled', 'disabled'); } + $('option', $group).each(function() { self.addSelectOption($G, $(this)); }); + }, + + /** + * Select the first item of the new select + */ + selectFirstItem: function() { + $('option:eq(0)', this.$select).attr('selected', 'selected'); + }, + + /** + * Make an option disabled, indicating that it's already been selected + * because safari is the only browser that makes disabled items look 'disabled' + * we apply a class that reproduces the disabled look in other browsers + * + * @param {jQuery} $bsmOpt Option from the new select + */ + disableSelectOption: function($bsmOpt) { + $bsmOpt.addClass(this.options.optionDisabledClass) + .removeAttr('selected') + .attr('disabled', 'disabled') + .toggle(!this.options.hideWhenAdded); + if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display + }, + + /** + * Enable a select option + * + * @param {jQuery} $bsmOpt Option from the new select + */ + enableSelectOption: function($bsmOpt) { + $bsmOpt.removeClass(this.options.optionDisabledClass) + .removeAttr('disabled') + .toggle(!this.options.hideWhenAdded); + if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display + }, + + /** + * Append an item corresponding to the option to the list + * + * @param {jQuery} $bsmOpt Option from the new select + */ + addListItem: function($bsmOpt) { + var $item, + $origOpt = $bsmOpt.data('orig-option'), + o = this.options; + + if (!$origOpt) { return; } // this is the first item, selectLabel + + if (!this.buildingSelect) { + if ($origOpt.is(':selected')) { return; } // already have it + $origOpt.attr('selected', 'selected'); + } + + $item = $('
  • ', { 'class': o.listItemClass }) + .append($('', { 'class': o.listItemLabelClass, html: o.extractLabel($bsmOpt, o)})) + .append($('', { href: '#', 'class': o.removeClass, html: o.removeLabel })) + .data('bsm-option', $bsmOpt); + + this.disableSelectOption($bsmOpt.data('item', $item)); + + switch (o.addItemTarget) { + case 'bottom': + this.$list.append($item.hide()); + break; + case 'original': + var order = $origOpt.data('bsm-order'), inserted = false; + $('.' + o.listItemClass, this.$list).each(function() { + if (order < $(this).data('bsm-option').data('orig-option').data('bsm-order')) { + $item.hide().insertBefore(this); + inserted = true; + return false; + } + }); + if (!inserted) { this.$list.append($item.hide()); } + break; + default: + this.$list.prepend($item.hide()); + } + + if (this.buildingSelect) { + $.bsmSelect.effects.show($item); + } else { + o.showEffect($item); + o.highlightEffect(this.$select, $item, o.highlightAddedLabel, this.options); + this.selectFirstItem(); + } + }, + + /** + * Remove an item from the list of selection + * + * @param {jQuey} $item A list item + */ + dropListItem: function($item) { + var $bsmOpt = $item.data('bsm-option'), o = this.options; + $bsmOpt.removeData('item').data('orig-option').removeAttr('selected'); + (this.buildingSelect ? $.bsmSelect.effects.remove : o.hideEffect)($item); + this.enableSelectOption($bsmOpt); + o.highlightEffect(this.$select, $item, o.highlightRemovedLabel, o); + this.triggerOriginalChange($bsmOpt.data('orig-option'), 'drop'); + }, + + /** + * Trigger a change event on the original select multiple + * so that other scripts can pick them up + * + * @param {jQuery} $origOpt The option from the original select + * @param {String} type Event type + */ + triggerOriginalChange: function($origOpt, type) { + this.ignoreOriginalChangeEvent = true; + this.$original.trigger('change', [{ + option: $origOpt, + value: $origOpt.val(), + item: $origOpt.data('bsm-option').data('item'), + type: type + }]); + } + }; + + $.fn.bsmSelect = function(customOptions) { + var options = $.extend({}, $.bsmSelect.conf, customOptions); + return this.each(function() { + var bsm = $(this).data("bsmSelect"); + if (!bsm) { + bsm = new BsmSelect($(this), options); + $(this).data("bsmSelect", bsm); + } + }); + }; + + $.bsmSelect = {}; + $.extend($.bsmSelect, { + effects: { + show: function($el) { $el.show(); }, + + remove: function($el) { $el.remove(); }, + + highlight: function ($select, $item, label, conf) { + var $highlight, + id = $select.attr('id') + conf.highlightClass; + $('#' + id).remove(); + $highlight = $('', { + 'class': conf.highlightClass, + id: id, + html: label + $item.children('.' + conf.listItemLabelClass).first().text() + }).hide(); + $select.after($highlight.fadeIn('fast').delay(50).fadeOut('slow', function() { $(this).remove(); })); + }, + + verticalListAdd: function ($el) { + $el.animate({ opacity: 'show', height: 'show' }, 100, function() { + $(this).animate({ height: '+=2px' }, 100, function() { + $(this).animate({ height: '-=2px' }, 100); + }); + }); + }, + + verticalListRemove: function($el) { + $el.animate({ opacity: 'hide', height: 'hide' }, 100, function() { + $(this).prev('li').animate({ height: '-=2px' }, 100, function() { + $(this).animate({ height: '+=2px' }, 100); + }); + $(this).remove(); + }); + } + }, + plugins: { + } + }); + + // Default configuration + $.bsmSelect.conf = { + listType: 'ol', // Ordered list 'ol', or unordered list 'ul' + + showEffect: $.bsmSelect.effects.show, + hideEffect: $.bsmSelect.effects.remove, + highlightEffect: $.noop, + + addItemTarget: 'bottom', // Where to place new selected items in list: top or bottom + hideWhenAdded: false, // Hide the option when added to the list? works only in FF + debugMode: false, // Debug mode keeps original select visible + + title: 'Select...', // Text used for the default select label + removeLabel: 'remove', // HTML used for the 'remove' link + highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item + highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item + extractLabel: function($o) { return $o.html(); }, + + plugins: [], // An array of plugin objects to enable + + containerClass: 'bsmContainer', // Class for container that wraps this widget + selectClass: 'bsmSelect', // Class for the newly created ', { - 'class': o.selectClass, - name: o.selectClass + this.uid, - id: o.selectClass + this.uid, - change: $.proxy(this.selectChangeEvent, this), - click: $.proxy(this.selectClickEvent, this) - }); - - this.$list = $.isFunction(o.listType) - ? o.listType(this.$original) - : $('<' + o.listType + '>', { id: o.listClass + this.uid }); - - this.$list.addClass(o.listClass); - - this.$container = $('
    ', { 'class': o.containerClass, id: this.uid }); - - this.buildSelect(); - - this.$original.change($.proxy(this.originalChangeEvent, this)).wrap(this.$container).before(this.$select); - - // if the list isn't already in the document, add it (it might be inserted by a custom callback) - if (!this.$list.parent().length) { this.$original.before(this.$list); } - - if (this.$original.attr('id')) { - $('label[for=' + this.$original.attr('id') + ']').attr('for', this.$select.attr('id')); - } - - // set up remove event (may be a link, or the list item itself) - this.$list.delegate('.' + o.removeClass, 'click', function() { - self.dropListItem($(this).closest('li')); - return false; - }); - - $.each(o.plugins, function() { this.init(self); }); - }, - - /** - * Triggered when an item has been selected - * Check to make sure it's not an IE screwup, and add it to the list - */ - selectChangeEvent: function() { - if ($.browser.msie && $.browser.version < 7 && !this.ieClick) { return; } - var bsmOpt = $('option:selected:eq(0)', this.$select); - if (bsmOpt.data('orig-option')) { - this.addListItem(bsmOpt); - this.triggerOriginalChange(bsmOpt.data('orig-option'), 'add'); - } - this.ieClick = false; - }, - - /** - * IE6 lets you scroll around in a select without it being pulled down - * making sure a click preceded the change() event reduces the chance - * if unintended items being added. there may be a better solution? - */ - selectClickEvent: function() { - this.ieClick = true; - }, - - /** - * Rebuild bsmSelect when the 'change' event is triggered on the original select - */ - originalChangeEvent: function() { - if (this.ignoreOriginalChangeEvent) { - // We don't want to rebuild everything when an item is added / droped - this.ignoreOriginalChangeEvent = false; - } else { - this.buildSelect(); - // opera has an issue where it needs a force redraw, otherwise - // the items won't appear until something else forces a redraw - if ($.browser.opera) { this.$list.hide().show(); } - } - }, - - /** - * Build the DOM for the new select - */ - buildSelect: function() { - var self = this; - - this.buildingSelect = true; - - // add a first option to be the home option / default selectLabel - this.$select.empty().prepend($('').text(this.$original.attr('title') || this.options.title)); - this.$list.empty(); - - this.$original.children().each(function() { - if ($(this).is('option')) { - self.addSelectOption(self.$select, $(this)); - } else if ($(this).is('optgroup')) { - self.addSelectOptionGroup(self.$select, $(this)); - } - }); - - if (!this.options.debugMode) { this.$original.hide(); } - this.selectFirstItem(); - this.buildingSelect = false; - }, - - /** - * Append an option to the new select - * - * @param {jQuery} $parent Where to append the option - * @param {jQuery} $origOpt Option from the original select - */ - addSelectOption: function ($parent, $origOpt) { - var $bsmOpt = $('', { label: $group.attr('label')} ).appendTo($parent); - if ($group.is(':disabled')) { $G.attr('disabled', 'disabled'); } - $('option', $group).each(function() { self.addSelectOption($G, $(this)); }); - }, - - /** - * Select the first item of the new select - */ - selectFirstItem: function() { - $('option:eq(0)', this.$select).attr('selected', 'selected'); - }, - - /** - * Make an option disabled, indicating that it's already been selected - * because safari is the only browser that makes disabled items look 'disabled' - * we apply a class that reproduces the disabled look in other browsers - * - * @param {jQuery} $bsmOpt Option from the new select - */ - disableSelectOption: function($bsmOpt) { - $bsmOpt.addClass(this.options.optionDisabledClass) - .removeAttr('selected') - .attr('disabled', 'disabled') - .toggle(!this.options.hideWhenAdded); - if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display - }, - - /** - * Enable a select option - * - * @param {jQuery} $bsmOpt Option from the new select - */ - enableSelectOption: function($bsmOpt) { - $bsmOpt.removeClass(this.options.optionDisabledClass) - .removeAttr('disabled') - .toggle(!this.options.hideWhenAdded); - if ($.browser.msie && $.browser.version < 8) { this.$select.hide().show(); } // this forces IE to update display - }, - - /** - * Append an item corresponding to the option to the list - * - * @param {jQuery} $bsmOpt Option from the new select - */ - addListItem: function($bsmOpt) { - var $item, - $origOpt = $bsmOpt.data('orig-option'), - o = this.options; - - if (!$origOpt) { return; } // this is the first item, selectLabel - - if (!this.buildingSelect) { - if ($origOpt.is(':selected')) { return; } // already have it - $origOpt.attr('selected', 'selected'); - } - - $item = $('
  • ', { 'class': o.listItemClass }) - .append($('', { 'class': o.listItemLabelClass, html: o.extractLabel($bsmOpt, o)})) - .append($('', { href: '#', 'class': o.removeClass, html: o.removeLabel })) - .data('bsm-option', $bsmOpt); - - this.disableSelectOption($bsmOpt.data('item', $item)); - - switch (o.addItemTarget) { - case 'bottom': - this.$list.append($item.hide()); - break; - case 'original': - var order = $origOpt.data('bsm-order'), inserted = false; - $('.' + o.listItemClass, this.$list).each(function() { - if (order < $(this).data('bsm-option').data('orig-option').data('bsm-order')) { - $item.hide().insertBefore(this); - inserted = true; - return false; - } - }); - if (!inserted) { this.$list.append($item.hide()); } - break; - default: - this.$list.prepend($item.hide()); - } - - if (this.buildingSelect) { - $.bsmSelect.effects.show($item); - } else { - o.showEffect($item); - o.highlightEffect(this.$select, $item, o.highlightAddedLabel, this.options); - this.selectFirstItem(); - } - }, - - /** - * Remove an item from the list of selection - * - * @param {jQuey} $item A list item - */ - dropListItem: function($item) { - var $bsmOpt = $item.data('bsm-option'), o = this.options; - $bsmOpt.removeData('item').data('orig-option').removeAttr('selected'); - (this.buildingSelect ? $.bsmSelect.effects.remove : o.hideEffect)($item); - this.enableSelectOption($bsmOpt); - o.highlightEffect(this.$select, $item, o.highlightRemovedLabel, o); - this.triggerOriginalChange($bsmOpt.data('orig-option'), 'drop'); - }, - - /** - * Trigger a change event on the original select multiple - * so that other scripts can pick them up - * - * @param {jQuery} $origOpt The option from the original select - * @param {String} type Event type - */ - triggerOriginalChange: function($origOpt, type) { - this.ignoreOriginalChangeEvent = true; - this.$original.trigger('change', [{ - option: $origOpt, - value: $origOpt.val(), - item: $origOpt.data('bsm-option').data('item'), - type: type - }]); - } - }; - - $.fn.bsmSelect = function(customOptions) { - var options = $.extend({}, $.bsmSelect.conf, customOptions); - return this.each(function() { - var bsm = $(this).data("bsmSelect"); - if (!bsm) { - bsm = new BsmSelect($(this), options); - $(this).data("bsmSelect", bsm); - } - }); - }; - - $.bsmSelect = {}; - $.extend($.bsmSelect, { - effects: { - show: function($el) { $el.show(); }, - - remove: function($el) { $el.remove(); }, - - highlight: function ($select, $item, label, conf) { - var $highlight, - id = $select.attr('id') + conf.highlightClass; - $('#' + id).remove(); - $highlight = $('', { - 'class': conf.highlightClass, - id: id, - html: label + $item.children('.' + conf.listItemLabelClass).first().text() - }).hide(); - $select.after($highlight.fadeIn('fast').delay(50).fadeOut('slow', function() { $(this).remove(); })); - }, - - verticalListAdd: function ($el) { - $el.animate({ opacity: 'show', height: 'show' }, 100, function() { - $(this).animate({ height: '+=2px' }, 100, function() { - $(this).animate({ height: '-=2px' }, 100); - }); - }); - }, - - verticalListRemove: function($el) { - $el.animate({ opacity: 'hide', height: 'hide' }, 100, function() { - $(this).prev('li').animate({ height: '-=2px' }, 100, function() { - $(this).animate({ height: '+=2px' }, 100); - }); - $(this).remove(); - }); - } - }, - plugins: { - } - }); - - // Default configuration - $.bsmSelect.conf = { - listType: 'ol', // Ordered list 'ol', or unordered list 'ul' - - showEffect: $.bsmSelect.effects.show, - hideEffect: $.bsmSelect.effects.remove, - highlightEffect: $.noop, - - addItemTarget: 'bottom', // Where to place new selected items in list: top or bottom - hideWhenAdded: false, // Hide the option when added to the list? works only in FF - debugMode: false, // Debug mode keeps original select visible - - title: 'Select...', // Text used for the default select label - removeLabel: 'remove', // HTML used for the 'remove' link - highlightAddedLabel: 'Added: ', // Text that precedes highlight of added item - highlightRemovedLabel: 'Removed: ', // Text that precedes highlight of removed item - extractLabel: function($o) { return $o.html(); }, - - plugins: [], // An array of plugin objects to enable - - containerClass: 'bsmContainer', // Class for container that wraps this widget - selectClass: 'bsmSelect', // Class for the newly created + ... + + +## Requirements ## + +* jQuery 1.4+ (you might need a newer version for IE9 compatibility) + +## Options ## + +### Primary Options ### + +* listType: + + * Specify what list will be created or used as part of the bsmSelect. + * Can accept a callback that accepts the original . + * Default: 'bsmSelect' + +* listClass: + + * Class for the newly created list of listType (ol or ul). + * Default: 'bsmList' + +* listSortableClass: + + * Another class given to the list when sortable is active. + * Default: 'bsmListSortable' + +* listItemClass: + + * Class given to the
  • list items. + * Default: 'bsmListItem' + +* listItemLabelClass: + + * Class for the label text that appears in list items. + * Default: 'bsmListItemLabel' + +* removeClass: + + * Class given to the remove link in each list item. + * Any element found in the
  • with this class will remove it. + * If you give the
  • this class, clicking anywhere on the
  • will remove it. + * Default: 'bsmListItemRemove' + +* highlightClass: + + * Class given to the highlight . + * Default: 'bsmHighlight' + +## Authors and contributors ## + + * [Ryan Cramer](http://www.ryancramer.com/) is the author of the original asmSelect + * [Victor Berchet](http://github.com/vicb) is the author of bsmSelect + * [Andy Fowler](http://github.com/andyfowler) has contributed many enhancements + * [Cracky](https://github.com/Cracky) + * [Marc Busqué](https://github.com/laMarciana) has contributed to fix [issue #21](https://github.com/vicb/bsmSelect/issues/21) and with minimal CSS + +## History ## + +see [history.md](history.md). + +## Related Projects ## + + * [Chosen](https://github.com/harvesthq/chosen/) + diff --git a/chimere/static/jme/GPL-LICENSE-2.txt b/chimere/static/jme/GPL-LICENSE-2.txt new file mode 100644 index 0000000..3c993fd --- /dev/null +++ b/chimere/static/jme/GPL-LICENSE-2.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file diff --git a/chimere/static/jme/MIT-LICENSE.txt b/chimere/static/jme/MIT-LICENSE.txt new file mode 100644 index 0000000..e197885 --- /dev/null +++ b/chimere/static/jme/MIT-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2010 Alexander Farkas, http://protofunc.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/chimere/static/prettyPhoto/README b/chimere/static/prettyPhoto/README new file mode 100755 index 0000000..1e56842 --- /dev/null +++ b/chimere/static/prettyPhoto/README @@ -0,0 +1,30 @@ +prettyPhoto v3.1.4 +© Copyright, Stephane Caron +http://www.no-margin-for-errors.com + + +============================= Released under ============================= + +Creative Commons 2.5 +http://creativecommons.org/licenses/by/2.5/ + +OR + +GPLV2 license +http://www.gnu.org/licenses/gpl-2.0.html + +You are free to use prettyPhoto in commercial projects as long as the +copyright header is left intact. + +============================ More information ============================ +http://www.no-margin-for-errors.com/projects/prettyPhoto/ + + +============================== Description =============================== + +prettyPhoto is a jQuery based lightbox clone. Not only does it support images, +it also add support for videos, flash, YouTube, iFrame. It's a full blown +media modal box. + +Please refer to http://www.no-margin-for-errors.com/projects/prettyPhoto/ +for all the details on how to use. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..5e26b37 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +python-django-chimere (2.0.0) unstable; urgency=low + + * Initial release (Closes: #699579) + + -- Étienne Loks Sat, 02 Feb 2013 00:51:40 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control index 1d89b61..2dc9e52 100644 --- a/debian/control +++ b/debian/control @@ -1,10 +1,63 @@ +Source: python-django-chimere +Section: python +Priority: optional +Maintainer: Étienne Loks +Build-Depends: debhelper (>= 8.0.0) +Standards-Version: 3.9.3 +Homepage: http://pypi.python.org/pypi/chimere +#Vcs-Git: git://git.debian.org/collab-maint/python-django-chimere.git +#Vcs-Browser: http://git.debian.org/?p=collab-maint/python-django-chimere.git;a=summary + Package: python-django-chimere -Version: 2.0 -Depends: python-django (>=1.4), python-gdal, python-psycopg2, - python-beautifulsoup, python-imaging, libjs-jquery, - libjs-jquery-ui, libjs-jquery-ui-theme-base, - postgresql-9.1, postgresql-9.1-postgis, gettext, - python-simplejson, gpsbabel, python-django-south, - python-pyexiv2 python-feedparser javascript-common -Recommends: tinymce, python-django-celery, python-kombu -Suggests: libjs-jquery-ui-theme-south-street +Architecture: all +Depends: ${misc:Depends}, + ${python:Depends}, + python-django (>= 1.4), + python-django (<< 1.5), + python-gdal, + python-psycopg2, + python-beautifulsoup, + python-imaging, + python-simplejson, + python-django-south, + python-pyexiv2, + python-feedparser +Recommends: javascript-common, + libjs-jquery, + libjs-jquery-ui, + libjs-jquery-ui-theme-base, + gpsbabel, + tinymce +Description: collaborative and thematic maps application for Django + Chimère is a cartographic mashup using OpenStreetMap as a default map + layer. This software aims to create online collaborative and thematic + maps. Content (multimedia, text) are associated to basic geographic + items (Point Of Interest, routes). Adds on the map are open to everybody + with no authentification but are moderated by a team in charge of the + map. + . + Main features: + * Display (by default) of the mapnik OpenStreetMap layer. + * Display on the map of POIs (with markers) and routes (with colored + polylines). + * Thematic choices of items to display (POIs and routes). + * Filter themes in regard to currently available items. + * Display of the detail of a POI (name, description, pictures, multimedia + files). + * Management of multimedia files and images associated to POIs. + * Add of a cartographic item (POI, route) on the map by an user without + authentication (the item is only available after moderation). + * Admin interface for moderation and configuration. + * Cut a Chimère by "areas". Each "area" can have specific themes, a new + default center, etc. + * Configuration of map layers in administration interface. + * Import and export of data from/to various formats: ShapeFile, KML, GeoRSS + (import only), CSV and OpenStreetMap. + +Package: python-django-chimere-docs +Architecture: all +Section: doc +Depends: ${sphinxdoc:Depends}, ${misc:Depends} +Description: python-django-chimere documentation + This package documents the use and customization of the collaborative and + thematic maps application for Django Chimère. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f5939a4 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,113 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: chimere +Source: http://pypi.python.org/pypi/chimere + +Files: * +Copyright: 2013 Étienne Loks +License: GPL-3.0+ + +Files: debian/* +Copyright: 2013 Étienne Loks +License: GPL-3.0+ + +Files: chimere/external_utils/OsmApi.py +Copyright: 2009-2010 Étienne Chové +License: GPL-3.0+ + +Files: chimere/jme/* +Copyright: 2010 Alexander Farkas +License: MIT or GPL-2 + +Files: chimere/bsmSelect/* +Copyright: 2008 Ryan Cramer +Copyright: 2010 Victor Berchet +License: MIT or GPL-2 + +Files: chimere/prettyPhoto/* +Copyright: 2012 Stephane Caron +License: GPL-2 + +Files: chimere/openlayers/* +Copyright: 2006-2012 OpenLayers Contributors +Licence: BSD-2-clause + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: GPL-2 + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + . + On Debian systems, the full license can be found at + "/usr/share/common-licenses/GPL-2". + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +Licence: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY OPENLAYERS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + . + The views and conclusions contained in the software and documentation are those + of the authors and should not be interpreted as representing official policies, + either expressed or implied, of OpenLayers Contributors. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..2a00185 --- /dev/null +++ b/debian/docs @@ -0,0 +1,5 @@ +CHANGES.txt +LICENSE.txt +README.txt +README.txt +requirements.txt diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5d9478f --- /dev/null +++ b/debian/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +PYTHON2=$(shell pyversions -vr) + +# Prevent setuptools/distribute from accessing the internet. +export http_proxy = http://127.0.9.1:9 + +%: + dh $@ --with python2,sphinxdoc + +override_dh_installdocs: + python setup.py build_sphinx --source-dir=docs/en/ + dh_installdocs build/sphinx/html + +override_dh_auto_clean: + dh_auto_clean + rm -rf build + rm -rf *.egg-info diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..b7ebbec --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 + +http://www.peacefrogs.net/download/chimere/chimere-(.*)\.tar\.bz2 diff --git a/requirements.txt b/requirements.txt index f458f31..de82ab9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -django==1.4 +django>=1.4,<1.4.99 beautifulsoup psycopg2 pil lxml -south==0.7.3 +south>=0.7.3,<0.7.99 simplejson feedparser django-extensions -- cgit v1.2.3 From 32dc52d8194afd9454990ab3ec21ab2f152121d2 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 4 Feb 2013 22:59:44 +0100 Subject: Fixes for debian packaging --- DATA_LICENCES.txt | 1 + MANIFEST.in | 6 ++---- chimere/__init__.py | 18 ++---------------- chimere/static/chimere/img/cloud-popup-relative.png | Bin .../images/prettyPhoto/dark_rounded/btnNext.png | Bin .../images/prettyPhoto/dark_rounded/btnPrevious.png | Bin .../prettyPhoto/dark_rounded/contentPattern.png | Bin .../prettyPhoto/dark_rounded/default_thumbnail.gif | Bin .../images/prettyPhoto/dark_rounded/loader.gif | Bin .../images/prettyPhoto/dark_rounded/sprite.png | Bin .../images/prettyPhoto/dark_square/btnNext.png | Bin .../images/prettyPhoto/dark_square/btnPrevious.png | Bin .../images/prettyPhoto/dark_square/contentPattern.png | Bin .../prettyPhoto/dark_square/default_thumbnail.gif | Bin .../images/prettyPhoto/dark_square/loader.gif | Bin .../images/prettyPhoto/dark_square/sprite.png | Bin .../images/prettyPhoto/facebook/btnNext.png | Bin .../images/prettyPhoto/facebook/btnPrevious.png | Bin .../prettyPhoto/facebook/contentPatternBottom.png | Bin .../prettyPhoto/facebook/contentPatternLeft.png | Bin .../prettyPhoto/facebook/contentPatternRight.png | Bin .../images/prettyPhoto/facebook/contentPatternTop.png | Bin .../images/prettyPhoto/facebook/default_thumbnail.gif | Bin .../images/prettyPhoto/facebook/loader.gif | Bin .../images/prettyPhoto/facebook/sprite.png | Bin .../images/prettyPhoto/light_rounded/btnNext.png | Bin .../images/prettyPhoto/light_rounded/btnPrevious.png | Bin .../prettyPhoto/light_rounded/default_thumbnail.gif | Bin .../images/prettyPhoto/light_rounded/loader.gif | Bin .../images/prettyPhoto/light_rounded/sprite.png | Bin .../images/prettyPhoto/light_square/btnNext.png | Bin .../images/prettyPhoto/light_square/btnPrevious.png | Bin .../prettyPhoto/light_square/default_thumbnail.gif | Bin .../images/prettyPhoto/light_square/loader.gif | Bin .../images/prettyPhoto/light_square/sprite.png | Bin chimere/tests/data_license | 1 - chimere/utils.py | 2 ++ debian/changelog | 2 +- debian/control | 15 ++++----------- debian/copyright | 6 +++--- debian/doc-base | 10 ++++++++++ debian/docs | 3 --- debian/pydist-overrides | 1 + debian/watch | 3 +-- setup.py | 1 + 45 files changed, 28 insertions(+), 41 deletions(-) create mode 100644 DATA_LICENCES.txt mode change 100755 => 100644 chimere/static/chimere/img/cloud-popup-relative.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnNext.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnPrevious.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/contentPattern.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/default_thumbnail.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/loader.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/sprite.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnNext.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnPrevious.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/contentPattern.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/default_thumbnail.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/loader.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/dark_square/sprite.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnNext.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnPrevious.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternBottom.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternLeft.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternRight.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternTop.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/default_thumbnail.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/loader.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/facebook/sprite.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnNext.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnPrevious.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/default_thumbnail.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/loader.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/sprite.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnNext.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnPrevious.png mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_square/default_thumbnail.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_square/loader.gif mode change 100755 => 100644 chimere/static/prettyPhoto/images/prettyPhoto/light_square/sprite.png delete mode 100644 chimere/tests/data_license create mode 100644 debian/doc-base create mode 100644 debian/pydist-overrides diff --git a/DATA_LICENCES.txt b/DATA_LICENCES.txt new file mode 100644 index 0000000..c9532bc --- /dev/null +++ b/DATA_LICENCES.txt @@ -0,0 +1 @@ +chimere/tests/eqs7day-M5.xml is a georss feed from the website http://www.usgs.gov/ published under the US public domain diff --git a/MANIFEST.in b/MANIFEST.in index 565fbbc..7b2ddd9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,7 @@ include *.txt MANIFEST.in include chimere/tests/* -prune docs/*/build/ -prune example_project/local_settings.py -include example_project/*.sample -include docs/*/*.rst Makefile +prune docs/*/*/build/ +include docs/*/*.rst include docs/*/Makefile include docs/*/conf.py include docs/*/static/*.png diff --git a/chimere/__init__.py b/chimere/__init__.py index e8e07a3..81b68e5 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -1,22 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012 Étienne Loks -""" -import os -os.environ['DJANGO_SETTINGS_MODULE'] = 'example_project.settings' +# Copyright (C) 2012-2013 Étienne Loks -from django.utils.translation import ugettext as _ - -try: - # strings to be considered for translation - # templates/chimere/edit.html, templates/chimere/edit_route.html - _(u"Multimedia files") - _(u"Picture files") -except ImportError: - pass -""" - -VERSION = (2, 0) +VERSION = (2, 0, 0) def get_version(): return u'.'.join((unicode(num) for num in VERSION)) diff --git a/chimere/static/chimere/img/cloud-popup-relative.png b/chimere/static/chimere/img/cloud-popup-relative.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnNext.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnNext.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnPrevious.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/btnPrevious.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/contentPattern.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/contentPattern.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/default_thumbnail.gif b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/default_thumbnail.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/loader.gif b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/loader.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/sprite.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_rounded/sprite.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnNext.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnNext.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnPrevious.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/btnPrevious.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/contentPattern.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/contentPattern.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/default_thumbnail.gif b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/default_thumbnail.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/loader.gif b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/loader.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/sprite.png b/chimere/static/prettyPhoto/images/prettyPhoto/dark_square/sprite.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnNext.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnNext.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnPrevious.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/btnPrevious.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternBottom.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternBottom.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternLeft.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternLeft.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternRight.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternRight.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternTop.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/contentPatternTop.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/default_thumbnail.gif b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/default_thumbnail.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/loader.gif b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/loader.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/facebook/sprite.png b/chimere/static/prettyPhoto/images/prettyPhoto/facebook/sprite.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnNext.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnNext.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnPrevious.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/btnPrevious.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/default_thumbnail.gif b/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/default_thumbnail.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/loader.gif b/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/loader.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/sprite.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_rounded/sprite.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnNext.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnNext.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnPrevious.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_square/btnPrevious.png old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_square/default_thumbnail.gif b/chimere/static/prettyPhoto/images/prettyPhoto/light_square/default_thumbnail.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_square/loader.gif b/chimere/static/prettyPhoto/images/prettyPhoto/light_square/loader.gif old mode 100755 new mode 100644 diff --git a/chimere/static/prettyPhoto/images/prettyPhoto/light_square/sprite.png b/chimere/static/prettyPhoto/images/prettyPhoto/light_square/sprite.png old mode 100755 new mode 100644 diff --git a/chimere/tests/data_license b/chimere/tests/data_license deleted file mode 100644 index bee3231..0000000 --- a/chimere/tests/data_license +++ /dev/null @@ -1 +0,0 @@ -eqs7day-M5.xml is a georss feed from the website http://www.usgs.gov/ published under the US public domain diff --git a/chimere/utils.py b/chimere/utils.py index d1ea851..a82d88b 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -46,6 +46,8 @@ from chimere import get_version from external_utils import OsmApi def unicode_normalize(string): + if type(string) == str: + string = unicode(string.decode('utf-8')) return ''.join( (c for c in unicodedata.normalize('NFD', string) if unicodedata.category(c) != 'Mn')) diff --git a/debian/changelog b/debian/changelog index 5e26b37..cf9c12f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-django-chimere (2.0.0) unstable; urgency=low +python-django-chimere (2.0.0-1) unstable; urgency=low * Initial release (Closes: #699579) diff --git a/debian/control b/debian/control index 2dc9e52..0dc442c 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,9 @@ Source: python-django-chimere Section: python Priority: optional Maintainer: Étienne Loks -Build-Depends: debhelper (>= 8.0.0) +Build-Depends: debhelper (>= 8.0.0), + python | python-all | python-dev | python-all-dev, + python-sphinx (>= 1.0.7+dfsg) | python3-sphinx Standards-Version: 3.9.3 Homepage: http://pypi.python.org/pypi/chimere #Vcs-Git: git://git.debian.org/collab-maint/python-django-chimere.git @@ -33,8 +35,7 @@ Description: collaborative and thematic maps application for Django layer. This software aims to create online collaborative and thematic maps. Content (multimedia, text) are associated to basic geographic items (Point Of Interest, routes). Adds on the map are open to everybody - with no authentification but are moderated by a team in charge of the - map. + with no authentication but are moderated by a team in charge of the map. . Main features: * Display (by default) of the mapnik OpenStreetMap layer. @@ -53,11 +54,3 @@ Description: collaborative and thematic maps application for Django * Configuration of map layers in administration interface. * Import and export of data from/to various formats: ShapeFile, KML, GeoRSS (import only), CSV and OpenStreetMap. - -Package: python-django-chimere-docs -Architecture: all -Section: doc -Depends: ${sphinxdoc:Depends}, ${misc:Depends} -Description: python-django-chimere documentation - This package documents the use and customization of the collaborative and - thematic maps application for Django Chimère. diff --git a/debian/copyright b/debian/copyright index f5939a4..bee08dd 100644 --- a/debian/copyright +++ b/debian/copyright @@ -20,7 +20,7 @@ License: MIT or GPL-2 Files: chimere/bsmSelect/* Copyright: 2008 Ryan Cramer -Copyright: 2010 Victor Berchet + 2010 Victor Berchet License: MIT or GPL-2 Files: chimere/prettyPhoto/* @@ -29,7 +29,7 @@ License: GPL-2 Files: chimere/openlayers/* Copyright: 2006-2012 OpenLayers Contributors -Licence: BSD-2-clause +License: BSD-2-clause License: MIT Permission is hereby granted, free of charge, to any person obtaining @@ -86,7 +86,7 @@ License: GPL-3.0+ On Debian systems, the complete text of the GNU General Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". -Licence: BSD-2-clause +License: BSD-2-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . diff --git a/debian/doc-base b/debian/doc-base new file mode 100644 index 0000000..b7c033a --- /dev/null +++ b/debian/doc-base @@ -0,0 +1,10 @@ +Document: python-django-chimere +Title: Chimère +Author: Étienne Loks +Abstract: This manual describes how to install and use Chimère a web + collaborative and thematic maps. +Section: Data Management + +Format: html +Index: /usr/share/doc/python-django-chimere/html/index.html +Files: /usr/share/doc/python-django-chimere/html/*.html diff --git a/debian/docs b/debian/docs index 2a00185..e953f2c 100644 --- a/debian/docs +++ b/debian/docs @@ -1,5 +1,2 @@ CHANGES.txt -LICENSE.txt README.txt -README.txt -requirements.txt diff --git a/debian/pydist-overrides b/debian/pydist-overrides new file mode 100644 index 0000000..bc90d3f --- /dev/null +++ b/debian/pydist-overrides @@ -0,0 +1 @@ +django_tinymce python-django-tinymce diff --git a/debian/watch b/debian/watch index b7ebbec..a67dad8 100644 --- a/debian/watch +++ b/debian/watch @@ -1,3 +1,2 @@ version=3 - -http://www.peacefrogs.net/download/chimere/chimere-(.*)\.tar\.bz2 +http://pypi.python.org/packages/source/c/chimere-([0-9a-z.]*)\.tar\.gz diff --git a/setup.py b/setup.py index 0e990a4..b7bf65b 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ setup( packages=find_packages(), include_package_data=True, install_requires=reqs, + #test_suite = "chimere.runtests.runtests", classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', -- cgit v1.2.3 From 6636f4cacea2887c4dcf496d7ecd9ef762f7593d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 5 Feb 2013 15:58:32 +0100 Subject: Minor: add attribution of map layer --- chimere/static/chimere/css/styles.css | 5 +++++ chimere/static/chimere/js/jquery.chimere.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 88f1b5e..c30d259 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -879,3 +879,8 @@ div.pp_default .pp_expand{ left:10px; background-position: -15px -80px; } + +.olControlAttribution{ + left:6px; + bottom:5px; +} diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 2c8bb97..dbf820c 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -123,6 +123,8 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { /* Create map object */ settings.map = map = new OpenLayers.Map(map_element, map_options); + map.addControl(new OpenLayers.Control.Attribution()); + /* Manage permalink */ if (!settings.edition){ if (settings.permalink == null && !settings.edition) { -- cgit v1.2.3 From 5e5f5f3b1e0d28371c689c2aafd6d14d3303b49f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 5 Feb 2013 16:05:49 +0100 Subject: Doc: Fix gitorious url --- docs/en/install.rst | 2 +- docs/en/upgrade.rst | 2 +- docs/fr/install.rst | 2 +- docs/fr/upgrade.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/install.rst b/docs/en/install.rst index 0516c90..1bb5771 100644 --- a/docs/en/install.rst +++ b/docs/en/install.rst @@ -146,7 +146,7 @@ A default project can be found on `Gitorious it and start a new project with it (or get another project based on Chimère):: cd $INSTALL_PATH/chimere - git clone git@gitorious.org:chimere-example-project/chimere-example-project.git + git clone git://gitorious.org/chimere-example-project/chimere-example-project.git django-admin startproject --template=chimere-example-project mychimere_project rm -rf chimere-example-project diff --git a/docs/en/upgrade.rst b/docs/en/upgrade.rst index 193e62c..d0eaa4c 100644 --- a/docs/en/upgrade.rst +++ b/docs/en/upgrade.rst @@ -153,7 +153,7 @@ it and start a new project with it (or get another project based on Chimère):: .. code-block:: bash cd $CHIMERE_PATH - git clone git@gitorious.org:chimere-example-project/chimere-example-project.git + git clone git://gitorious.org/chimere-example-project/chimere-example-project.git django-admin startproject --template=chimere-example-project mychimere_project rm -rf chimere-example-project diff --git a/docs/fr/install.rst b/docs/fr/install.rst index 234b391..8e8f8ce 100644 --- a/docs/fr/install.rst +++ b/docs/fr/install.rst @@ -143,7 +143,7 @@ Un exemple de projet peut être trouvé sur `Gitorious Clonez-le et modifiez-le (ou utilisez un autre projet basé sur Chimère) : :: cd $INSTALL_PATH/chimere - git clone git@gitorious.org:chimere-example-project/chimere-example-project.git + git clone git://gitorious.org/chimere-example-project/chimere-example-project.git django-admin startproject --template=chimere-example-project mychimere_project rm -rf chimere-example-project diff --git a/docs/fr/upgrade.rst b/docs/fr/upgrade.rst index 788eca7..841485b 100644 --- a/docs/fr/upgrade.rst +++ b/docs/fr/upgrade.rst @@ -161,7 +161,7 @@ Clonez-le et modifiez-le (ou utilisez un autre projet basé sur Chimère) : :: .. code-block:: bash cd $CHIMERE_PATH - git clone git@gitorious.org:chimere-example-project/chimere-example-project.git + git clone git://gitorious.org/chimere-example-project/chimere-example-project.git django-admin startproject --template=chimere-example-project mychimere_project rm -rf chimere-example-project -- cgit v1.2.3 From 02004f090c5a98bbeda6f6cdad708b95ea717ab1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 6 Feb 2013 16:44:38 +0100 Subject: Admin: fix route admin when a property is newly set --- chimere/admin.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chimere/admin.py b/chimere/admin.py index 4b83878..996dfd5 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -210,17 +210,19 @@ class MarkerAdmin(admin.ModelAdmin): }), ) inlines = [MultimediaInline, PictureInline] + has_properties = True def __init__(self, *args, **kwargs): """ Manage properties in fieldsets. """ - main_fields = self.fieldsets[0][1]['fields'] - for pm in PropertyModel.objects.filter(available=True).order_by('order' + if self.has_properties: + main_fields = self.fieldsets[0][1]['fields'] + for pm in PropertyModel.objects.filter(available=True).order_by('order' ).all(): - pm_name = pm.getNamedId() - if pm_name not in main_fields: - main_fields.append(pm_name) + pm_name = pm.getNamedId() + if pm_name not in main_fields: + main_fields.append(pm_name) super(MarkerAdmin, self).__init__(*args, **kwargs) def queryset(self, request): @@ -286,6 +288,7 @@ class RouteAdmin(MarkerAdmin): }), ) inlines = [] + has_properties = False def queryset(self, request): qs = self.model._default_manager.get_query_set() -- cgit v1.2.3 From f048d7e8e12622e7fc6ff3c76160db7ad32544e0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 10 Feb 2013 16:48:42 +0100 Subject: v2.0.1 description --- CHANGES.txt | 8 ++++++++ chimere/__init__.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4712708..47e6443 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,11 @@ +2.0.1 (2013-02-10) +------------------ + +- admin: fix route page when a property is newly set +- map: add attribution div +- minor fix on the documentation + + 2.0.0 (2013-02-02) ------------------ diff --git a/chimere/__init__.py b/chimere/__init__.py index 81b68e5..450d4e5 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2012-2013 Étienne Loks -VERSION = (2, 0, 0) +VERSION = (2, 0, 1) def get_version(): return u'.'.join((unicode(num) for num in VERSION)) -- cgit v1.2.3 From de9f01ff4ab23b738d64c74e92790603f842695b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sun, 10 Feb 2013 17:36:06 +0100 Subject: Update Debian changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index cf9c12f..790575e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-django-chimere (2.0.1-1) unstable; urgency=low + + * New upstream release + + -- Étienne Loks Sun, 10 Feb 2013 17:01:34 +0100 + python-django-chimere (2.0.0-1) unstable; urgency=low * Initial release (Closes: #699579) -- cgit v1.2.3 From 0d14f906c1d8eb36127f85effb1bc87790ec251c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 12 Feb 2013 14:31:46 +0100 Subject: Debian: add missing dependency --- debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 0dc442c..7f913fd 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,8 @@ Priority: optional Maintainer: Étienne Loks Build-Depends: debhelper (>= 8.0.0), python | python-all | python-dev | python-all-dev, - python-sphinx (>= 1.0.7+dfsg) | python3-sphinx + python-sphinx (>= 1.0.7+dfsg) | python3-sphinx, + python-setuptools Standards-Version: 3.9.3 Homepage: http://pypi.python.org/pypi/chimere #Vcs-Git: git://git.debian.org/collab-maint/python-django-chimere.git -- cgit v1.2.3 From 4a5f51d26982fe04eae01ee6ca0bbdb8b3153173 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 15 Feb 2013 12:28:33 +0100 Subject: Debian: fix dependencies --- debian/control | 3 +-- debian/pydist-overrides | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 7f913fd..71b2461 100644 --- a/debian/control +++ b/debian/control @@ -29,8 +29,7 @@ Recommends: javascript-common, libjs-jquery, libjs-jquery-ui, libjs-jquery-ui-theme-base, - gpsbabel, - tinymce + gpsbabel Description: collaborative and thematic maps application for Django Chimère is a cartographic mashup using OpenStreetMap as a default map layer. This software aims to create online collaborative and thematic diff --git a/debian/pydist-overrides b/debian/pydist-overrides index bc90d3f..0d69808 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1 +1,2 @@ -django_tinymce python-django-tinymce +django_tinymce tinymce +pil python-imaging -- cgit v1.2.3 From d3c3bb13b7fe8108d222ca58a32b386bdf3b322c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 18 Feb 2013 16:24:33 +0100 Subject: Debian: remove django-extensions dependency --- debian/pydist-overrides | 1 + requirements.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/pydist-overrides b/debian/pydist-overrides index 0d69808..753bbf5 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1,2 +1,3 @@ django_tinymce tinymce pil python-imaging +django_extensions python-django diff --git a/requirements.txt b/requirements.txt index de82ab9..ca8db85 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,4 @@ lxml south>=0.7.3,<0.7.99 simplejson feedparser -django-extensions django-tinymce -- cgit v1.2.3 From 9d6870fa61b2bfd5367d58ff7a2ea0e7828a3d55 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 00:40:21 +0100 Subject: Fix permalink (refs #479) --- chimere/static/chimere/js/jquery.chimere.js | 1 - 1 file changed, 1 deletion(-) diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index dbf820c..6675dcd 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -198,7 +198,6 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { if (settings.zoom && settings.lon && settings.lat) { var centerLonLat = new OpenLayers.LonLat(settings.lon, settings.lat); - centerLonLat.transform(EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION); settings.map.setCenter(centerLonLat, settings.zoom); } /* if not zoom to the extent in cookies */ -- cgit v1.2.3 From dce6d0499efe505096495b36728eeb8c9fb8ced1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 11:08:10 +0100 Subject: Be tolerent to markers with not category associated --- chimere/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index c3d4733..0fc22ee 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -521,11 +521,14 @@ class Marker(GeographicItem): def default_category(self): # Should we select only available ones ? # Should we catch if not exists ? - return self.categories.all()[0] + cats = self.categories + if cats.count(): + return cats.all()[0] def get_absolute_url(self, area_name=''): - parameters = 'current_feature=%d&checked_categories=%s' % (self.id, - self.default_category.pk) + parameters = 'current_feature=%d' % self.id + if self.default_category: + parameters += '&checked_categories=%s' % self.default_category.pk urn = TinyUrl.getUrnByParameters(parameters) area_name = area_name + '/' if area_name else '' url = reverse('chimere:tiny', args=[area_name, urn]) -- cgit v1.2.3 From 9a474d513cfacfa92ba24048c8e9f94bbe359037 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 11:42:28 +0100 Subject: Better sorting of news --- chimere/models.py | 5 ++++- chimere/templatetags/chimere_tags.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index 0fc22ee..05b280c 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -419,7 +419,10 @@ class Marker(GeographicItem): @property def date(self): - if settings.CHIMERE_DAYS_BEFORE_EVENT: + if settings.CHIMERE_DAYS_BEFORE_EVENT and self.start_date: + today = datetime.date.today() + if self.end_date and self.start_date < today: + return self.end_date return self.start_date @property diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index 0490c2d..aadaa6b 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -68,7 +68,7 @@ def display_news(context, display=False): if area: q = q.filter(area.getIncludeMarker()) news += list(q) - news.sort(key=lambda x:x.date, reverse=True) + news.sort(key=lambda x:x.date) context_data['news_lst'] = news return context_data -- cgit v1.2.3 From ebe579a86bfe0d75dbef03281d43a2cf10a2e5fe Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 12:45:04 +0100 Subject: Admin: improve marker list with dates fields --- chimere/admin.py | 6 +++--- debian/pydist-overrides | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/chimere/admin.py b/chimere/admin.py index 996dfd5..6c7b2cc 100644 --- a/chimere/admin.py +++ b/chimere/admin.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2012 Étienne Loks +# Copyright (C) 2008-2013 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -181,8 +181,8 @@ class MarkerAdmin(admin.ModelAdmin): Specialized the Point field. """ search_fields = ("name",) - list_display = ('name', 'status') - list_filter = ('status', 'categories') + list_display = ('name', 'status', 'start_date', 'end_date') + list_filter = ('status', 'categories', 'start_date', 'end_date') actions = [validate, disable, managed_modified, export_to_kml, export_to_shapefile, export_to_csv] exclude = ['submiter_session_key', 'import_key', 'import_version', diff --git a/debian/pydist-overrides b/debian/pydist-overrides index 753bbf5..0d69808 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1,3 +1,2 @@ django_tinymce tinymce pil python-imaging -django_extensions python-django -- cgit v1.2.3 From 2418e1b852af862a47ac0b7d0ef1a1d30b942a0e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 13:05:21 +0100 Subject: v2.0.2 description --- CHANGES.txt | 9 ++++++++- chimere/__init__.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 47e6443..355b988 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,11 @@ +2.0.2 (2013-02-19) +------------------ + +- map: fix permalink +- map: error tolerant to marker with no associated category +- map: better sort of news +- admin: improve marker list + 2.0.1 (2013-02-10) ------------------ @@ -5,7 +13,6 @@ - map: add attribution div - minor fix on the documentation - 2.0.0 (2013-02-02) ------------------ diff --git a/chimere/__init__.py b/chimere/__init__.py index 450d4e5..2ef2100 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright (C) 2012-2013 Étienne Loks -VERSION = (2, 0, 1) +VERSION = (2, 0, 2) def get_version(): return u'.'.join((unicode(num) for num in VERSION)) -- cgit v1.2.3 From 05ca2df23ec5522d05fea0ef6e10dd52ddb509e5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 19 Feb 2013 13:39:49 +0100 Subject: Debian: update changelog --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 790575e..5b0d8a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-django-chimere (2.0.2-1) unstable; urgency=low + + * New upstream release + + -- Étienne Loks Tue, 19 Feb 2013 13:29:21 +0100 + python-django-chimere (2.0.1-1) unstable; urgency=low * New upstream release -- cgit v1.2.3 From 391ac26096fd45b71ef6ca107e236bb30329e3b0 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 20 Feb 2013 13:11:22 +0100 Subject: Fixtures: add geobretagne and opencyclemap layers --- chimere/fixtures/layers-geobretagne.json | 74 +++++++++++++++++++++++++++++++ chimere/fixtures/layers-opencyclemap.json | 26 +++++++++++ 2 files changed, 100 insertions(+) create mode 100644 chimere/fixtures/layers-geobretagne.json create mode 100644 chimere/fixtures/layers-opencyclemap.json diff --git a/chimere/fixtures/layers-geobretagne.json b/chimere/fixtures/layers-geobretagne.json new file mode 100644 index 0000000..b5a406e --- /dev/null +++ b/chimere/fixtures/layers-geobretagne.json @@ -0,0 +1,74 @@ +[ + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Cassini - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'cassini', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Collection David Rumsey\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Cassini - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2010 BMO - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-bmo-2010', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Brest Metropole Oceane - SIG - juin 2010\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2010 BMO - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2010 Lannion Tregor - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-lanniontregor', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Lannion Tregor agglomeration\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2010 Lannion Tregor - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2011 Rennes Metropole - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-rennesmetropole', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Rennes Métropole\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2011 Rennes Metropole - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2004 BMO - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-bmo-2004', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Brest Metropole Oceane - SIG - Sept. 2004\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2004 BMO - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2005 Cap l'Orient - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-caplorient', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Cap l'Orient 2005\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2005 Cap l'Orient - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2008 Quimper Communauté - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-quimpercommunaute', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"Quimper Communauté 2008\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2008 Quimper Communauté - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie 2010 Morbihan - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ortho-megalis-56', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"e-Megalis - Mars 2010\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie 2010 Morbihan - G\u00e9obretagne" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.WMS(\r\n \"Orthophotographie infrarouge 2010 Morbihan - G\u00e9obretagne\", \"http://geobretagne.fr/wmsouvert\",\r\n { layers: 'ir-megalis-56', format: 'image/png', transparent:\r\nfalse},\r\n {\r\n attribution: \"e-Megalis - Mars 2010\",\r\n visibility: false,\r\n numZoomLevels:19,\r\n projection: new OpenLayers.Projection(\"EPSG:900913\"),\r\n displayProjection: new OpenLayers.Projection(\"EPSG:4326\"),\r\n}\r\n)\r\n", + "name": "Orthophotographie infrarouge 2010 Morbihan - G\u00e9obretagne" + } + } +] diff --git a/chimere/fixtures/layers-opencyclemap.json b/chimere/fixtures/layers-opencyclemap.json new file mode 100644 index 0000000..5f3ef47 --- /dev/null +++ b/chimere/fixtures/layers-opencyclemap.json @@ -0,0 +1,26 @@ +[ + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.OSM(\"OpenCycleMap - Cycle\", [\r\n 'http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',\r\n 'http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',\r\n 'http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png'],\r\n{attribution:\"Tiles courtesy of Andy Allan\"})", + "name": "OpenCycleMap - Cycle" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.OSM(\"OpenCycleMap - Transport\", [\r\n 'http://a.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png',\r\n 'http://b.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png',\r\n 'http://c.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png'],\r\n{attribution:\"Tiles courtesy of Andy Allan\"})", + "name": "OpenCycleMap - Transport" + } + }, + { + "pk": null, + "model": "chimere.layer", + "fields": { + "layer_code": "new OpenLayers.Layer.OSM(\"OpenCycleMap - Landscape\", [\r\n 'http://a.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png',\r\n 'http://b.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png',\r\n 'http://c.tile3.opencyclemap.org/landscape/${z}/${x}/${y}.png'],\r\n{attribution:\"Tiles courtesy of Andy Allan\"})", + "name": "OpenCycleMap - Landscape" + } + } +] -- cgit v1.2.3 From d02ec4246813eb0787bf3ab54af1af9ce32bd376 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 4 Mar 2013 19:26:34 +0100 Subject: Force JPG thumbnail to prevent resizing errors --- chimere/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chimere/models.py b/chimere/models.py index 05b280c..9efc0a0 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -788,7 +788,7 @@ def picturefile_post_save(sender, **kwargs): basename, format = os.path.splitext(filetail) basename = defaultfilters.slugify(basename) basename = re.sub(r'-','_', basename) - miniature = basename + '_thumb' + format + miniature = basename + '_thumb.jpg' filename = file.path miniature_filename = os.path.join(filehead, miniature) try: @@ -808,10 +808,12 @@ def picturefile_post_save(sender, **kwargs): image.thumbnail([image_x, image_y], Image.ANTIALIAS) temp_image = open(miniature_filename, 'w') + if image.mode != "RGB": + image = image.convert('RGB') try: - image.save(temp_image, image.format, quality=90, optimize=1) + image.save(temp_image, 'JPEG', quality=90, optimize=1) except: - image.save(temp_image, image.format, quality=90) + image.save(temp_image, 'JPEG', quality=90) short_name = miniature_filename[len(settings.MEDIA_ROOT):] picturefile.thumbnailfile = short_name -- cgit v1.2.3