Services Module Reference

Complete reference for all service modules in eventyay.base.services.

Order Management

class eventyay.base.services.orders.OrderChangeManager(order: Order, user=None, auth=None, notify=True, reissue_invoice=True)

Bases: object

class AddFeeOperation(fee)

Bases: tuple

fee

Alias for field number 0

class AddOperation(product, variation, price, addon_to, subevent, seat)

Bases: tuple

addon_to

Alias for field number 3

price

Alias for field number 2

product

Alias for field number 0

seat

Alias for field number 5

subevent

Alias for field number 4

variation

Alias for field number 1

class CancelFeeOperation(fee)

Bases: tuple

fee

Alias for field number 0

class CancelOperation(position)

Bases: tuple

position

Alias for field number 0

class FeeValueOperation(fee, value)

Bases: tuple

fee

Alias for field number 0

value

Alias for field number 1

class PriceOperation(position, price)

Bases: tuple

position

Alias for field number 0

price

Alias for field number 1

class ProductOperation(position, product, variation)

Bases: tuple

position

Alias for field number 0

product

Alias for field number 1

variation

Alias for field number 2

class RegenerateSecretOperation(position)

Bases: tuple

position

Alias for field number 0

SeatOperation

alias of SubeventOperation

class SplitOperation(position)

Bases: tuple

position

Alias for field number 0

class SubeventOperation(position, subevent)

Bases: tuple

position

Alias for field number 0

subevent

Alias for field number 1

class TaxRuleOperation(position, tax_rule)

Bases: tuple

position

Alias for field number 0

tax_rule

Alias for field number 1

add_fee(fee: OrderFee)
add_position(product: Product, variation: ProductVariation, price: Decimal, addon_to: Order = None, subevent: SubEvent = None, seat: Seat = None)
cancel(position: OrderPosition)
cancel_fee(fee: OrderFee)
change_fee(fee: OrderFee, value: Decimal)
change_price(position: OrderPosition, price: Decimal)
change_product(position: OrderPosition, product: Product, variation: ProductVariation | None)
change_product_and_subevent(position: OrderPosition, product: Product, variation: ProductVariation | None, subevent: SubEvent)
change_seat(position: OrderPosition, seat: Seat)
change_subevent(position: OrderPosition, subevent: SubEvent)
change_tax_rule(position_or_fee, tax_rule: TaxRule)
commit(check_quotas=True)
completed_payment_sum
error_messages = {'addon_invalid': 'The selected base position does not allow you to add this product as an add-on.', 'addon_to_required': 'This is an add-on product, please select the base position it should be added to.', 'complete_cancel': 'This operation would leave the order empty. Please cancel the order itself instead.', 'gift_card_change': 'You cannot change the price of a position that has been used to issue a gift card.', 'not_pending_or_paid': 'Only pending or paid orders can be changed.', 'paid_to_free_exceeded': 'This operation would make the order free and therefore immediately paid, however no quota is available.', 'product_invalid': 'The selected product is not active or has no price set.', 'product_without_variation': 'You need to select a variation of the product.', 'quota': 'The quota {name} does not have enough capacity left to perform the operation.', 'quota_missing': 'There is no quota defined that allows this operation.', 'seat_forbidden': 'The selected product does not allow to select a seat.', 'seat_required': 'The selected product requires you to select a seat.', 'seat_subevent_mismatch': 'You selected seat "{seat}" for a date that does not match the selected ticket date. Please choose a seat again.', 'seat_unavailable': 'The selected seat "{seat}" is not available.', 'subevent_required': 'You need to choose a subevent for the new position.', 'tax_rule_country_blocked': 'The selected country is blocked by your tax rule.'}
open_payment
recalculate_taxes(keep='net')
regenerate_secret(position: OrderPosition)
split(position: OrderPosition)
exception eventyay.base.services.orders.OrderError(*args)

Bases: LazyLocaleException

eventyay.base.services.orders.approve_order(order, user=None, send_mail: bool = True, auth=None, force=False)

Mark this order as approved :param order: The order to change :param user: The user that performed the change

eventyay.base.services.orders.change_payment_provider(order: Order, payment_provider, amount=None, new_payment=None, create_log=True, recreate_invoices=True)
eventyay.base.services.orders.deny_order(order, comment='', user=None, send_mail: bool = True, auth=None)

Mark this order as canceled :param order: The order to change :param user: The user that performed the change

eventyay.base.services.orders.expire_orders(sender, **kwargs)
eventyay.base.services.orders.extend_order(order: Order, new_date: datetime, force: bool = False, user: User = None, auth=None)

Extends the deadline of an order. If the order is already expired, the quota will be checked to see if this is actually still possible. If force is set to True, the result of this check will be ignored.

eventyay.base.services.orders.mark_order_expired(order, user=None, auth=None)

Mark this order as expired. This sets the payment status and returns the order object. :param order: The order to change :param user: The user that performed the change

eventyay.base.services.orders.mark_order_paid(*args, **kwargs)
eventyay.base.services.orders.mark_order_refunded(order, user=None, auth=None, api_token=None)
eventyay.base.services.orders.notify_user_changed_order(order, user=None, auth=None, invoices=[])
eventyay.base.services.orders.reactivate_order(order: Order, force: bool = False, user: User = None, auth=None)

Reactivates a canceled order. If force is not set to True, this will fail if there is not enough quota.

eventyay.base.services.orders.send_download_reminders(sender, **kwargs)
eventyay.base.services.orders.send_expiry_warnings(sender, **kwargs)
eventyay.base.services.orders.signal_listener_issue_giftcards(sender: Event, order: Order, **kwargs)
exception eventyay.base.services.cart.CartError(*args)

Bases: Exception

class eventyay.base.services.cart.CartManager(event: Event, cart_id: str, invoice_address: InvoiceAddress = None, widget_data=None, sales_channel='web')

Bases: object

class AddOperation(count, product, variation, price, voucher, quotas, addon_to, subevent, includes_tax, bundled, seat, price_before_voucher)

Bases: tuple

addon_to

Alias for field number 6

bundled

Alias for field number 9

count

Alias for field number 0

includes_tax

Alias for field number 8

price

Alias for field number 3

price_before_voucher

Alias for field number 11

product

Alias for field number 1

quotas

Alias for field number 5

seat

Alias for field number 10

subevent

Alias for field number 7

variation

Alias for field number 2

voucher

Alias for field number 4

class ExtendOperation(position, count, product, variation, price, voucher, quotas, subevent, seat, price_before_voucher)

Bases: tuple

count

Alias for field number 1

position

Alias for field number 0

price

Alias for field number 4

price_before_voucher

Alias for field number 9

product

Alias for field number 2

quotas

Alias for field number 6

seat

Alias for field number 8

subevent

Alias for field number 7

variation

Alias for field number 3

voucher

Alias for field number 5

class RemoveOperation(position)

Bases: tuple

position

Alias for field number 0

class VoucherOperation(position, voucher, price)

Bases: tuple

position

Alias for field number 0

price

Alias for field number 2

voucher

Alias for field number 1

add_new_products(products: List[dict])
apply_voucher(voucher_code: str)
clear()
commit()
extend_expired_positions()
get_last_warning()

Get the last warning message from cart operations.

order = {<class 'eventyay.base.services.cart.AddOperation'>: 30, <class 'eventyay.base.services.cart.ExtendOperation'>: 20, <class 'eventyay.base.services.cart.RemoveOperation'>: 10, <class 'eventyay.base.services.cart.VoucherOperation'>: 15}
property positions
remove_product(pos_id: int)
set_addons(addons)
eventyay.base.services.cart.confirm_messages(sender, *args, **kwargs)
eventyay.base.services.cart.get_fees(event, request, total, invoice_address, provider, positions)
eventyay.base.services.cart.update_tax_rates(event: Event, cart_id: str, invoice_address: InvoiceAddress)
eventyay.base.services.pricing.get_price(product: Product, variation: ProductVariation = None, voucher: Voucher = None, custom_price: Decimal = None, subevent: SubEvent = None, custom_price_is_net: bool = False, custom_price_is_tax_rate: Decimal = None, addon_to: AbstractPosition = None, invoice_address: InvoiceAddress = None, force_custom_price: bool = False, bundled_sum: Decimal = Decimal('0.00'), max_discount: Decimal = None, tax_rule=None) TaxedPrice
class eventyay.base.services.quotas.QuotaAvailability(count_waitinglist=True, ignore_closed=False, full_results=False, early_out=True)

Bases: object

This special object allows so compute the availability of multiple quotas, even across events, and inspect their results. The maximum number of SQL queries is constant and not dependent on the number of quotas.

Usage example:

qa = QuotaAvailability()
qa.queue(quota1, quota2, ...)
qa.compute()
print(qa.results)

Properties you can access after computation.

  • results (dict mapping quotas to availability tuples)

  • count_paid_orders (dict mapping quotas to ints)

  • count_paid_orders (dict mapping quotas to ints)

  • count_pending_orders (dict mapping quotas to ints)

  • count_vouchers (dict mapping quotas to ints)

  • count_waitinglist (dict mapping quotas to ints)

  • count_cart (dict mapping quotas to ints)

compute(now_dt=None, allow_cache=False, allow_cache_stale=False)

Compute the queued quotas. If allow_cache is set, results may also be taken from a cache that might be a few minutes outdated. In this case, you may not rely on the results in the count_* properties.

queue(*quota)
eventyay.base.services.quotas.grouper(iterable, n, fillvalue=None)

Collect data into fixed-length chunks or blocks

Payment & Invoicing

exception eventyay.base.services.invoices.DummyRollbackException

Bases: Exception

eventyay.base.services.invoices.build_cancellation(invoice: Invoice)
eventyay.base.services.invoices.build_invoice(invoice: Invoice) Invoice
eventyay.base.services.invoices.build_preview_invoice_pdf(event)
eventyay.base.services.invoices.fetch_ecb_rates(sender, **kwargs)
eventyay.base.services.invoices.generate_cancellation(invoice: Invoice, trigger_pdf=True)
eventyay.base.services.invoices.generate_invoice(order: Order, trigger_pdf=True)
eventyay.base.services.invoices.invoice_pdf(*args, **kwargs)
eventyay.base.services.invoices.invoice_qualified(order: Order)
eventyay.base.services.invoices.regenerate_invoice(invoice: Invoice)
class eventyay.base.services.mail.CustomEmail(subject='', body='', from_email=None, to=None, bcc=None, connection=None, attachments=None, headers=None, alternatives=None, cc=None, reply_to=None)

Bases: EmailMultiAlternatives

exception eventyay.base.services.mail.SendMailException

Bases: Exception

class eventyay.base.services.mail.TolerantDict

Bases: dict

eventyay.base.services.mail.attach_cid_images(msg, cid_images, verify_ssl=True)
eventyay.base.services.mail.convert_image_to_cid(image_src, cid_id, verify_ssl=True)
eventyay.base.services.mail.encoder_linelength(msg)

RFC1341 mandates that base64 encoded data may not be longer than 76 characters per line https://www.w3.org/Protocols/rfc1341/5_Content-Transfer-Encoding.html section 5.2

eventyay.base.services.mail.get_mail_backend(timeout=None)

Returns an email server connection, either by using the system-wide connection or by returning a custom one based on the system’s settings.

eventyay.base.services.mail.mail(email: str | Sequence[str], subject: str, template: str | LazyI18nString, context: Dict[str, Any] = None, event: Event = None, locale: str = None, order: Order = None, position: OrderPosition = None, *, headers: dict = None, sender: str = None, event_bcc: str = None, event_reply_to: str = None, invoices: Sequence = None, attach_tickets=False, auto_email=True, user=None, attach_ical=False, attach_cached_files: Sequence = None)

Sends out an email to a user. The mail will be sent synchronously or asynchronously depending on the installation.

Parameters:
  • email – The email address of the recipient

  • subject – The email subject. Should be localized to the recipients’s locale or a lazy object that will be localized by being casted to a string.

  • template – The filename of a template to be used. It will be rendered with the locale given in the locale argument and the context given in the next argument. Alternatively, you can pass a LazyI18nString and context will be used as the argument to a Python .format_map() call on the template.

  • context – The context for rendering the template (see template parameter)

  • event – The event this email is related to (optional). If set, this will be used to determine the sender, a possible prefix for the subject and the SMTP server that should be used to send this email.

  • order – The order this email is related to (optional). If set, this will be used to include a link to the order below the email.

  • order – The order position this email is related to (optional). If set, this will be used to include a link to the order position instead of the order below the email.

  • headers – A dict of custom mail headers to add to the mail

  • locale – The locale to be used while evaluating the subject and the template

  • sender – Set the sender email address. If not set and event is set, the event’s default will be used, otherwise the system default.

  • invoices – A list of invoices to attach to this email.

  • attach_tickets – Whether to attach tickets to this email, if they are available to download.

  • attach_ical – Whether to attach relevant .ics files to this email

  • auto_email – Whether this email is auto-generated

  • user – The user this email is sent to

  • attach_cached_files – A list of cached file to attach to this email.

Raises:

MailOrderException – on obvious, immediate failures. Not raising an exception does not necessarily mean that the email has been sent, just that it has been queued by the email backend.

eventyay.base.services.mail.mail_send(*args, **kwargs)
eventyay.base.services.mail.normalize_image_url(url)
eventyay.base.services.mail.render_mail(template, context)
eventyay.base.services.mail.replace_images_with_cid_paths(body_html)

Check-in & Tickets

exception eventyay.base.services.checkin.CheckInError(msg, code)

Bases: Exception

class eventyay.base.services.checkin.LazyRuleVars(position, clist, dt)

Bases: object

entries_days
entries_number
entries_today
property now
property product
property variation
exception eventyay.base.services.checkin.RequiredQuestionsError(msg, code, questions)

Bases: Exception

class eventyay.base.services.checkin.SQLLogic(list)

Bases: object

This is a simplified implementation of JSON logic that creates a Q-object to be used in a QuerySet. It does not implement all operations supported by JSON logic and makes a few simplifying assumptions, but all that can be created through our graphical editor. There’s also CheckinList.validate_rules() which tries to validate the same preconditions for rules set throught he API (probably not perfect).

Assumptions:

  • Only a limited set of operators is used

  • The top level operator is always a boolean operation (and, or) or a comparison operation (==, !=, …)

  • Expression operators (var, lookup, buildTime) do not require further recursion

  • Comparison operators (==, !=, …) never contain boolean operators (and, or) further down in the stack

apply(tests)

Convert JSON logic to queryset info, returns an Q object and fills self.annotations

comparison_to_q(a, b, *args, operator, negate=False, modifier=None)
operation_to_expression(rule)
eventyay.base.services.checkin.get_logic_environment(ev)
eventyay.base.services.checkin.order_placed(sender, **kwargs)
eventyay.base.services.checkin.perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict, force=False, ignore_unpaid=False, nonce=None, datetime=None, questions_supported=True, user=None, auth=None, canceled_supported=False, type='entry')

Create a checkin for this particular order position and check-in list. Fails with CheckInError if the check in is not valid at this time.

Parameters:
  • op – The order position to check in

  • clist – The order position to check in

  • given_answers – A dictionary of questions mapped to validated, given answers

  • force – When set to True, this will succeed even when the position is already checked in or when required questions are not filled out.

  • ignore_unpaid – When set to True, this will succeed even when the order is unpaid.

  • questions_supported – When set to False, questions are ignored

  • nonce – A random nonce to prevent race conditions.

  • datetime – The datetime of the checkin, defaults to now.

eventyay.base.services.checkin.process_exit_all(sender, **kwargs)
exception eventyay.base.services.tickets.DummyRollbackException

Bases: Exception

eventyay.base.services.tickets.generate_order(order: int, provider: str)
eventyay.base.services.tickets.generate_orderposition(order_position: int, provider: str)
eventyay.base.services.tickets.get_tickets_for_order(order, base_position=None)
eventyay.base.services.tickets.preview(event: int, provider: str)

Video & Streaming

class eventyay.base.services.bbb.BBBService(event)

Bases: object

async get_join_url_for_call_id(call_id, user)
async get_join_url_for_room(room, user, moderator=False)
async get_recordings_for_room(room)
eventyay.base.services.bbb.choose_server(event, room=None, prefer_server=None)
eventyay.base.services.bbb.escape_name(name)
eventyay.base.services.bbb.get_call_for_room(room)
eventyay.base.services.bbb.get_create_params_for_call_id(call_id, record, user)
eventyay.base.services.bbb.get_create_params_for_room(room, record, voice_bridge, guest_policy, prefer_server=None)
eventyay.base.services.bbb.get_url(operation, params, base_url, secret)
exception eventyay.base.services.janus.JanusError

Bases: Exception

exception eventyay.base.services.janus.JanusPluginError

Bases: JanusError

eventyay.base.services.janus.choose_server(event)
async eventyay.base.services.janus.create_videoroom(server, room_id, init_token, audiobridge=False, bitrate=200000)
async eventyay.base.services.janus.videoroom_add_token_if_exists(server, room_data, token, audiobridge=False)
eventyay.base.services.turn.choose_server(event)
eventyay.base.services.room.delete_room(event, room, by_user)
eventyay.base.services.room.end_view(view: RoomView, delete=False)
async eventyay.base.services.room.get_viewers(event: Event, room: Room)
eventyay.base.services.room.reorder_rooms(event, id_list, by_user)
eventyay.base.services.room.save_room(event, room, update_fields, old_data, by_user)
eventyay.base.services.room.start_view(room: Room, user: User, delete=False)
class eventyay.base.services.chat.ChatService(event)

Bases: object

add_channel_user(channel_id, user, volatile)
add_reaction(event, reaction, user)
async broadcast_channel_list(user, socket_id)
async create_event(channel, event_type, content, sender, replaces=None, _retry=False)
async enforce_forced_joins(user)
filter_mentions(channel: Channel, uids: list, include_all_permitted: bool = False) set

Filters user IDs based on their membership or permission in a specified channel.

Args:

channel (Channel): The channel to filter the users for. uids (list): List of user IDs to be filtered. include_all_permitted (bool): If True, includes all users with permission ROOM_CHAT_READ in the channel’s room.

Returns:

set: A set of user IDs that are either members of the channel or have the necessary permissions.

async get_channel_users(channel, include_admin_info=False)
get_channels_for_user(user_id, is_volatile=None, is_hidden=False)
get_channels_to_join_forced(user)
get_event(**kwargs)
get_events(channel, before_id, count=50, skip_membership=False, users_known_to_client=None, include_admin_info=False, trait_badges_map=None)
get_highest_nonmember_id_in_channel(channel_id)
async get_last_id()
get_notification_counts(user_id: int) dict

Retrieves the count of notifications for a given user, grouped by channel ID.

Args:

user_id (int): The ID of the user.

Returns:

dict: A dictionary where the keys are channel IDs (as strings) and the values are the count of notifications.

get_or_create_direct_channel(user_ids, hide=True, hide_except: str = None)
hide_channel_user(channel_id, uid)
membership_is_volatile(channel, uid)
remove_channel_user(channel_id, uid)
remove_notifications(user_id: int, channel_id: int, max_id: int) bool

Removes notifications for a given user and channel up to a specified maximum event ID.

Args:

user_id (int): The ID of the user. channel_id (int): The ID of the channel. max_id (int): The maximum event ID to consider for deletion.

Returns:

bool: True if any notifications were deleted, False otherwise.

remove_reaction(event, reaction, user)
show_channels_to_hidden_users(channel_id)
store_notification(event_id: int, user_ids: list)

Stores notifications for a given event for multiple users.

Args:

event_id (int): The ID of the chat event. user_ids (list): List of user IDs to receive the notification.

Returns:

None

async track_subscription(channel, uid, socket_id)
async track_unsubscription(channel, uid, socket_id)
update_event(event, new_content, by_user)
eventyay.base.services.chat.extract_mentioned_user_ids(message: str) set

Extracts user IDs mentioned in a message using a regular expression.

Args:

message (str): The message to extract user IDs from.

Returns:

set: A set of mentioned user IDs extracted from the message.

async eventyay.base.services.chat.get_channel(**kwargs)

Interactive Features

eventyay.base.services.poll.create_poll(options, **kwargs)
eventyay.base.services.poll.delete_poll(**kwargs)
eventyay.base.services.poll.get_poll(pk, room)
eventyay.base.services.poll.get_polls(room, moderator=False, early_results=False, for_user=None, **kwargs)
eventyay.base.services.poll.get_voted_polls(room, user)
eventyay.base.services.poll.pin_poll(pk, room)
eventyay.base.services.poll.unpin_poll(room)
eventyay.base.services.poll.update_poll(**kwargs)
eventyay.base.services.poll.vote_on_poll(pk, room, user, options)
class eventyay.base.services.poster.PosterService(event)

Bases: object

delete(poster_id, by_user)
get_all_posters(presenter_includes_user=None)
get_poster(poster_id, user=None)
get_posters(room_id, user=None, list_format=True)
get_posters_presented_by_user(user_id)
get_presenters(poster_id)
patch(data, event, by_user, exclude_fields=())
unvote(poster_id, user)
vote(poster_id, user)
eventyay.base.services.poster.get_or_create_presenter(user, poster)
eventyay.base.services.poster.get_poster_by_id(event_id, id)
eventyay.base.services.poster.get_presenter_by_id(poster_id, user_id)
eventyay.base.services.poster.get_room_by_id(event_id, id)
eventyay.base.services.question.create_question(**kwargs)
eventyay.base.services.question.delete_question(**kwargs)
eventyay.base.services.question.get_question(pk, room)
eventyay.base.services.question.get_questions(room, add_by_user=None, for_user=None, **kwargs)
eventyay.base.services.question.pin_question(pk, room)
eventyay.base.services.question.unpin_question(room)
eventyay.base.services.question.update_question(**kwargs)
eventyay.base.services.question.vote_on_question(pk, room, user, vote)
eventyay.base.services.roulette.is_member_of_roulette_call(call_id, user)
eventyay.base.services.roulette.roulette_cleanup(socket_id)
eventyay.base.services.roulette.roulette_request(user, room, socket_id, module_config)

Exhibition

class eventyay.base.services.exhibition.ExhibitionService(event)

Bases: object

accept(contact_request_id, staff)
contact(exhibitor_id, user)
delete(exhibitor_id, by_user)
get_all_exhibitors(staff_includes_user=None)
get_exhibition_data_for_user(user_id)
get_exhibitions_staffed_by_user(user_id)
get_exhibitor(exhibitor_id, track_view_for_user=None)
get_exhibitors(room_id)
get_open_requests_from_user(user)
get_staff(exhibitor_id)
missed(contact_request_id)
patch(exhibitor, event, by_user, exclude_fields=())
eventyay.base.services.exhibition.get_exhibitor_by_id(event_id, id)
eventyay.base.services.exhibition.get_or_create_staff(user, exhibitor)
eventyay.base.services.exhibition.get_request_by_id(event_id, id)
eventyay.base.services.exhibition.get_room_by_id(event_id, id)
eventyay.base.services.exhibition.get_staff_by_id(exhibitor_id, user_id)
eventyay.base.services.reactions.store_reaction(room_id: str, reaction: str, amount: int)

User & Auth

eventyay.base.services.auth.close_inactive_staff_sessions(sender, **kwargs)
exception eventyay.base.services.user.AuthError(code)

Bases: Exception

class eventyay.base.services.user.LoginResult(user, event_config, chat_channels, chat_notification_counts, exhibition_data, view)

Bases: tuple

chat_channels

Alias for field number 2

chat_notification_counts

Alias for field number 3

event_config

Alias for field number 1

exhibition_data

Alias for field number 4

user

Alias for field number 0

view

Alias for field number 5

eventyay.base.services.user.block_user(event, blocking_user: User, blocked_user_id) bool
eventyay.base.services.user.create_user(event_id, *, token_id=None, client_id=None, traits=None, profile=None, pretalx_id=None, anonymous_invite=None)
eventyay.base.services.user.delete_user(event, user_id, by_user) bool
eventyay.base.services.user.end_view(view: EventView, delete=False)
eventyay.base.services.user.get_blocked_users(user, event) bool
eventyay.base.services.user.get_public_user(event_id, id, include_admin_info=False, trait_badges_map=None)
eventyay.base.services.user.get_public_users(event_id, *, ids=None, pretalx_ids=None, include_admin_info=False, trait_badges_map=None, include_banned=True, require_show_publicly=False, type=User.UserType.PERSON)
eventyay.base.services.user.get_user(event=None, *, with_id=None, with_token=None, with_client_id=None, with_invite_token=None)
eventyay.base.services.user.get_user_by_client_id(event_id, client_id)
eventyay.base.services.user.get_user_by_id(event_id, user_id)
eventyay.base.services.user.get_user_by_token_id(event_id, token_id)
eventyay.base.services.user.get_user_video_token(user_code, video_settings)
eventyay.base.services.user.list_users(event_id, page, page_size, search_term, search_fields=None, badge=None, trait_badges_map=None, include_banned=True, include_admin_info=False) object
eventyay.base.services.user.login(*, event=None, token=None, client_id=None, invite_token=None) LoginResult
eventyay.base.services.user.set_user_banned(event, user_id, by_user) bool
eventyay.base.services.user.set_user_free(event, user_id, by_user) bool
eventyay.base.services.user.set_user_silenced(event, user_id, by_user) bool
eventyay.base.services.user.start_view(user: User, delete=False)
eventyay.base.services.user.unblock_user(event, blocking_user: User, blocked_user_id) bool
eventyay.base.services.user.update_fav_talks(user_token_id, talks, event_id)
eventyay.base.services.user.update_user(event_id, id, *, traits=None, data=None, is_admin=False, serialize=True)
async eventyay.base.services.user.user_broadcast(event_type, data, user_id, socket_id)

Event Management

class eventyay.base.services.event.EventConfigSerializer(*args, **kwargs)

Bases: Serializer

validate_social_logins(val)
async eventyay.base.services.event.create_room(event, data, creator)
eventyay.base.services.event.generate_tokens(event, number, traits, days, by_user, long=False)
eventyay.base.services.event.get_audit_log(event)
async eventyay.base.services.event.get_event(event_id)
eventyay.base.services.event.get_event_config_for_user(event, user)
eventyay.base.services.event.get_permissions_for_traits(rules, traits, prefixes)
async eventyay.base.services.event.get_room(**kwargs)
eventyay.base.services.event.get_room_config(room, permissions)
async eventyay.base.services.event.get_room_config_for_user(room: str, event_id: str, user)
eventyay.base.services.event.get_rooms(event, user)
async eventyay.base.services.event.notify_event_change(event_id)
async eventyay.base.services.event.notify_schedule_change(event_id)
eventyay.base.services.event.save_event(event, update_fields, old_data, by_user)

Data Management

exception eventyay.base.services.export.ExportError(*args)

Bases: LazyLocaleException

exception eventyay.base.services.orderimport.DataImportError(*args)

Bases: LazyLocaleException

eventyay.base.services.orderimport.parse_csv(file, length=None)
eventyay.base.services.orderimport.setif(record, obj, attr, setting)
eventyay.base.services.cleanup.clean_cached_files(sender, **kwargs)
eventyay.base.services.cleanup.clean_cached_tickets(sender, **kwargs)
eventyay.base.services.cleanup.clean_cart_positions(sender, **kwargs)
eventyay.base.services.cleanup.clearsessions(sender, **kwargs)

System

This code has been taken from https://blog.hypertrack.io/2016/10/08/dealing-with-database-transactions-in-django-celery/

Usage:

1from eventyay.base.services.async import TransactionAwareTask
2
3@task(base=TransactionAwareTask)
4def task_function():
5    pass
class eventyay.base.services.tasks.EventTask

Bases: Task

priority = None

Default task priority.

rate_limit = None

Rate limit for this task type. Examples: None (no rate limit), ‘100/s’ (hundred tasks a second), ‘100/m’ (hundred tasks a minute),`’100/h’` (hundred tasks an hour)

request_stack = <celery.utils.threads._LocalStack object>

Task request stack, the current request will be the topmost.

serializer = 'json'

The name of a serializer that are registered with kombu.serialization.registry. Default is ‘json’.

store_errors_even_if_ignored = False

When enabled errors will be stored even if the task is otherwise configured to ignore results.

typing = True

Enable argument checking. You can set this to false if you don’t want the signature to be checked when calling the task. Defaults to app.strict_typing.

class eventyay.base.services.tasks.OrganizerUserTask

Bases: Task

priority = None

Default task priority.

rate_limit = None

Rate limit for this task type. Examples: None (no rate limit), ‘100/s’ (hundred tasks a second), ‘100/m’ (hundred tasks a minute),`’100/h’` (hundred tasks an hour)

request_stack = <celery.utils.threads._LocalStack object>

Task request stack, the current request will be the topmost.

serializer = 'json'

The name of a serializer that are registered with kombu.serialization.registry. Default is ‘json’.

store_errors_even_if_ignored = False

When enabled errors will be stored even if the task is otherwise configured to ignore results.

typing = True

Enable argument checking. You can set this to false if you don’t want the signature to be checked when calling the task. Defaults to app.strict_typing.

class eventyay.base.services.tasks.ProfiledEventTask

Bases: ProfiledTask, EventTask

class eventyay.base.services.tasks.ProfiledOrganizerUserTask

Bases: ProfiledTask, OrganizerUserTask

class eventyay.base.services.tasks.ProfiledTask

Bases: Task

priority = None

Default task priority.

rate_limit = None

Rate limit for this task type. Examples: None (no rate limit), ‘100/s’ (hundred tasks a second), ‘100/m’ (hundred tasks a minute),`’100/h’` (hundred tasks an hour)

request_stack = <celery.utils.threads._LocalStack object>

Task request stack, the current request will be the topmost.

serializer = 'json'

The name of a serializer that are registered with kombu.serialization.registry. Default is ‘json’.

store_errors_even_if_ignored = False

When enabled errors will be stored even if the task is otherwise configured to ignore results.

typing = True

Enable argument checking. You can set this to false if you don’t want the signature to be checked when calling the task. Defaults to app.strict_typing.

class eventyay.base.services.tasks.TransactionAwareProfiledEventTask

Bases: ProfiledEventTask

apply_async(*args, **kwargs)

Unlike the default task in celery, this task does not return an async result

class eventyay.base.services.tasks.TransactionAwareTask

Bases: ProfiledTask

Task class which is aware of django db transactions and only executes tasks after transaction has been committed

apply_async(*args, **kwargs)

Unlike the default task in celery, this task does not return an async result

class eventyay.base.services.locking.LockManager(event)

Bases: object

exception eventyay.base.services.locking.LockReleaseException

Bases: Exception

exception eventyay.base.services.locking.LockTimeoutException

Bases: Exception

class eventyay.base.services.locking.NoLockManager

Bases: object

eventyay.base.services.locking.lock_event(event)

Issue a lock on this event so nobody can book tickets for this event until you release the lock. Will retry 5 times on failure.

Raises:

LockTimeoutException – if the event is locked every time we try to obtain the lock

eventyay.base.services.locking.lock_event_db(event)
eventyay.base.services.locking.lock_event_redis(event)
eventyay.base.services.locking.redis_lock_from_event(event)
eventyay.base.services.locking.release_event(event)

Release a lock placed by lock(). If the parameter force is not set to True, the lock will only be released if it was issued in _this_ python representation of the database object.

Raises:

LockReleaseException – if we do not own the lock

eventyay.base.services.locking.release_event_db(event)
eventyay.base.services.locking.release_event_redis(event)
eventyay.base.services.notifications.inline_css(html, inline_style_tags=True, keep_style_tags=False, keep_link_tags=False, keep_at_rules=False, minify_css=False, base_url=None, load_remote_stylesheets=True, cache=None, extra_css=None, preallocate_node_capacity=32)

inline(html, inline_style_tags=True, keep_style_tags=False, keep_link_tags=False, keep_at_rules=False, minify_css=False, base_url=None, load_remote_stylesheets=True, cache=None, extra_css=None, preallocate_node_capacity=32)

Inline CSS in the given HTML document

eventyay.base.services.notifications.send_notification_mail(notification: Notification, user: User)
class eventyay.base.services.stats.Dontsum(value: Any)

Bases: object

class eventyay.base.services.stats.DummyObject

Bases: object

eventyay.base.services.stats.dictsum(*dicts) dict

Takes multiple dictionaries as arguments and builds a new dict. The input dict is expected to be a mapping of keys to tuples. The output dict will contain all keys that are present in any of the input dicts and will contain the tuplesum of all values associated with this key (see tuplesum function).

Sample:

>>> dictsum({'a': (1, 2), 'b': (3, 4)}, {'a': (5, 6), 'c': (7, 8)})
{'a': (6, 8), 'b': (3, 4), 'c': (7, 8)}
eventyay.base.services.stats.order_overview(event: Event, subevent: SubEvent = None, date_filter='', date_from=None, date_until=None, fees=False, admission_only=False, browser_timezone=None) Tuple[List[Tuple[ProductCategory, List[Product]]], Dict[str, Tuple[Decimal, Decimal]]]
eventyay.base.services.stats.tuplesum(tuples: Iterable[Tuple]) Tuple

Takes a list of tuples of size n. In our case, those are e.g. tuples of size 2 containing a number of sales and a sum of their toal amount.

Returned is again a tuple of size n. The first component of the returned tuple is the sum of the first components of all input tuples.

Sample:

>>> tuplesum([(1, 2), (3, 4), (5, 6)])
(9, 12)
eventyay.base.services.update_check.check_result_table()
eventyay.base.services.update_check.run_update_check(sender, **kwargs)
eventyay.base.services.update_check.send_update_notification_email()