| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/openid/store/__pycache__/ |
Upload File : |
�
8O�^A � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ d� Z G d� de� � Z
G d � d
e
� � Z G d� de
� � Z G d
� de
� � Z
dS )a.
This module contains C{L{OpenIDStore}} implementations that use
various SQL databases to back them.
Example of how to initialize a store database::
python -c 'from openid.store import sqlstore; import pysqlite2.dbapi2;'
'sqlstore.SQLiteStore(pysqlite2.dbapi2.connect("cstore.db")).createTables()'
� N)�Association)�OpenIDStore)�noncec � � � � fd�}t � d� � r& � j dd � |_ n# t $ r Y nw xY wt � d� � r� j |_ |S )Nc �( �� | j �| g|�R i |��S �N)�_callInTransaction)�self�args�kwargs�funcs ��7/usr/lib/python3/dist-packages/openid/store/sqlstore.py�wrappedz_inTxn.<locals>.wrapped s( �� �&�t�&�t�T�C�D�C�C�C�F�C�C�C� �__name__� �__doc__)�hasattrr � TypeErrorr )r
r s ` r �_inTxnr s� �� �D� D� D� D� D� �t�Z� � � � �#�}�Q�R�R�0�G����� � � ��D� ���� �t�Y��� '��,����Ns �- �
:�:c � � e Zd ZdZdZdZdd�Zd� Zd� Zd� Z d � Z
d
� Zd� Zd� Z
ee
� � Zd
� Z ee� � Zdd�Z ee� � Zd� Z ee� � Zd� Z ee� � Zd� Z ee� � Zd� Z ee� � ZdS )�SQLStorea�
This is the parent class for the SQL stores, which contains the
logic common to all of the SQL stores.
The table names used are determined by the class variables
C{L{associations_table}} and
C{L{nonces_table}}. To change the name of the tables used, pass
new table names into the constructor.
To create the tables with the proper schema, see the
C{L{createTables}} method.
This class shouldn't be used directly. Use one of its subclasses
instead, as those contain the code necessary to use a specific
database.
All methods other than C{L{__init__}} and C{L{createTables}}
should be considered implementation details.
@cvar associations_table: This is the default name of the table to
keep associations in
@cvar nonces_table: This is the default name of the table to keep
nonces in.
@sort: __init__, createTables
�oid_associations�
oid_noncesNc �L � || _ d| _ i | _ |p| j |p| j d�| _ d| _ t | j d� � r!t | j d� � r| j | _ t | j d� � rt | j d� � st d� � �dS )a�
This creates a new SQLStore instance. It requires an
established database connection be given to it, and it allows
overriding the default table names.
@param conn: This must be an established connection to a
database of the correct type for the SQLStore subclass
you're using.
@type conn: A python database API compatible connection
object.
@param associations_table: This is an optional parameter to
specify the name of the table used for storing
associations. The default value is specified in
C{L{SQLStore.associations_table}}.
@type associations_table: C{str}
@param nonces_table: This is an optional parameter to specify
the name of the table used for storing nonces. The
default value is specified in C{L{SQLStore.nonces_table}}.
@type nonces_table: C{str}
N)�associations�noncesi`T �IntegrityError�OperationalErrorzDError using database connection module (Maybe it can't be imported?))
�conn�cur�_statement_cache�associations_table�nonces_table�_table_names�
max_nonce_ager �
exceptions�RuntimeError)r
r r# r$ s r �__init__zSQLStore.__init__D s� � �: �� ���� "���.�I�$�2I�"�7�d�&7�
�
��� )���
�D�I�/�0�0� (��� �#5�6�6� (�"�i�D�O����)9�:�:� @����);�<�<� @�� ?� @� @�
@� @� @r c � � |S )zSConvert a blob as returned by the SQL engine into a str object.
str -> str� �r
�blobs r �
blobDecodezSQLStore.blobDecodev s � � �r c � � |S )z]Convert a str object into the necessary object for storing
in the database as a blob.r+ �r
�ss r �
blobEncodezSQLStore.blobEncode| s � � �r c � � | j | S # t $ r) t | |� � }|| j z }|| j |<