Restriction of $\mathcal O_X(D)$ to a prime divisor occuring in $D$ Let $X$ be a regular variety over a field $k$, and consider $D=\sum_{i=1}^nn_iD_i$ a divisor on $X$, with $n_i\in \mathbb Z\backslash\{0\}$ and $D_i$ a prime divisor. Consider the invertible sheaf $\mathcal L = \mathcal O_X(D)$. I would like to understand the restriction of $\mathcal L$ to one of the prime divisors $D_i$. More precisely, I call restriction of $\mathcal L$ to $D_i$ the pullback of $\mathcal L$ via the closed immersion $D_i \hookrightarrow X$, and denote it by $\mathcal L_{|D_i}$. It is still an invertible sheaf over $D_i$ ; must it be isomorphic to some $\mathcal O_{D_i}(\tilde{D})$ where $\tilde D$ is a divisor on $D_i$ ? If so, how does $\tilde D$ relate to $D$ ?  

As a motivation, I am trying to understand the counter example given in page 3, (2.6) remark (ii) of these notes on abelian varieties (see the cropped picture below). Namely, I try to understand why the restriction of the line bundle considered by the author to $\{0\}\times X$ and $X\times \{0\}$ is indeed trivial. 

 A: Let $D=\sum n_jP_j$ be a divisor on a variety $Z$ with field of rational functions $k(Z)$, the $P_j$ are irreducible hypersurfaces, and $Q$ is another one, distinct from the $P_j$. If $P_j\cap Q$ is non-empty then it is an hypersurface on $Q$ (possibly not irreducible, possibly not with multiplicities one, so we need to represent locally $P_j$ as the zero of a rational function $h$ such that $Q$ doesn't appear in $div(h)$, restrict $h$ to a rational function $h_Q\in k(Q)^*$, and read in $div(h_Q)$ what is the divisor $P_j\cap Q$). Then 
$$O_Z(D)|_Q=O_Q(D\cap Q),\qquad D\cap Q=\sum n_j (P_j\cap Q)$$
For $f\in k(Z)^*$ such that $Q$ doesn't appear in $div(f)$, let $f_Q$ be the rational function $\in k(Q)^*$ obtained by restricting $f$ to $Q$. We get $$(f O_Z(D))|_Q=O_Z(D-div(f))|_Q=O_Q( D\cap Q-div(f_Q))=f_Q \ O_Q(D\cap Q)=f_Q\ O( D)|_Q$$

Thus the restriction of sheaf of rational functions is compatible with the rational equivalence. 

If $Q$ appears in $D$, take some rational function $g\in k(Z)^*$ such that $Q$ doesn't appear in $D-div(g)$, then $O_Z(D)|_Q$ is only defined modulo rational equivalence, through $$O_Z(D)|_Q \sim O_Z(D-div(g))|_Q=O_Q( (D-div(g))\cap Q)$$
$O_Z(D)$ is a sheaf of rational function : it is the thing sending each open set $U\subset Z$ to $$O_Z(D)(U)= \{ h\in k(Z)^*, div(h)\cap U+D\cap U\ge 0\}$$
For an open covering $Z=\bigcup V_i$ and some rational functions $f_{ij}\in O_Z(V_i\cap V_j)^\times$ such that $f_{ij}f_{jl}=f_{il}$ then $$L: U\mapsto L(U) = \{ (g_i)_i, g_i \in O_Z(V_i\cap U), g_i = f_{ij}g_j\}$$ is a line bundle, corresponding to all the sheafs $f_{1l} O_Z(D)$ where $D$ is the divisor such that $D\cap V_i=div(f_{1i})$.
Viewing $L$ as the variety $\bigcup_i V_i \times \overline{k}$ with transitions functions $V_i \times \overline{k}\to V_j \times \overline{k}, (v,a)\to (v,f_{il}(v)a)$ then the restriction of $L$ to $Q$ has a natural formulation.
