Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
collective.timedevents
Advanced tools
collective.timedevents fires clock based Zope 3 events. They can make Zope application react to timers. This is useful for creating services where something must happen regurlarly or after a certain period has expired.
This is a developer level product. This product is indended to replace Products.TickingMachine with more robust Zope 3 codebase.
There are two different styles of using it:
a) Using the ITickEvent and calculating if action needs to be done in the event subscriber. This will also take care of timing over zope restarts by keeping event timing persistent.
b) Subscribing to any of the cron-style IIntervalTicks*-events, not worrying about the timing client side. For the longer ticks (weekly, montly) a cron-job as trigger makes most sense, in case of zope restarts.
Tested by Travis:
.. image:: https://secure.travis-ci.org/collective/collective.timedevents.png?branch=master :target: https://travis-ci.org/#!/collective/collective.timedevents
.. contents:: Table of contents
Add collective.timedevents to your buildout by adding the egg to your buildout.cfg::
eggs =
...
collective.timedevents
Trigger
Can either be cron-jobs or zope clock-server.
Add clock server to tick timedevents subscribers - use your Plone instance name::
[instance]
...
zope-conf-additional =
<clock-server>
method /mysite/@@tick
period 90
user clockserver-user
password password
host localhost
</clock-server>
Or for the cron-like interval-based events, here 900 seconds for the 15-minute event::
<clock-server>
method /mysite/@@tick_fifteen
period 900
user clockserver-user
password password
host localhost
</clock-server>
Now you should start to see ticks in the zope event log.
Subscribe to the events/ticks you need.
A. Using the ITickEvent method:
Add collective.timedevents.interfaces.ITickEvent subscribers to your product ZCML declarations::
<subscriber
handler="myproduct.tickers.on_tick"
for="collective.timedevents.interfaces.ITickEvent"
/>
Configure your event handler to react after certain period has expired::
from zope.app.component.hooks import getSite
def on_tick(event): """ Do something after one hour has elapsed """ interval_in_days = 1.0 / 24.0 # One hour, floating point context = site.my_magic_context # Persistent object which stores our timing data if event.last_tick > context.last_action + interval_in_days: # Check whether enough time has elaped do_stuff() context.last_action = event.last_tick # Store when we last time did something
B. Using the IIntervalTicks*-events:
Add collective.timedevents.interfaces.IIntervalTicks* subscribers to your module ZCML declarations::
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="mymodule">
<subscriber
handler="myproduct.tickers.on_tick_fifteen"
for="collective.timedevents.intefaces.IIntervalTicks15Event"
/>
</configure>
All ticking code is executed under admin privileges.
ITickEvent tick period is 300 seconds by default. This can be controlled in views.py.
Ticks for ITickEvent are logged by events.tick_logger defined in configure.zcml.
This product fills the following quality criteria:
Unit tests provided
Good documentation provided
Commented code
PyPi eggs provided
Mikko Ohtamaa <http://opensourcehacker.com> <http://opensourcehacker.com>
_
Quintagroup
Sune Brøndum Wøller
The orignal concept and code was created by Tomasz J.
Kotarba tomasz@kotarba.net of SYSTEM7 <http://system7.IT>
_.
Twinapex Research, Oulu, Finland <http://www.twinapex.com>
\ _ -
High quality Python hackers for hire
Add Python 3 & Plone 5.2 compatibility [boulch]
Use github CI for automated testing [tomgross]
Travis CI integration [hvelarde]
Added cron-style tick events, to be triggered by cron or clockserver, with no internal calculation of interval. Updated readme and tests. [sunew]
FAQs
Plone/Zope time based event mechanism
We found that collective.timedevents demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.