bda.calendar.base


Namebda.calendar.base JSON
Version 1.2.5 PyPI version JSON
download
home_pagehttps://github.com/bluedynamics/bda.calendar.base
SummaryBase common calendaring features: Convinience or not coverd yet.
upload_time2022-12-05 11:30:05
maintainer
docs_urlNone
authorJens Klein, Robert Niedereiter
requires_python
licenseBSD
keywords calendaring
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==========================================================
Convinience for Datetime handling in combination with Zope
==========================================================

``bda.calendar.base`` contains functions adressing programmers all-day tasks
not (or only partly) covered by pythons datetime or zopes DateTime.

Major part of these function is timezone aware. Also ist easy to deal with 
timezones. An TimezoneFactory can be provided in the specific application
to i.e. be aware of the users timezone (i.e. in case of webapps).


calculators
-----------

CWof(date)
    the calendar week number of a date.

firstDayOfCW(year, cw, tzinfo=None)
    first day of a numbered calendar week

daysOfWeek(year, cw, tzinfo=None)
    yields 7 datetimes of the given calendar week

numberOfDaysInYear(dt)
    calculate number of day of the year of the given datetime year

numberOfDaysInMonth(dt)           
    calculates number of days of the given datetimes month 

daysOfMonth    
    yields all days as datetimes of the given month

hoursOfDay(year, month, day, tzinfo=None)
    yields all hours of a day as datetimes    

isSameDay(first, second)    
    detects if two dates are the same day. bool.


converter
---------

dt2DT(dt)
    Convert Python's datetime to Zope's DateTime. Acts timezone-aware.

DT2dt(DT)
    Convert Zope's DateTime to Pythons's datetime. Acts timezone-neutral, 
    outcome is on UTC.

dt2UTCString(dt)
    build a '-' separated string from the datetime timetuple as UTC.

dtFromUTCString(utcstr)
    build datetime from timetuple UTC string.

dt2epochday(dt)
   Number of days since epoch.  
   timezone gets a problem here, we need to normalize all to GMT to make it 
   recognize the same day even if it a different timezone:
   i.e. 2008-05-01T00:00:00+02:00 (CEST) 


inspector
---------

All functions are using the timezoneAdjuster (see below). therefore a context is 
passed

dtYear(dt, context=None):
    year of datetime.

dtMonth(dt, context=None)
    month of datetime.

dtDay(dt, context=None)
    day of datetime.

dtHour(dt, context=None)
    hour of datetime.

dtMinute(dt, context=None)
    minute of datetime.

dtWeekday(dt, context=None)
    Weekday of datetime.

pyDt
    Detect wether dt is instance of datetime object.


recurring
---------

Simple recurring features. for more sophisticated recurring feature refer to
dateutils.rrule

recueDays(start, until, recuemode, offset)
    Generates list of recue days.    


timezone
--------

Dealing with timezones is always pain. With these common features it get less 
pain. Using ZCA where registering a common ``TimezoneFactory`` using the computers 
system timezone. It is used by the ``timezoneAdjuster``. If you register a more 
specific TimezoneFactory following its simple interface - its just a callable -
, you can implement user configurated multi-timezone aware applications.
This is all based on pytz, because pytz just works.

ServerTimezoneFactory(context)
    The timezone of the server (current computer). You never need to use this 
    directly.

timezoneAdjuster(context, dt)
    New datetime with given timezone. Given datetime cant be naive!

tzawarenow()
    timezone aware ``now`` datetime using utc timezone. if you need 
    the current timezone adjust it.


Contributors
============

- Jens Klein <jens@bluedynamics.com>
- Robert Niederreiter <rnix@squarewave.at>


License
=======

Copyright (c) 2008-2022, BlueDynamics Alliance, Austria
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.
* 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.
* Neither the name of the BlueDynamics Alliance nor the names of its
  contributors may be used to endorse or promote products derived from this
  software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``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 BlueDynamics Alliance 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.


Changes
=======

1.2.5 (2022-12-05)
------------------

- Try again to release wheel with zest.releaser.
  [rnix]


1.2.4 (2022-12-05)
------------------

- Release wheel.
  [rnix]


1.2.3
-----

- Remove superfluous import.
  [rnix, 2020-08-12]


1.2.2
-----

- conditional ZCML for pyramid and zope.
  [rnix, 2011-11-16]



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bluedynamics/bda.calendar.base",
    "name": "bda.calendar.base",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Calendaring",
    "author": "Jens Klein, Robert Niedereiter",
    "author_email": "dev@bluedynamics.com",
    "download_url": "https://files.pythonhosted.org/packages/8f/a0/a5a54fefca0f87abde79138bca3be16087e658238277d96bae34f5a365d0/bda.calendar.base-1.2.5.tar.gz",
    "platform": null,
    "description": "==========================================================\nConvinience for Datetime handling in combination with Zope\n==========================================================\n\n``bda.calendar.base`` contains functions adressing programmers all-day tasks\nnot (or only partly) covered by pythons datetime or zopes DateTime.\n\nMajor part of these function is timezone aware. Also ist easy to deal with \ntimezones. An TimezoneFactory can be provided in the specific application\nto i.e. be aware of the users timezone (i.e. in case of webapps).\n\n\ncalculators\n-----------\n\nCWof(date)\n    the calendar week number of a date.\n\nfirstDayOfCW(year, cw, tzinfo=None)\n    first day of a numbered calendar week\n\ndaysOfWeek(year, cw, tzinfo=None)\n    yields 7 datetimes of the given calendar week\n\nnumberOfDaysInYear(dt)\n    calculate number of day of the year of the given datetime year\n\nnumberOfDaysInMonth(dt)           \n    calculates number of days of the given datetimes month \n\ndaysOfMonth    \n    yields all days as datetimes of the given month\n\nhoursOfDay(year, month, day, tzinfo=None)\n    yields all hours of a day as datetimes    \n\nisSameDay(first, second)    \n    detects if two dates are the same day. bool.\n\n\nconverter\n---------\n\ndt2DT(dt)\n    Convert Python's datetime to Zope's DateTime. Acts timezone-aware.\n\nDT2dt(DT)\n    Convert Zope's DateTime to Pythons's datetime. Acts timezone-neutral, \n    outcome is on UTC.\n\ndt2UTCString(dt)\n    build a '-' separated string from the datetime timetuple as UTC.\n\ndtFromUTCString(utcstr)\n    build datetime from timetuple UTC string.\n\ndt2epochday(dt)\n   Number of days since epoch.  \n   timezone gets a problem here, we need to normalize all to GMT to make it \n   recognize the same day even if it a different timezone:\n   i.e. 2008-05-01T00:00:00+02:00 (CEST) \n\n\ninspector\n---------\n\nAll functions are using the timezoneAdjuster (see below). therefore a context is \npassed\n\ndtYear(dt, context=None):\n    year of datetime.\n\ndtMonth(dt, context=None)\n    month of datetime.\n\ndtDay(dt, context=None)\n    day of datetime.\n\ndtHour(dt, context=None)\n    hour of datetime.\n\ndtMinute(dt, context=None)\n    minute of datetime.\n\ndtWeekday(dt, context=None)\n    Weekday of datetime.\n\npyDt\n    Detect wether dt is instance of datetime object.\n\n\nrecurring\n---------\n\nSimple recurring features. for more sophisticated recurring feature refer to\ndateutils.rrule\n\nrecueDays(start, until, recuemode, offset)\n    Generates list of recue days.    \n\n\ntimezone\n--------\n\nDealing with timezones is always pain. With these common features it get less \npain. Using ZCA where registering a common ``TimezoneFactory`` using the computers \nsystem timezone. It is used by the ``timezoneAdjuster``. If you register a more \nspecific TimezoneFactory following its simple interface - its just a callable -\n, you can implement user configurated multi-timezone aware applications.\nThis is all based on pytz, because pytz just works.\n\nServerTimezoneFactory(context)\n    The timezone of the server (current computer). You never need to use this \n    directly.\n\ntimezoneAdjuster(context, dt)\n    New datetime with given timezone. Given datetime cant be naive!\n\ntzawarenow()\n    timezone aware ``now`` datetime using utc timezone. if you need \n    the current timezone adjust it.\n\n\nContributors\n============\n\n- Jens Klein <jens@bluedynamics.com>\n- Robert Niederreiter <rnix@squarewave.at>\n\n\nLicense\n=======\n\nCopyright (c) 2008-2022, BlueDynamics Alliance, Austria\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this\n  list of conditions and the following disclaimer in the documentation and/or\n  other materials provided with the distribution.\n* Neither the name of the BlueDynamics Alliance nor the names of its\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``AS IS`` AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nChanges\n=======\n\n1.2.5 (2022-12-05)\n------------------\n\n- Try again to release wheel with zest.releaser.\n  [rnix]\n\n\n1.2.4 (2022-12-05)\n------------------\n\n- Release wheel.\n  [rnix]\n\n\n1.2.3\n-----\n\n- Remove superfluous import.\n  [rnix, 2020-08-12]\n\n\n1.2.2\n-----\n\n- conditional ZCML for pyramid and zope.\n  [rnix, 2011-11-16]\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Base common calendaring features: Convinience or not coverd yet.",
    "version": "1.2.5",
    "split_keywords": [
        "calendaring"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "5b450597f87f9427df35746e04f63e3a",
                "sha256": "24a87cd19056efa24bebd6dcfcf433050e592cd4473f73e9e225c519b9710719"
            },
            "downloads": -1,
            "filename": "bda.calendar.base-1.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b450597f87f9427df35746e04f63e3a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9309,
            "upload_time": "2022-12-05T11:30:03",
            "upload_time_iso_8601": "2022-12-05T11:30:03.975092Z",
            "url": "https://files.pythonhosted.org/packages/ab/78/4e24e70b5871b14ed7292dbb73e7e606d80adc9f2291f70af21b80b41ce1/bda.calendar.base-1.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "9158314b1047f423a0c38350ba7f7180",
                "sha256": "a837fd1131ad99b9e45d5cfe6bc2123600f87cd3d3736f542ffba694fda40553"
            },
            "downloads": -1,
            "filename": "bda.calendar.base-1.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9158314b1047f423a0c38350ba7f7180",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9816,
            "upload_time": "2022-12-05T11:30:05",
            "upload_time_iso_8601": "2022-12-05T11:30:05.804556Z",
            "url": "https://files.pythonhosted.org/packages/8f/a0/a5a54fefca0f87abde79138bca3be16087e658238277d96bae34f5a365d0/bda.calendar.base-1.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-05 11:30:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "bluedynamics",
    "github_project": "bda.calendar.base",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bda.calendar.base"
}
        
Elapsed time: 0.01635s